Learn Kotlin with the Kotlin Team: Advent of Code 2020 #5

preview_player
Показать описание
We continue to learn Kotlin with the Kotlin team! In the fifth episode, we'll look at a “hidden” binary encoding for natural numbers that can be used to identify seats on a plane, along with the Kotlin solution for the challenge. Along the way, we'll discuss the Kotlin standard library functions for working with the binary representation of numbers, the power of local functions, and why ‘max’ disappeared from the standard library but will “reappear” in a new form.

Day 5: Binary boarding
Use the Kotlin standard library functions ('replace', 'toInt', 'find') to work with the binary representation of numbers, explore powerful local functions, and learn how to use the 'max' function in Kotlin 1.5.

0:51 Problem description
3:42 Solving part I: Boarding pass: binary representation
6:30 Decoding column
7:31 Converting boarding pass to seat ID
8:50 Finding the maximum seat ID
9:30 Solving part II: Finding the vacant seat ID
12:43 Wrapping up

* Used with the permission of Advent of Code (Eric Wastl)
#Kotlin #Idiomatic #Tutorial #AdventOfCode #AdventOfCode2020 #AdventOfСodeInKotlin #Day5
Рекомендации по теме
Комментарии
Автор

what is the font used?, It's really suiting for kotlin

dibyojyotibhattacherjee
Автор

If its possible, can you group those videos in playlist? Or maybe keep Day number in title, like "Advent of Code Day 05". Its hard to search for those right now ;)

rafakuzminski
Автор

Love this channel but please include subtitles. It helps a lot!

DinMamma
Автор

Collection / sequence functions that return non-nullable values (maxOf etc.) are useful, however they have one weakness: they produce a very generic error message that provides little to no indication of what actually went wrong in your code on a semantic level. That's not Kotlin's fault of course. I just generally prefer to use the nullable versions, and proceed with

... ?: throw IllegalStateException("some useful error message")

instead. This way, you'll get much better error messages and your code will still be readable. Using "!!" is the worst option in this regard, as the error it produces is even less indicative of what actually happened.

AlanDarkworld
Автор

печалька, что нет субтитров 0;50 10.09.2021! Chrome их переводит на нужный язык

andrey
Автор

these Coding Puzzles are nice, but it is all just lambdas and calling functions.

How about Architectural Coding Puzzles, where you have to use generics and inheritance. examples of splitting code into multiple classes... and there is also delegation and stuff...

georgeshalvashvili