The JetBrains Blog

Blog

  • Blogs by Topic
    • English
    • Deutsch
    • Español
    • Français
    • 日本語
    • 한국어
    • Русский
    • 简体中文
    • Português do Brasil
    • Türkçe
    • IDEs

      • AppCode
      • CLion
      • DataGrip
      • DataSpell
      • Fleet
      • GoLand
      • IntelliJ IDEA
      • PhpStorm
      • PyCharm
      • Rider
      • RubyMine
      • WebStorm
    • Plugins & Services

      • Big Data Tools
      • Code With Me
      • Quality Assurance
      • JetBrains Platform
      • Rust
      • Scala
      • Toolbox App
      • Writerside
    • Team Tools

      • Datalore
      • Space
      • TeamCity
      • Upsource
      • YouTrack
      • Hub
      • Qodana
    • .NET & Visual Studio

      • .NET Tools
      • ReSharper C++
    • Languages & Frameworks

      • Kotlin
      • Ktor
      • MPS
    • Education & Research

      • Edu Products
      • Research
    • Company

      • Company Blog
      • Security
Kotlin logo

The Kotlin Blog

Kotlin Programming Language by JetBrains

Follow
  • Follow Kotlin:
  • Twitter
  • RSS
Visit the Kotlin Site
Follow
  • Follow Kotlin:
  • Twitter
  • RSS
  • News
  • Releases
  • Server
  • Mobile
  • Data Science
  • Libraries
  • Early Access Program
Visit the Kotlin Site

Collections

Advent of Code in Idiomatic Kotlin. Day 9

Idiomatic Kotlin: Solving Advent of Code Puzzles, Working With Lists

This post continues our “Idiomatic Kotlin” series and provides the solution for the Advent of Code Day 9* challenge. While solving it, we’ll look into different ways to manipulate lists in Kotlin. Day 9. Encoding error, part I We need to attack a weakness in data encrypted with the eXchange-Masking Addition System (XMAS)! The data is a list of numbers, and we need to find the first number in the list (starting from the 26th) that is not the sum of any 2 of the 25 numbers before it. We’ll call the number valid if it can be presented as a sum of two numbers from the previous sublist, a

Svetlana Isakova Svetlana Isakova

Idiomatic Kotlin: Solving Advent of Code Puzzles, Set Operations

Grouping and counting the characters in strings and collections is a very typical task given in coding interviews. Usually, the solutions for such tasks are quite simple. In this blog post, we learn about a few useful functions in Kotlin that make set operations really simple. The task: custom customs The task for the Advent of Code Day 6 challenge requires us to count the answers on customs declaration forms. We are provided with the results of the filled-in forms for different groups of people. Below is the original sample provided in the AoC Day 6 challenge: abc a b c ab ac

Anton Arhipov Anton Arhipov
  • Privacy & Security
  • Terms of Use
  • Legal
  • Genuine tools
  • English
  • Deutsch
  • Español
  • Français
  • 日本語
  • 한국어
  • Русский
  • 简体中文
  • Português do Brasil
  • Türkçe
Copyright © 2000–2022 JetBrains s.r.o.