https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
advent-of-code
  • a

    adam-mcneilly

    12/01/2017, 6:02 PM
    Detroit Kotliners, unite 😄 ✋
    • 1
    • 1
  • s

    stkent

    12/01/2017, 6:59 PM
    [Spoilers] I'll be posting solutions here: https://github.com/stkent/AdventOfCode2017
    k
    • 2
    • 2
  • k

    karelpeeters

    12/01/2017, 7:00 PM
    Ah you can be invited to channels? Amazing, thanks.
    s
    • 2
    • 2
  • j

    jamie-purchase

    12/01/2017, 7:38 PM
    [poorly written spoilers] would be interesting to get some feedback on how bad my Kotlin is at the moment - solved day 1 in a rush https://gist.github.com/CraicOverflow89/bbb15b69d82c22d0845380514a43d613 https://gist.github.com/CraicOverflow89/ece2fc083f39d2c63889156628ecd317
    p
    d
    • 3
    • 21
  • s

    Shawn

    12/01/2017, 8:18 PM
    took a different approach to my solution, would appreciate if anyone could tell me if I’m doing anything in a particularly roundabout fashion: https://pastebin.com/DbdhPeK0
    s
    • 2
    • 2
  • k

    karelpeeters

    12/01/2017, 10:18 PM
    Take a look at my solution, put the filter in you
    sumBy
    using
    if
    .
    h
    • 2
    • 1
  • h

    holgerbrandl

    12/02/2017, 8:20 AM
    Funny that @adam-mcneilly @Jan Vomlel and me used the same ugly char to int conversion. I was tricked by
    toInt
    initially, but learnt my lesson quickly.
    j
    • 2
    • 2
  • h

    holgerbrandl

    12/02/2017, 4:31 PM
    @andyb d2 part 1 would be more concise by using
    max
    min
    instead of folding. See my solution above.
    a
    • 2
    • 1
  • h

    holgerbrandl

    12/02/2017, 4:33 PM
    for part2 you could use
    flatMap
    to cut down code. And it would also fail (same as mine, but not in @karelpeeters solution) if there would be number duplicates in a row.
    a
    k
    s
    • 4
    • 12
  • s

    s.luhmirins

    12/04/2017, 10:43 AM
    I was disappointed how easy today was:
    val simple = input.map {  it.split(" ") }
                .map { it.size to it.toSet() }
                .map { it.second.size == it.first }
                .count { it }
    
    val advanced =  input.map { it.split(" ") }
                .map { it.size to it.map { it.toCharArray().toSet() }.toSet() }
                .map { it.second.size == it.first }
                .count { it }
    h
    • 2
    • 2
  • a

    andyb

    12/04/2017, 2:54 PM
    Does anyone have a Private Leaderboard that I could join or alternatively would anyone be interested if we create one for Kotliners?
    k
    • 2
    • 2
  • k

    karelpeeters

    12/07/2017, 8:39 PM
    I'm quite happy with my solution now, except for the implementation of
    leaf
    🙂.
    h
    • 2
    • 1
  • k

    karelpeeters

    12/08/2017, 2:52 PM
    I got to use a
    when
    as the condition of an
    if
    , and finally found a use for anonymous local objects.
    👍 1
    a
    m
    • 3
    • 10
  • h

    holgerbrandl

    12/08/2017, 3:27 PM
    @karelpeeters Cool a local object! Totally forgot about those. I think I’ll force them into my day9.
    k
    • 2
    • 1
  • k

    karelpeeters

    12/09/2017, 11:37 AM
    Today was bit easy again when you use a reluctant regex modifier for the garbage.
    s
    • 2
    • 3
  • h

    holgerbrandl

    12/09/2017, 8:12 PM
    @karelpeeters still, your amazing regex approach rulez da kotlin house today.
    k
    • 2
    • 1
  • j

    Jan Vomlel

    12/09/2017, 10:54 PM
    My solution is not so short, clean, nice as solutions with regular expressions, but it can be used for big data because it calculates everything during data reading. https://github.com/JanVomlel/advent2017/blob/master/src/Day9.kt
    👍 2
    a
    • 2
    • 1
  • m

    menegatti

    12/10/2017, 1:31 PM
    wow, I didn't know there was an example with swap. They probably didn't add it to the stdlib because it's so short to implement
    k
    • 2
    • 1
  • k

    karelpeeters

    12/11/2017, 9:50 AM
    Hmm looks like just converting to
    fold
    wouldn't work for me either @andyb.
    a
    • 2
    • 2
  • t

    todd.ginsberg

    12/11/2017, 6:24 PM
    Checking in after pushing code. I found this resource and read it, that really helped. https://www.redblobgames.com/grids/hexagons/
    s
    m
    • 3
    • 3
  • t

    todd.ginsberg

    12/13/2017, 3:02 AM
    My solution to part two was a bit different, I stored off all the nodes I'd seen previously (because they'll only ever show up in one group) and it turned out about 6x faster. But I only really did it that way because I wanted to write about it.
    m
    • 2
    • 3
  • a

    andyb

    12/13/2017, 12:01 PM
    Just had a look at @todd.ginsberg solution for yesterday, that use of the sequence() to provide lazy filtering is very neat. I will definitely have to use that pattern in future.
    m
    • 2
    • 1
  • k

    karelpeeters

    12/18/2017, 5:44 PM
    @andyb"// Assume timeout will only occur on Deadlock." indeed.
    a
    • 2
    • 6
  • k

    karelpeeters

    12/18/2017, 11:53 PM
    I tried combining them into one but I only managed to come up with ugly solutions, the dependency on the register value for part 1 always got in the way.
    ➕ 1
    r
    • 2
    • 2
  • a

    andyb

    12/19/2017, 3:55 PM
    @dave08 Nope, it just hangs if I put a 0 in there
    d
    • 2
    • 1
  • t

    todd.ginsberg

    12/22/2017, 2:28 PM
    Well work and home got in the way yesterday but I finally finished and wrote it up late. I pre-calculated all the transforms as well and that saved a ton of time. Part 2 ran in 3.4s for me, so not terrible. I probably do a lot more slicing and dicing than I needed to. Splitting the grid was the hardest part for me but I eventually settled on two infix functions to split into rows and then groups of rows into columns and that was easier for me to comprehend. I won't post the code since it was yesterday but it's in my repo https://github.com/tginsberg/advent-2017-kotlin
    m
    • 2
    • 3
  • t

    todd.ginsberg

    12/25/2017, 2:40 PM
    I had so much fun with AoC this year. I'm sad it's over, but honestly I need a break. Solving, refactoring, and writing about each solution has become a lifestyle and I need to do other things. Still, I have a few good ideas for small projects and libraries out of this, so that's good. Any it was really fun coming here every day and seeing what you guys did and how you solved things!
    ➕ 1
    s
    • 2
    • 3
  • t

    todd.ginsberg

    06/03/2018, 3:25 PM
    Half way there... heh
    🙂 3
    a
    • 2
    • 1
  • j

    Joris PZ

    11/21/2018, 7:34 PM
    Did some more from-the-hip testing, here are the durations of AoC 2017 Day 2 (both parts), when repeating the calculation ten times (in-process):
    JVM:    76,  3,  3,  6,  4,  4,  3,  2,  1,  3 ms
    JS:     34, 16,  7,  6,  6,  4,  4,  4,  7,  5 ms
    Native: 15, 14, 15, 16, 14, 14, 13, 14, 13, 13 ms
    I didn't expect Node to become faster over time, but apparently there's some runtime optimization going on there as well
    • 1
    • 1
  • j

    joelpedraza

    11/28/2018, 10:01 PM
    I looked at the khan academy one. it is weekly, with meatier problems
    Implement A* for the _N+1_th time? I did have a bit of fun representing the grid when I realized that a cell has the same amount of neighbors as there are bits in a byte. Was disappointed to find out theres no way to create an array of inline-class-wrapped primitives
    w
    • 2
    • 1
Powered by Linen
Title
j

joelpedraza

11/28/2018, 10:01 PM
I looked at the khan academy one. it is weekly, with meatier problems
Implement A* for the _N+1_th time? I did have a bit of fun representing the grid when I realized that a cell has the same amount of neighbors as there are bits in a byte. Was disappointed to find out theres no way to create an array of inline-class-wrapped primitives
w

wakingrufus

11/29/2018, 8:05 PM
maybe i was thinking of the KtAcademy one actually
View count: 6