LeetCode Entry

1436. Destination City

15.12.2023 easy 2023 kotlin

#### Join me on Telegram

1436. Destination City easy blog post substack image.png

Join me on Telegram

https://t.me/leetcode_daily_unstoppable/439

Complexity

  • Time complexity: \(O(n)\)

  • Space complexity: \(O(n)\), with toSet

Code


    fun destCity(paths: List<List<String>>): String =
      (paths.map { it[1] } - paths.map { it[0] }).first()