Уровень 10.1 задачника Kotlin

Задание 1

Дан произвольный двухмерный массив:

kotlinlet arr = arrayOf(
  intArrayOf(11, 12, 13, 14, 15),
  intArrayOf(21, 22, 23, 24, 25),
  intArrayOf(31, 32, 33, 34, 35),
  intArrayOf(41, 42, 43, 44, 45),
  intArrayOf(51, 52, 53, 54, 55)
)

Получите массив элементов его главной диагонали:

kotlin[
  11, 22, 33, 44, 55
]
Задание 2

Дана коллекция Map:

kotlinval transactions = mapOf(
  "user1" to listOf(
    mapOf("type" to "deposit", "amount" to 100),
    mapOf("type" to "withdraw", "amount" to 50),
    mapOf("type" to "deposit", "amount" to 200)
  ),
  "user2" to listOf(
    mapOf("type" to "deposit", "amount" to 300),
    mapOf("type" to "withdraw", "amount" to 100)
  )
)

Для каждого пользователя рассчитайте конечный баланс после всех операций.