Last active
September 5, 2020 14:24
-
-
Save windmaomao/7c00aad20306f1cf5d610c4cf3aa18cc to your computer and use it in GitHub Desktop.
Generator to the rescue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun part2s(s: String): Int { | |
val all = s.asSequence() | |
scan(0) { acc, c -> acc + charValue(c) } | |
return all.indexOf(-1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment