Solution to data structures and algorithms problem in Kotlin/Java/Python | Dark Hacker News