Hi, so I have this map of categories `categories: ...
# announcements
k
Hi, so I have this map of categories
categories: Map<Int, Int>
with key being category id, and value being id of a parent. For any given category I want to find full path, till parent id = 0. My current solution is kinda ugly:
Copy code
var id: Int = categoryId
val path = mutableListOf<Int>()
do {
    path.add(id)
    id = categories[id]!!
} while (id != 0)
How can I write this better, without yield?