I have created a PR otherwise it is hard to comment on the code#1
Open
yuriykulikov wants to merge 24 commits intoreviewedfrom
Open
I have created a PR otherwise it is hard to comment on the code#1yuriykulikov wants to merge 24 commits intoreviewedfrom
yuriykulikov wants to merge 24 commits intoreviewedfrom
Conversation
yuriykulikov
commented
Dec 10, 2022
src/test/kotlin/day3/Day3.kt
Outdated
| var lookup = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | ||
|
|
||
| fun silver(lines: List<String>): Int { | ||
| return lines.map { line -> Pair(line.substring(0, line.length / 2), line.substring(line.length / 2)) } |
Collaborator
Author
There was a problem hiding this comment.
Suggested change
| return lines.map { line -> Pair(line.substring(0, line.length / 2), line.substring(line.length / 2)) } | |
| return lines.map { line -> line.substring(0, line.length / 2) to line.substring(line.length / 2) } |
src/test/kotlin/day3/Day3.kt
Outdated
|
|
||
| fun silver(lines: List<String>): Int { | ||
| return lines.map { line -> Pair(line.substring(0, line.length / 2), line.substring(line.length / 2)) } | ||
| .map { pair -> |
Collaborator
Author
There was a problem hiding this comment.
Suggested change
| .map { pair -> | |
| .map { (left, right) -> |
| } | ||
| } | ||
|
|
||
| fun createPairOfCollections(line: String): Pair<List<Int>, List<Int>> { |
Collaborator
Author
There was a problem hiding this comment.
Try to avoid Pairs in function signatures. It is hard to read.
src/test/kotlin/day5/Day5.kt
Outdated
|
|
||
| @Test | ||
| fun sampleSilver() { | ||
| val (stack, commands) = parseStackAndCommands("sample") |
Collaborator
Author
There was a problem hiding this comment.
why not 2 functions?
| } | ||
| } | ||
|
|
||
| fun findMessage(line: String, length: Int): Int { |
| RIGHT | ||
| } | ||
|
|
||
| typealias Coordinate = Pair<Int, Int> |
Collaborator
Author
There was a problem hiding this comment.
Suggested change
| typealias Coordinate = Pair<Int, Int> | |
| data class Coordinate (val x: Int, val y: Int) |
src/test/kotlin/day8/Day8.kt
Outdated
| return Forest(lines.map { it.windowed(1, 1) } | ||
| .flatMapIndexed { y: Int, row: List<String> -> | ||
| row.mapIndexed { x, it -> | ||
| Coordinate( |
yuriykulikov
commented
Dec 20, 2022
Collaborator
Author
yuriykulikov
left a comment
There was a problem hiding this comment.
Looking good 👍
| } | ||
| } | ||
|
|
||
| fun pointInExactRadius(point: Point, radius: Int): HashSet<Point> { |
| return render | ||
| } | ||
|
|
||
| override fun equals(other: Any?): Boolean { |
Collaborator
Author
There was a problem hiding this comment.
data classes already have both hashCode and equals
Owner
There was a problem hiding this comment.
Yes, but I wanted to exclude the rendered char from equals. A point which is rendered as x should be equal to a point at the same coords rendered as #.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If you want you can create PRs every day to discuss