15.12.2023
1436. Destination City easy
blog post
Join me on Telegram
https://t.me/leetcode_daily_unstoppable/439
Complexity
Time complexity:
O(n)Space complexity:
O(n), withtoSet
Code
fun destCity(paths: List<List<String>>): String =
(paths.map { it[1] } - paths.map { it[0] }).first()