path
stringlengths
5
169
owner
stringlengths
2
34
repo_id
int64
1.49M
755M
is_fork
bool
2 classes
languages_distribution
stringlengths
16
1.68k
content
stringlengths
446
72k
issues
float64
0
1.84k
main_language
stringclasses
37 values
forks
int64
0
5.77k
stars
int64
0
46.8k
commit_sha
stringlengths
40
40
size
int64
446
72.6k
name
stringlengths
2
64
license
stringclasses
15 values
src/main/kotlin/me/grison/aoc/y2021/Day04.kt
agrison
315,292,447
false
{"Kotlin": 267552}
package me.grison.aoc.y2021 import me.grison.aoc.* class Day04 : Day(4, 2021) { override fun title() = "Giant Squid" private val suite = inputList.first().allInts() private val boards = inputGroups.tail().map { it.lines().map { it.allInts() } } override fun partOne(): Int { (1..suite.size).f...
0
Kotlin
3
18
ea6899817458f7ee76d4ba24d36d33f8b58ce9e8
1,583
advent-of-code
Creative Commons Zero v1.0 Universal
src/Day21.kt
joy32812
573,132,774
false
{"Kotlin": 62766}
fun main() { fun getAnsMap(opMap: Map<String, String>, humnUnknow: Boolean = false): Map<String, Long?> { val ansMap = mutableMapOf<String, Long?>() fun dfs(key: String): Long? { if (key in ansMap) return ansMap[key] val op = opMap[key]!! val result = if (op[0].isDigit()) { op.toLon...
0
Kotlin
0
0
5e87958ebb415083801b4d03ceb6465f7ae56002
2,383
aoc-2022-in-kotlin
Apache License 2.0
src/Day05.kt
arturkowalczyk300
573,084,149
false
{"Kotlin": 31119}
import java.util.LinkedList import java.util.Queue fun main() { class Move(val howMuch: Int, val from: Int, val to: Int) { override fun toString(): String { return "move ${howMuch} crates from ${from} to ${to}" } } fun parseListOfMoves(input: List<String>): List<Move> { ...
0
Kotlin
0
0
69a51e6f0437f5bc2cdf909919c26276317b396d
4,515
aoc-2022-in-kotlin
Apache License 2.0
src/Day04.kt
remidu
573,452,090
false
{"Kotlin": 22113}
fun main() { fun extend(range: String): List<Int> { val result = ArrayList<Int>() val numbers = range.split('-') for (i in numbers[0].toInt()..numbers[1].toInt()) { result.add(i) } return result } fun part1(input: List<String>): Int { var total =...
0
Kotlin
0
0
ecda4e162ab8f1d46be1ce4b1b9a75bb901bc106
1,284
advent-of-code-2022
Apache License 2.0
src/main/kotlin/me/circuitrcay/euler/challenges/fiftyOneToSeventyFive/probUtils/Prob54Utils.kt
adamint
134,989,381
false
null
package me.circuitrcay.euler.challenges.fiftyOneToSeventyFive.probUtils /** * [value] is 1-10 for numbered cards, 11 for J, 12 for Q, and 13 and 14 for K and A respectively */ data class Card(val value: Int, val suit: Suit) enum class Suit { HEART, SPADE, CLUB, DIAMOND } class Deck(vararg val cards: Card) { v...
0
Kotlin
0
0
cebe96422207000718dbee46dce92fb332118665
6,665
project-euler-kotlin
Apache License 2.0
src/main/kotlin/com/kishor/kotlin/ds/StringsAndArrays.kt
kishorsutar
276,212,164
false
null
package com.kishor.kotlin.ds import kotlin.math.min fun main() { val list = MutableList(10) { Int.MAX_VALUE } Math.min(10, 5) var test: Pair<Int, Int> = Pair(1, 2) println(isAnagram("restful", "furstel")) } class StringsAndArrays { val nums = IntArray(10) { 1 } var list = mutableListOf<S...
0
Kotlin
0
0
6672d7738b035202ece6f148fde05867f6d4d94c
3,141
DS_Algo_Kotlin
MIT License
src/main/aoc2019/Day17.kt
nibarius
154,152,607
false
{"Kotlin": 963896}
package aoc2019 import Direction import Pos import AMap import kotlin.enums.EnumEntries import kotlin.math.min class Day17(input: List<String>) { val parsedInput = input.map { it.toLong() } private fun countIntersections(map: AMap): Int { var sum = 0 for (y in 1 until map.yRange().last) { ...
0
Kotlin
0
6
f2ca41fba7f7ccf4e37a7a9f2283b74e67db9f22
6,247
aoc
MIT License
src/main/kotlin/com/github/ferinagy/adventOfCode/aoc2017/2017-14.kt
ferinagy
432,170,488
false
{"Kotlin": 787586}
package com.github.ferinagy.adventOfCode.aoc2017 import com.github.ferinagy.adventOfCode.Coord2D import com.github.ferinagy.adventOfCode.searchGraph import com.github.ferinagy.adventOfCode.singleStep fun main() { println("Part1:") println(part1(testInput1)) println(part1(input)) println() println...
0
Kotlin
0
1
f4890c25841c78784b308db0c814d88cf2de384b
1,613
advent-of-code
MIT License
cz.wrent.advent/Day7.kt
Wrent
572,992,605
false
{"Kotlin": 206165}
package cz.wrent.advent fun main() { println(partOne(test)) val result = partOne(input) println("7a: $result") println(partTwo(test)) val resultTwo = partTwo(input) println("7b: $resultTwo") } private fun partOne(input: String): Long { val nodes = input.parseTree() return nodes.values.filterIsInstance<Dir>(...
0
Kotlin
0
0
8230fce9a907343f11a2c042ebe0bf204775be3f
17,032
advent-of-code-2022
MIT License
src/main/kotlin/de/tek/adventofcode/y2022/day16/ProboscideaVolcanium.kt
Thumas
576,671,911
false
{"Kotlin": 192328}
package de.tek.adventofcode.y2022.day16 import de.tek.adventofcode.y2022.util.algorithms.permutations import de.tek.adventofcode.y2022.util.algorithms.subsets import de.tek.adventofcode.y2022.util.math.Edge import de.tek.adventofcode.y2022.util.math.Graph import de.tek.adventofcode.y2022.util.readInputLines class Val...
0
Kotlin
0
0
551069a21a45690c80c8d96bce3bb095b5982bf0
10,215
advent-of-code-2022
Apache License 2.0
Kotlin/src/ThreeSum.kt
TonnyL
106,459,115
false
null
/** * Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? * Find all unique triplets in the array which gives the sum of zero. * * Note: The solution set must not contain duplicate triplets. * * For example, given array S = [-1, 0, 1, 2, -1, -4], * * A solution set is: * [ ...
1
Swift
22
189
39f85cdedaaf5b85f7ce842ecef975301fc974cf
1,711
Windary
MIT License
year2020/src/main/kotlin/net/olegg/aoc/year2020/day21/Day21.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2020.day21 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.utils.toPair import net.olegg.aoc.year2020.DayOf2020 /** * See [Year 2020, Day 21](https://adventofcode.com/2020/day/21) */ object Day21 : DayOf2020(21) { override fun first(): Any? { val foods = lines .map { ...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
2,625
adventofcode
MIT License
src/main/kotlin/com/jacobhyphenated/advent2023/day11/Day11.kt
jacobhyphenated
725,928,124
false
{"Kotlin": 121644}
package com.jacobhyphenated.advent2023.day11 import com.jacobhyphenated.advent2023.Day import kotlin.math.absoluteValue import kotlin.math.max import kotlin.math.min /** * Day 11: Cosmic Expansion * * The puzzle input is a representation of observed galaxies in space. * However, all rows with no galaxies and all ...
0
Kotlin
0
0
90d8a95bf35cae5a88e8daf2cfc062a104fe08c1
4,255
advent2023
The Unlicense
src/day02/Day02.kt
iulianpopescu
572,832,973
false
{"Kotlin": 30777}
package day02 import readInput import kotlin.IllegalArgumentException import kotlin.IllegalStateException import kotlin.Int import kotlin.String import kotlin.check import kotlin.to private const val DAY = "02" private const val DAY_TEST = "day${DAY}/Day${DAY}_test" private const val DAY_INPUT = "day${DAY}/Day${DAY}"...
0
Kotlin
0
0
4ff5afb730d8bc074eb57650521a03961f86bc95
2,770
AOC2022
Apache License 2.0
src/Day14.kt
dragere
440,914,403
false
{"Kotlin": 62581}
import kotlin.streams.toList fun main() { fun part1(input: Pair<String, Map<String, String>>): Int { val map = input.second var str = input.first for (round in 1..10) { var nextStr = "" for (i in str.indices) { nextStr += str[i] if ...
0
Kotlin
0
0
3e33ab078f8f5413fa659ec6c169cd2f99d0b374
4,238
advent_of_code21_kotlin
Apache License 2.0
src/Day02/Day02.kt
rooksoto
573,602,435
false
{"Kotlin": 16098}
package Day02 import profile import readInputActual import readInputTest private const val DAY = "Day02" fun main() { fun part1( input: List<String> ): Int = toCharPairs(input) .map(RPS::fromPairOfChars) .sumOf(::evaluateMatchScore) fun part2( input: List<String> ): I...
0
Kotlin
0
1
52093dbf0dc2f5f62f44a57aa3064d9b0b458583
2,980
AoC-2022
Apache License 2.0
src/main/kotlin/github/walkmansit/aoc2020/Day09.kt
walkmansit
317,479,715
false
null
package github.walkmansit.aoc2020 class Day09(val input: List<String>, private val windowSize: Int) : DayAoc<Long, Long> { private class SlidingWindow(val numbers: LongArray, val size: Int) { private var window = 0 until size private val summWeight: MutableMap<Long, Int> = mutableMapOf() ...
0
Kotlin
0
0
9c005ac4513119ebb6527c01b8f56ec8fd01c9ae
2,860
AdventOfCode2020
MIT License
src/main/kotlin/day17_trick_shot/TrickShot.kt
barneyb
425,532,798
false
{"Kotlin": 238776, "Shell": 3825, "Java": 567}
package day17_trick_shot import geom2d.Point import geom2d.Rect import util.countForever import kotlin.math.abs /** * More analysis; no code required. The probe has to go up and then come back * down at the same rate (the `y` velocity changes at a constant rate). Thus, * the target area's bottom y-coordinate is al...
0
Kotlin
0
0
a8d52412772750c5e7d2e2e018f3a82354e8b1c3
3,041
aoc-2021
MIT License
dcp_kotlin/src/main/kotlin/dcp/day265/day265.kt
sraaphorst
182,330,159
false
{"C++": 577416, "Kotlin": 231559, "Python": 132573, "Scala": 50468, "Java": 34742, "CMake": 2332, "C": 315}
package dcp.day265 // day265.kt // By <NAME>, 2019. import kotlin.math.max typealias LOC = Int typealias Bonus = Int typealias LOCWithBonus = Pair<LOC, Bonus> /** * Calculate the bonus based on LOC of your neighbours. * If you have written more LOC than your neighbours, you should receive the minimal amount more b...
0
C++
1
0
5981e97106376186241f0fad81ee0e3a9b0270b5
2,819
daily-coding-problem
MIT License
src/main/kotlin/dev/kosmx/aoc23/differential/OhMoarMath.kt
KosmX
726,056,762
false
{"Kotlin": 32011}
package dev.kosmx.aoc23.differential import kotlin.math.* // It's beautiful how mathematical functions can be written down in functional programming :D fun distance(totalTime: Int, buttonPress: Int): Int = (totalTime - buttonPress) * buttonPress // travel time times speed // -(buttonPress^2) + totalTime*buttonPress...
0
Kotlin
0
0
ad01ab8e9b8782d15928a7475bbbc5f69b2416c2
1,660
advent-of-code23
MIT License
src/Day12.kt
sabercon
648,989,596
false
null
import kotlin.math.absoluteValue fun main() { val directions = listOf('E', 'N', 'W', 'S') data class Position1(val east: Int = 0, val north: Int = 0, val direction: Char = 'E') { fun move(action: Char, value: Int): Position1 = when (action) { 'E' -> copy(east = east + value) 'N...
0
Kotlin
0
0
81b51f3779940dde46f3811b4d8a32a5bb4534c8
2,095
advent-of-code-2020
MIT License
src/main/kotlin/Day04.kt
N-Silbernagel
573,145,327
false
{"Kotlin": 118156}
fun main() { fun part1(input: List<String>): Int { var fullOverlaps = 0 for (pairLine in input) { val pairs = pairLine.split(',') val firstElf = pairs[0] val secondElf = pairs[1] val firstElfRange = firstElf.split('-') val firstElfStart =...
0
Kotlin
0
0
b0d61ba950a4278a69ac1751d33bdc1263233d81
2,160
advent-of-code-2022
Apache License 2.0
src/main/kotlin/Day16.kt
brigham
573,127,412
false
{"Kotlin": 59675}
val pattern16 = Regex("""Valve (.*) has flow rate=(\d+); tunnels? leads? to valves? (.*)""") data class Node16(val name: String, val flowRate: Int, val edges: List<String>) data class State16(val location: String, val timeLeft: Int, val open: Set<String>, val pressureReleased: Int) interface PairGuy { fun <E> ge...
0
Kotlin
0
0
b87ffc772e5bd9fd721d552913cf79c575062f19
4,946
advent-of-code-2022
Apache License 2.0
src/main/kotlin/dev/bogwalk/batch6/Problem65.kt
bog-walk
381,459,475
false
null
package dev.bogwalk.batch6 /** * Problem 65: Convergents Of E * * https://projecteuler.net/problem=65 * * Goal: Find the sum of the digits in the numerator of the Nth convergent of the continued * fraction of Euler's number, the mathematical constant e. * * Constraints: 1 <= N <= 3e4 * * As seen in Problems ...
0
Kotlin
0
0
62b33367e3d1e15f7ea872d151c3512f8c606ce7
1,779
project-euler-kotlin
MIT License
src/day08.kt
skuhtic
572,645,300
false
{"Kotlin": 36109}
import kotlin.math.max fun main() { day08.execute(forceBothParts = true) } val day08 = object : Day<Int>(8, 21, 8) { override val testInput: InputData get() = """ 30373 25512 65332 33549 35390 """.trimIndent().lines() override fu...
0
Kotlin
0
0
8de2933df90259cf53c9cb190624d1fb18566868
2,443
aoc-2022
Apache License 2.0
src/main/year_2017/day11/day11.kt
rolf-rosenbaum
572,864,107
false
{"Kotlin": 80772}
package year_2017.day11 import kotlin.math.absoluteValue import readInput fun part1(input: List<String>): Int { val directions = input.first().split(",") val origin = HexPoint(0, 0, 0) val endPoint = directions.fold(origin) { point, dir -> point.step(dir) } return origin.distance(endPoin...
0
Kotlin
0
2
59cd4265646e1a011d2a1b744c7b8b2afe482265
1,407
aoc-2022
Apache License 2.0
src/main/kotlin/aoc/Day05.kt
fluxxion82
573,716,300
false
{"Kotlin": 39632}
package aoc import java.io.File import java.util.Stack fun main() { val testInput = File("src/Day05_test.txt").readText() val input = File("src/Day05.txt").readText() fun part1(input: String): String { val splitInput = input.split("\n") val crates = splitInput .takeWhile { it...
0
Kotlin
0
0
3920d2c3adfa83c1549a9137ffea477a9734a467
3,266
advent-of-code-kotlin-22
Apache License 2.0
src/day09/Day09.kt
Puju2496
576,611,911
false
{"Kotlin": 46156}
package day09 import readInput import java.util.* import kotlin.math.abs fun main() { // test if implementation meets criteria from the description, like: val input = readInput("src/day09", "Day09") println("Part1") part1(input) println("Part2") part2(input) } private fun part1(inputs: List<S...
0
Kotlin
0
0
e04f89c67f6170441651a1fe2bd1f2448a2cf64e
4,550
advent-of-code-2022
Apache License 2.0
src/main/kotlin/euclidea/Coincidences.kt
jedwidz
589,137,278
false
null
package euclidea typealias Segment = Two<Point> data class SegmentWithLine(val segment: Segment, val line: Element.Line?) sealed class SegmentOrCircle { data class Segment(val segment: euclidea.Segment) : SegmentOrCircle() data class Circle(val circle: Element.Circle) : SegmentOrCircle() } data class Coinci...
0
Kotlin
0
1
70f7a397bd6abd0dc0d6c295ba9625e6135b2167
5,682
euclidea-solver
MIT License
src/Day03.kt
rdbatch02
575,174,840
false
{"Kotlin": 18925}
fun main() { val items = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" // I wonder if there's a slick way to do this, will check later fun pointsOfItem(item: String): Int = items.indexOf(item) + 1 fun part1(input: List<String>): Int { var totalPriority = 0 input.forEach { ...
0
Kotlin
0
1
330a112806536910bafe6b7083aa5de50165f017
1,402
advent-of-code-kt-22
Apache License 2.0
src/main/kotlin/aoc2022/Day09.kt
j4velin
572,870,735
false
{"Kotlin": 285016, "Python": 1446}
package aoc2022 import Point import readInput import kotlin.math.sign fun main() { /** * Moves a rope along the given movements * * @param input the movement input * @param knotSize the number of knots in this rope * @return the unique positions the last knot visited during the rope move...
0
Kotlin
0
0
f67b4d11ef6a02cba5b206aba340df1e9631b42b
2,192
adventOfCode
Apache License 2.0
2021/kotlin/src/main/kotlin/nl/sanderp/aoc/aoc2021/day19/Day19.kt
sanderploegsma
224,286,922
false
{"C#": 233770, "Kotlin": 126791, "F#": 110333, "Go": 70654, "Python": 64250, "Scala": 11381, "Swift": 5153, "Elixir": 2770, "Jinja": 1263, "Ruby": 1171}
package nl.sanderp.aoc.aoc2021.day19 import nl.sanderp.aoc.common.* import java.util.* fun main() { val input = readResource("Day19.txt") .split("\n\n") .map { parse(it) } .mapIndexed { i, b -> Scanner(i, Point3D(0, 0, 0), b) } val scanners = locateScanners(input) val beacons = sc...
0
C#
0
6
8e96dff21c23f08dcf665c68e9f3e60db821c1e5
2,896
advent-of-code
MIT License
src/main/kotlin/day11/Day11.kt
dustinconrad
572,737,903
false
{"Kotlin": 100547}
package day11 import byEmptyLines import readResourceAsBufferedReader import java.math.BigInteger import java.util.function.BinaryOperator import java.util.function.UnaryOperator fun main() { println("part 1: ${part1(readResourceAsBufferedReader("11_1.txt").readLines())}") println("part 2: ${part2(readResourc...
0
Kotlin
0
0
1dae6d2790d7605ac3643356b207b36a34ad38be
3,937
aoc-2022
Apache License 2.0
src/main/kotlin/g1301_1400/s1301_number_of_paths_with_max_score/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g1301_1400.s1301_number_of_paths_with_max_score // #Hard #Array #Dynamic_Programming #Matrix // #2023_06_05_Time_178_ms_(100.00%)_Space_37.8_MB_(100.00%) class Solution { fun pathsWithMaxScore(board: List<String>): IntArray { val rows = board.size val columns = board[0].length val ...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,824
LeetCode-in-Kotlin
MIT License
src/Day05.kt
aaronbush
571,776,335
false
{"Kotlin": 34359}
fun main() { data class MoveInstruction(val howMany: Int, val fromWhere: Int, val toWhere: Int) fun String.toMoveInstruction(): MoveInstruction { val (howMany, from, to) = this.split(" ").chunked(2).map { it.last().toInt() } return MoveInstruction(howMany, from, to) } fun parseStacks(...
0
Kotlin
0
0
d76106244dc7894967cb8ded52387bc4fcadbcde
2,413
aoc-2022-kotlin
Apache License 2.0
src/Day07/Day07.kt
kritanta
574,453,685
false
{"Kotlin": 8568}
import java.util.LinkedList import java.util.zip.DataFormatException enum class Command { ls, cd } data class FileTree(val parent:FileTree?, val name: String, var size:Int = 0, val children:MutableList<FileTree> = mutableListOf()) fun main() { fun buildFileTree(input: List<String>): MutableList<FileTree> {...
0
Kotlin
0
0
834259cf076d0bfaf3d2e06d1bc1d5df13cffd6c
4,537
AOC-2022-Kotlin
Apache License 2.0
src/Day11.kt
JIghtuse
572,807,913
false
{"Kotlin": 46764}
import java.lang.IllegalStateException typealias WorryLevel = Long typealias MonkeyIndex = Int fun reduceOnRelief(level: WorryLevel): WorryLevel = level / 3 fun toOperation(s: String, modulo: Long): (WorryLevel) -> WorryLevel { val parts = s .substringAfter(" = ") .split(" ") val op = parts[...
0
Kotlin
0
0
8f33c74e14f30d476267ab3b046b5788a91c642b
4,225
aoc-2022-in-kotlin
Apache License 2.0
src/day03/Day03.kt
cmargonis
573,161,233
false
{"Kotlin": 15730}
package day03 import readInput private const val DIRECTORY = "./day03" fun main() { fun toCommons(it: String): Set<Char> { val inter = it.chunked(it.length / 2) return inter.first().toSet().intersect(inter[1].toSet()) } fun toPriority(c: Char): Int { val lowerCaseRange = 'a'..'z'...
0
Kotlin
0
0
bd243c61bf8aae81daf9e50b2117450c4f39e18c
1,120
kotlin-advent-2022
Apache License 2.0
2015/Day03/src/main/kotlin/Main.kt
mcrispim
658,165,735
false
null
import java.io.File typealias Position = Pair<Int, Int> fun main() { fun part1(input: List<String>): Int { var noelPosition = Position(0, 0) val houses = mutableSetOf(noelPosition) for (direction in input[0]) { when (direction) { '^' -> noelPosition = Position(...
0
Kotlin
0
0
2f4be35e78a8a56fd1e078858f4965886dfcd7fd
2,379
AdventOfCode
MIT License
src/PathUtils.kt
iProdigy
572,297,795
false
{"Kotlin": 33616}
import java.util.PriorityQueue import kotlin.collections.ArrayDeque fun <T> breadthFirstSearch(start: T, end: T, edges: Map<T, Collection<T>>) = breadthFirstSearch(start, { it == end }, { edges[it] }) fun <T> breadthFirstSearch(start: T, end: (T) -> Boolean, edges: (T) -> Collection<T>?): List<T>? { val queue = A...
0
Kotlin
0
1
784fc926735fc01f4cf18d2ec105956c50a0d663
2,109
advent-of-code-2022
Apache License 2.0
src/Day18.kt
ech0matrix
572,692,409
false
{"Kotlin": 116274}
fun main() { fun parsePoints(input: List<String>): Set<Point3D> { return input.map { val parts = it.split(',').map { n -> n.toInt() } Point3D(parts[0], parts[1], parts[2]) }.toSet() } fun draw(points: Set<Point3D>) { val minX = points.minOf { it.x } v...
0
Kotlin
0
0
50885e12813002be09fb6186ecdaa3cc83b6a5ea
5,121
aoc2022
Apache License 2.0
src/Day02.kt
askeron
572,955,924
false
{"Kotlin": 24616}
class Day02 : Day<Int>(15, 12, 13565, 12424) { fun String.singleChar(): Char { assert(this.length == 1) { "not a single char" } return toCharArray()[0] } override fun part1(input: List<String>): Int { return input .asSequence() .map { it.split(" ").map { Shap...
0
Kotlin
0
1
6c7cf9cf12404b8451745c1e5b2f1827264dc3b8
1,717
advent-of-code-kotlin-2022
Apache License 2.0
2021/src/main/kotlin/de/skyrising/aoc2021/day17/solution.kt
skyrising
317,830,992
false
{"Kotlin": 411565}
package de.skyrising.aoc2021.day17 import de.skyrising.aoc.* val test = TestInput("target area: x=20..30, y=-10..-5") @PuzzleName("Trick Shot") fun PuzzleInput.part1v0(): Any { val target = parseInput(this) val x2 = target.first.last val y1 = target.second.first var maxY = 0 for (x in 1..x2) { ...
0
Kotlin
0
0
19599c1204f6994226d31bce27d8f01440322f39
2,432
aoc
MIT License
src/day11/Day11.kt
felldo
572,762,654
false
{"Kotlin": 76496}
class Monkey { var items = mutableListOf<Long>() var trueMonkey = 0 var falseMonkey = 0 var isMultiply = false var opValue = 0L var opOld = false var testValue = 0L var numThrows = 0L fun operation (item: Long): Long { val opVal = if (opOld) item else opValue return ...
0
Kotlin
0
0
5966e1a1f385c77958de383f61209ff67ffaf6bf
3,149
advent-of-code-kotlin-2022
Apache License 2.0
src/Day10.kt
iartemiev
573,038,071
false
{"Kotlin": 21075}
import kotlin.math.floor enum class Instruction(val cycles: Int) { noop(1), addx(2), } fun drawCRT(): (cycle: Int, sprite: Int) -> Unit { val grid = MutableList(6) { MutableList(40) {"."} } return fun (cycle: Int, sprite: Int) { val row = (cycle - 1).floorDiv(40) val pixel = (cycle - 1) % 40 if ...
0
Kotlin
0
0
8d2b7a974c2736903a9def65282be91fbb104ffd
2,117
advent-of-code
Apache License 2.0
src/Day14.kt
frungl
573,598,286
false
{"Kotlin": 86423}
import kotlin.math.max import kotlin.math.sign typealias Coord = Pair<Int, Int> private operator fun Coord.plus(other: Coord): Coord { return first + other.first to second + other.second } fun main() { val tryGo = listOf(0 to 1, -1 to 1, 1 to 1) fun tryAdd(now: Coord, used: MutableSet<Coord>): Coord { ...
0
Kotlin
0
0
d4cecfd5ee13de95f143407735e00c02baac7d5c
2,378
aoc2022
Apache License 2.0
src/Day08.kt
ds411
573,543,582
false
{"Kotlin": 16415}
fun main() { fun part1(input: List<String>): Int { val cols = input[0].length val rows = input.size val grid = input.map { it.toCharArray().map { it.toInt() } } val visibleTrees = hashSetOf<Tree>() var max = -1; // From top (0 until cols).forEach { col -> ...
0
Kotlin
0
0
6f60b8e23ee80b46e7e1262723960af14670d482
4,280
advent-of-code-2022
Apache License 2.0
src/day09/Day09Answer1.kt
IThinkIGottaGo
572,833,474
false
{"Kotlin": 72162}
package day09 import readInput import java.lang.Math.abs /** * Answers from [Advent of Code 2022 Day 9 | Kotlin](https://youtu.be/ShU9dNUa_3g) */ data class Move(val dx: Int, val dy: Int) enum class Direction(val move: Move) { R(Move(1, 0)), L(Move(-1, 0)), U(Move(0, 1)), D(Move(0, -1)), } data cl...
0
Kotlin
0
0
967812138a7ee110a63e1950cae9a799166a6ba8
1,987
advent-of-code-2022
Apache License 2.0
src/pt/davidafsilva/aoc/d3/ManhattanDistance.kt
davidafsilva
83,922,983
false
{"Java": 10029, "Kotlin": 9144}
package pt.davidafsilva.aoc.d3 import pt.davidafsilva.aoc.loadInput import java.awt.geom.Line2D import java.io.BufferedReader import kotlin.LazyThreadSafetyMode.NONE import kotlin.math.pow import kotlin.math.sqrt private object ManhattanDistance { private data class Point(val x: Int, val y: Int) { compan...
0
Java
0
0
336baee33e968917b536e92244b289f8d1580e15
3,088
exercises
MIT License
2022/src/main/kotlin/day18.kt
madisp
434,510,913
false
{"Kotlin": 388138}
import utils.MutableIntSpace import utils.Parser import utils.Solution import utils.Point3i import utils.Vec4i import utils.mapItems fun main() { Day18.run() } object Day18 : Solution<Set<Vec4i>>() { override val name = "day18" override val parser = Parser.lines.mapItems { val (x, y, z) = it.split(",", limi...
0
Kotlin
0
1
3f106415eeded3abd0fb60bed64fb77b4ab87d76
1,231
aoc_kotlin
MIT License
kotlin/src/com/s13g/aoc/aoc2021/Day21.kt
shaeberling
50,704,971
false
{"Kotlin": 300158, "Go": 140763, "Java": 107355, "Rust": 2314, "Starlark": 245}
package com.s13g.aoc.aoc2021 import com.s13g.aoc.Result import com.s13g.aoc.Solver import kotlin.math.max import kotlin.math.min /** * --- Day 21: <NAME> --- * https://adventofcode.com/2021/day/21 */ class Day21 : Solver { override fun solve(lines: List<String>): Result { var stateA = GameState(lines[0].subs...
0
Kotlin
1
2
7e5806f288e87d26cd22eca44e5c695faf62a0d7
2,466
euler
Apache License 2.0
advent-of-code2015/src/main/kotlin/day20/Advent20.kt
REDNBLACK
128,669,137
false
null
package day20 import java.util.stream.IntStream /** --- Day 20: Infinite Elves and Infinite Houses --- To keep the Elves busy, Santa has them deliver some presents by hand, door-to-door. He sends them down a street with infinite houses numbered sequentially: 1, 2, 3, 4, 5, and so on. Each Elf is assigned a number, ...
0
Kotlin
0
0
e282d1f0fd0b973e4b701c8c2af1dbf4f4a149c7
2,810
courses
MIT License
src/main/kotlin/tr/emreone/adventofcode/Extensions.kt
EmRe-One
568,569,073
false
{"Kotlin": 166986}
package tr.emreone.adventofcode import tr.emreone.kotlin_utils.math.Point2D import kotlin.math.abs fun String.readTextGroups(delimitter: String = "\n\n"): List<String> { return this.split(delimitter) } fun Point2D.manhattanDistanceTo(other: Point2D): Long { return abs(x - other.x) + abs(y - other.y) } fun P...
0
Kotlin
0
0
a951d2660145d3bf52db5cd6d6a07998dbfcb316
1,690
advent-of-code-2022
Apache License 2.0
src/main/kotlin/tr/emreone/adventofcode/days/Day18.kt
EmRe-One
568,569,073
false
{"Kotlin": 166986}
package tr.emreone.adventofcode.days import tr.emreone.kotlin_utils.Logger.logger import tr.emreone.kotlin_utils.math.Point3D import java.util.* import kotlin.math.min import kotlin.math.max object Day18 { data class Cube(val center: Point3D) { fun possibleDirectNeighbors(): List<Cube> { ret...
0
Kotlin
0
0
a951d2660145d3bf52db5cd6d6a07998dbfcb316
2,784
advent-of-code-2022
Apache License 2.0
src/questions/FindAllAnagrams.kt
realpacific
234,499,820
false
null
package questions import _utils.UseCommentAsDocumentation import utils.shouldBe /** * Given two strings s and p, return an array of all the start indices of p's anagrams in s. * You may return the answer in any order. * * [Source](https://leetcode.com/problems/find-all-anagrams-in-a-string/) */ @UseCommentAsDocu...
4
Kotlin
5
93
22eef528ef1bea9b9831178b64ff2f5b1f61a51f
2,625
algorithms
MIT License
src/day7/Day7.kt
calvin-laurenson
572,736,307
false
{"Kotlin": 16407}
package day7 import readInput import java.lang.Exception import kotlin.math.absoluteValue fun getAllFolders(folder: Item.Folder): List<Item.Folder> { val folders = mutableListOf<Item.Folder>(folder) for (item in folder.items) { if (item is Item.Folder) { val subFolders = getAllFolders(item...
0
Kotlin
0
0
155cfe358908bbe2a554306d44d031707900e15a
5,195
aoc2022
Apache License 2.0
Problems/Algorithms/1631. Path with Minimum Effort/PathMinEffort.kt
xuedong
189,745,542
false
{"Kotlin": 332182, "Java": 294218, "Python": 237866, "C++": 97190, "Rust": 82753, "Go": 37320, "JavaScript": 12030, "Ruby": 3367, "C": 3121, "C#": 3117, "Swift": 2876, "Scala": 2868, "TypeScript": 2134, "Shell": 149, "Elixir": 130, "Racket": 107, "Erlang": 96, "Dart": 65}
class Solution { fun minimumEffortPath(heights: Array<IntArray>): Int { val n = heights.size val m = heights[0].size val deltas = arrayOf(intArrayOf(0, 1), intArrayOf(0, -1), intArrayOf(1, 0), intArrayOf(-1, 0)) val visited = Array(n) { BooleanArray(m) { false } } ...
0
Kotlin
0
1
5e919965b43917eeee15e4bff12a0b6bea4fd0e7
1,659
leet-code
MIT License
src/main/aoc2020/Day19.kt
nibarius
154,152,607
false
{"Kotlin": 963896}
package aoc2020 class Day19(input: List<String>) { // options is a list of options available data class Rule(val options: List<List<String>>) private val messages: List<String> = input.last().split("\n") private val rules: Map<String, Rule> // Example input: // 0: 4 1 5 // 1: 2 3 | 3 2 ...
0
Kotlin
0
6
f2ca41fba7f7ccf4e37a7a9f2283b74e67db9f22
4,452
aoc
MIT License
src/main/kotlin/ru/timakden/aoc/year2022/Day12.kt
timakden
76,895,831
false
{"Kotlin": 321649}
package ru.timakden.aoc.year2022 import ru.timakden.aoc.util.Point import ru.timakden.aoc.util.measure import ru.timakden.aoc.util.readInput import java.util.* import kotlin.properties.Delegates /** * [Day 12: Hill Climbing Algorithm](https://adventofcode.com/2022/day/12). */ object Day12 { @JvmStatic fun m...
0
Kotlin
0
3
acc4dceb69350c04f6ae42fc50315745f728cce1
4,821
advent-of-code
MIT License
neuro/src/main/java/com/bukalapak/neuro/Nucleus.kt
bukalapak
167,192,746
false
null
package com.bukalapak.neuro import java.util.Locale sealed class Nucleus(val id: String) : Comparable<Nucleus> { // pattern to expression, sort descending from the longest pattern private val schemePatterns: List<Pair<Regex, String>> by lazy { schemes.map { val lowerCase = it.toLowerCase(...
0
Kotlin
6
24
b6707ad6f682bbd929febdd39054f10c57b1b12d
5,323
neuro
Apache License 2.0
src/main/kotlin/d9_SmokeBasin/SmokeBasin.kt
aormsby
425,644,961
false
{"Kotlin": 68415}
package d9_SmokeBasin import util.Coord import util.Input import util.Output val caveTopo = Input.parseLines(filename = "/input/d9_caves_topo_map.txt").map { Input.parseToListOf<Int>(rawData = it) } // topo map bounds and helper val numCol = caveTopo[0].size val numRow = caveTopo.size val adjInd = Pair(-1, 1) /...
0
Kotlin
1
1
193d7b47085c3e84a1f24b11177206e82110bfad
3,081
advent-of-code-2021
MIT License
src/main/kotlin/com/github/davio/aoc/y2022/Day5.kt
Davio
317,510,947
false
{"Kotlin": 405939}
package com.github.davio.aoc.y2022 import com.github.davio.aoc.general.Day import com.github.davio.aoc.general.getInputAsSequence import com.github.davio.aoc.general.split import kotlin.system.measureTimeMillis fun main() { println(Day5.getResultPart1()) measureTimeMillis { println(Day5.getResultPart2...
1
Kotlin
0
0
4fafd2b0a88f2f54aa478570301ed55f9649d8f3
2,555
advent-of-code
MIT License
src/main/kotlin/com/github/dangerground/aoc2020/Day5.kt
dangerground
317,439,198
false
null
package com.github.dangerground.aoc2020 import com.github.dangerground.aoc2020.util.DayInput import kotlin.math.pow class Day5(input: List<String>) { val seats = input.map { Seat(it) } fun highestSeadId(): Int { return seats.maxOf { it.getId() } } fun mySeatId(): Int { val seatIds = ...
0
Kotlin
0
0
c3667a2a8126d903d09176848b0e1d511d90fa79
1,434
adventofcode-2020
MIT License
src/main/kotlin/_2023/Day05.kt
novikmisha
572,840,526
false
{"Kotlin": 145780}
package _2023 import Day import InputReader import rangeIntersect data class RangeToValue( val range: LongRange, val value: Long ) class Day05 : Day(2023, 5) { override val firstTestAnswer: Long = 35L override val secondTestAnswer = 46L override fun first(input: InputReader): Long { va...
0
Kotlin
0
0
0c78596d46f3a8bf977bf356019ea9940ee04c88
3,345
advent-of-code
Apache License 2.0
advent-of-code2015/src/main/kotlin/day15/Advent15.kt
REDNBLACK
128,669,137
false
null
package day15 import mul import parseInput import splitToLines /** --- Day 15: Science for Hungry People --- Today, you set out on the task of perfecting your milk-dunking cookie recipe. All you have to do is find the right balance of ingredients. Your recipe leaves room for exactly 100 teaspoons of ingredients. Yo...
0
Kotlin
0
0
e282d1f0fd0b973e4b701c8c2af1dbf4f4a149c7
5,143
courses
MIT License
src/main/kotlin/aoc2023/Day17.kt
lukellmann
574,273,843
false
{"Kotlin": 175166}
package aoc2023 import AoCDay import aoc2023.Day17.Dir.* import util.Vec2 import util.plus import java.util.* // https://adventofcode.com/2023/day/17 object Day17 : AoCDay<Int>( title = "Clumsy Crucible", part1ExampleAnswer = 102, part1Answer = 953, part2ExampleAnswer = 94, part2Answer = 1180, ) {...
0
Kotlin
0
1
344c3d97896575393022c17e216afe86685a9344
2,482
advent-of-code-kotlin
MIT License
src/main/kotlin/kr/co/programmers/P159993.kt
antop-dev
229,558,170
false
{"Kotlin": 695315, "Java": 213000}
package kr.co.programmers import java.util.* // https://github.com/antop-dev/algorithm/issues/497 class P159993 { fun solution(maps: Array<String>): Int { // 시작 지점, 레버, 출구 위치를 찾는다 val pos = IntArray(6) for (i in maps.indices) { for (j in maps[i].indices) { when ...
1
Kotlin
0
0
9a3e762af93b078a2abd0d97543123a06e327164
2,666
algorithm
MIT License
2021/kotlin/src/main/kotlin/com/codelicia/advent2021/Day03.kt
codelicia
627,407,402
false
{"Kotlin": 49578, "PHP": 554, "Makefile": 293}
package com.codelicia.advent2021 import java.util.SortedMap class Day03(private val input: List<String>) { private val bitLength = input.first().length private fun List<Int>.toInt() = this.joinToString("").toInt(2) private fun List<Int>.gamma() = this.toInt() private fun List<Int>.epsilon(...
2
Kotlin
0
0
df0cfd5c559d9726663412c0dec52dbfd5fa54b0
2,211
adventofcode
MIT License
2022/Day19.kt
amelentev
573,120,350
false
{"Kotlin": 87839}
fun main() { data class Blueprint( val id: Int, val oreRobotCostOre: Int, val clayRobotCostOre: Int, val obsidianRobotCost: Pair<Int, Int>, val geodeRobotCost: Pair<Int, Int>, ) val blueprints = readInput("Day19").mapIndexed { index, line -> val parts = line.s...
0
Kotlin
0
0
a137d895472379f0f8cdea136f62c106e28747d5
4,786
advent-of-code-kotlin
Apache License 2.0
src/day05/Day05.kt
iulianpopescu
572,832,973
false
{"Kotlin": 30777}
package day05 import readInput private const val DAY = "05" private const val DAY_TEST = "day${DAY}/Day${DAY}_test" private const val DAY_INPUT = "day${DAY}/Day${DAY}" fun main() { fun parseInput(input: List<String>): Pair<List<Stack>, List<Move>> { val numberOfStacks = input.first().length / 4 + 1 ...
0
Kotlin
0
0
4ff5afb730d8bc074eb57650521a03961f86bc95
2,465
AOC2022
Apache License 2.0
src/Day02.kt
acrab
573,191,416
false
{"Kotlin": 52968}
import Opponent.Companion.toOpponent import Player.Companion.toPlayer import Result.Companion.toResult import com.google.common.truth.Truth.assertThat enum class Opponent(val key: String) { Rock("A"), Paper("B"), Scissors("C"); companion object { fun String.toOpponent() = values().first { it.k...
0
Kotlin
0
0
0be1409ceea72963f596e702327c5a875aca305c
3,095
aoc-2022
Apache License 2.0
src/day13/b/day13b.kt
pghj
577,868,985
false
{"Kotlin": 94937}
package day13.b import readInputLines import shouldBe fun main() { val msg = readInput() val div0 = Message(listOf(Message(2))) val div1 = Message(listOf(Message(6))) msg.add(div0) msg.add(div1) msg.sort() val i0 = msg.indexOfFirst { it === div0 } + 1 val i1 = msg.indexOfFirst { it ==...
0
Kotlin
0
0
4b6911ee7dfc7c731610a0514d664143525b0954
2,141
advent-of-code-2022
Apache License 2.0
src/aoc2023/Day18.kt
dayanruben
433,250,590
false
{"Kotlin": 79134}
package aoc2023 import checkValue import readInput import kotlin.math.abs fun main() { val (year, day) = "2023" to "Day18" fun parsePlan(line: String, withHex: Boolean): Pair<Pair<Int, Int>, Long> { val dir: Int val distance: Long if (withHex) { val (_, _, hexStr) = line.s...
1
Kotlin
2
30
df1f04b90e81fbb9078a30f528d52295689f7de7
2,723
aoc-kotlin
Apache License 2.0
src/main/kotlin/dev/bogwalk/batch7/Problem73.kt
bog-walk
381,459,475
false
null
package dev.bogwalk.batch7 import dev.bogwalk.util.maths.primeNumbers /** * Problem 73: Counting Fractions In A Range * * https://projecteuler.net/problem=73 * * Goal: Count the elements of a sorted set of reduced proper fractions of order D (their * denominator <= D) that lie between 1/A+1 and 1/A (both exclus...
0
Kotlin
0
0
62b33367e3d1e15f7ea872d151c3512f8c606ce7
6,352
project-euler-kotlin
MIT License
src/Day07.kt
gojoel
573,543,233
false
{"Kotlin": 28426}
import java.util.* import kotlin.collections.ArrayList import kotlin.collections.HashMap fun main() { val input = readInput("07") // val input = readInput("07_test") data class File(val name: String, val size: Int) fun parseDirFiles(input: List<String>) : HashMap<String, ArrayList<File>> { va...
0
Kotlin
0
0
0690030de456dad6dcfdcd9d6d2bd9300cc23d4a
2,236
aoc-kotlin-22
Apache License 2.0
src/Day01.kt
cisimon7
573,872,773
false
{"Kotlin": 41406}
fun main() { fun part1(elves: List<List<Int>>): Pair<Int, Long> { val maxElf = elves.maxBy { it.sum() } val idx = elves.indexOf(maxElf) + 1 return idx to maxElf.sum().toLong() } fun part2(elves: List<List<Int>>): Int { return elves.map { it.sum() }.sortedDescending().take(3)...
0
Kotlin
0
0
29f9cb46955c0f371908996cc729742dc0387017
897
aoc-2022
Apache License 2.0
src/main/kotlin/day08/Day08.kt
dustinconrad
572,737,903
false
{"Kotlin": 100547}
package day08 import geometry.Coord import geometry.down import geometry.left import geometry.right import geometry.up import readResourceAsBufferedReader fun main() { println("part 1: ${part1(readResourceAsBufferedReader("8_1.txt").readLines())}") println("part 2: ${part2(readResourceAsBufferedReader("8_1.tx...
0
Kotlin
0
0
1dae6d2790d7605ac3643356b207b36a34ad38be
3,290
aoc-2022
Apache License 2.0
src/main/kotlin/Day05.kt
nmx
572,850,616
false
{"Kotlin": 18806}
fun main(args: Array<String>) { fun parseStacks(input: List<String>): Pair<List<MutableList<Char>>, List<String>> { val stackLabels = input.find { s -> s.startsWith(" 1") }!! val numStacks = stackLabels.split(" ").last { s -> !s.isEmpty() }.toInt() val stacks = mutableListOf<MutableList<Cha...
0
Kotlin
0
0
33da2136649d08c32728fa7583ecb82cb1a39049
1,993
aoc2022
MIT License
src/Day08.kt
davidkna
572,439,882
false
{"Kotlin": 79526}
import kotlin.math.max fun main() { // Convert to digits fun parseInput(input: List<String>): MutableList<MutableList<Int>> { return input .map { it .map { n -> n.toString().toInt() } .toMutableList() }.toMutableList() ...
0
Kotlin
0
0
ccd666cc12312537fec6e0c7ca904f5d9ebf75a3
6,960
aoc-2022
Apache License 2.0
src/day4/Solution.kt
Zlate87
572,858,682
false
{"Kotlin": 12960}
package day4 import readInput fun main() { fun String.toSections() = this .split("-") .map { it.toInt() } fun List<Int>.toSectionSet(): Set<Int> { val set = HashSet<Int>() for (i in this[0]..this[1]) { set.add(i) } return set } fun List<St...
0
Kotlin
0
0
57acf4ede18b72df129ea932258ad2d0e2f1b6c3
1,282
advent-of-code-2022
Apache License 2.0
solutions/aockt/y2015/Y2015D09.kt
Jadarma
624,153,848
false
{"Kotlin": 435090}
package aockt.y2015 import aockt.util.generatePermutations import io.github.jadarma.aockt.core.Solution object Y2015D09 : Solution { private val inputRegex = Regex("""^(\w+) to (\w+) = (\d+)$""") /** Parses a single line of input and returns a triple containing two locations and the distance between them. *...
0
Kotlin
0
3
19773317d665dcb29c84e44fa1b35a6f6122a5fa
1,725
advent-of-code-kotlin-solutions
The Unlicense
src/day05/Day05.kt
sanyarajan
572,663,282
false
{"Kotlin": 24016}
package day05 import readInput import kotlin.math.ceil fun main() { val instructionsRegex = Regex("move ([0-9]+) from ([0-9]+) to ([0-9]+)") fun parseInput(input: List<String>): Pair<List<ArrayDeque<Char>>, List<String>> { val numStacks = ceil(input[0].length / 4.0).toInt() // list of lengt...
0
Kotlin
0
0
e23413357b13b68ed80f903d659961843f2a1973
3,029
Kotlin-AOC-2022
Apache License 2.0
src/Day13.kt
armandmgt
573,595,523
false
{"Kotlin": 47774}
data class PacketList(val items: List<Either<Int, PacketList>>) : Comparable<PacketList> { override fun toString(): String { return buildString { append("[") append(items.joinToString(", ") { when (it) { is Either.Left<Int, PacketList> -> it.left.t...
0
Kotlin
0
1
0d63a5974dd65a88e99a70e04243512a8f286145
4,284
advent_of_code_2022
Apache License 2.0
src/main/kotlin/com/ikueb/advent18/Day12.kt
h-j-k
159,901,179
false
null
package com.ikueb.advent18 object Day12 { fun getSumOfPlantedPots(input: List<String>) = process(input, (1..20).asSequence(), 0).toInt() fun getSumOfPlantedPotsAt(input: List<String>, target: Long) = process(input = input, target = target) private fun process(input: List<String>,...
0
Kotlin
0
0
f1d5c58777968e37e81e61a8ed972dc24b30ac76
1,876
advent18
Apache License 2.0
src/main/kotlin/de/consuli/aoc/year2022/days/Day07.kt
ulischulte
572,773,554
false
{"Kotlin": 40404}
package de.consuli.aoc.year2022.days import de.consuli.aoc.common.Day class Day07 : Day(7, 2022) { override fun partOne(testInput: Boolean): Any { this.init() parseDirectories(testInput) return directories.map { it.totalSize }.filter { it <= 100000 }.sum() } override fun partTwo(...
0
Kotlin
0
2
21e92b96b7912ad35ecb2a5f2890582674a0dd6a
3,389
advent-of-code
Apache License 2.0
src/Day09.kt
gojoel
573,543,233
false
{"Kotlin": 28426}
import java.lang.Integer.max import kotlin.math.abs import kotlin.math.min enum class StepDirection { U, D, L, R } fun main() { val input = readInput("09") // val input = readInput("09_test") data class Move(val direction: StepDirection, val steps: Int) fun retrieveMoves(input: List<String>): List<Mo...
0
Kotlin
0
0
0690030de456dad6dcfdcd9d6d2bd9300cc23d4a
3,528
aoc-kotlin-22
Apache License 2.0
src/Day07.kt
marosseleng
573,498,695
false
{"Kotlin": 32754}
fun main() { fun part1(input: List<String>): Long { return parseCommands(input).values.filter { it <= 100000 }.sum() } fun part2(input: List<String>): Long { val parsedLines = parseCommands(input) val rootSize = parsedLines["/"] ?: return -1 val availableSpace2 = 70000000 - ...
0
Kotlin
0
0
f13773d349b65ae2305029017490405ed5111814
2,446
advent-of-code-2022-kotlin
Apache License 2.0
src/main/kotlin/problems/Day18.kt
PedroDiogo
432,836,814
false
{"Kotlin": 128203}
package problems import kotlin.math.ceil import kotlin.math.floor class Day18(override val input: String) : Problem { override val number: Int = 18 private val numbers = input.lines().map { SnailfishNumber.fromString(it) } override fun runPartOne(): String { return numbers .reduce { a...
0
Kotlin
0
0
93363faee195d5ef90344a4fb74646d2d26176de
6,728
AdventOfCode2021
MIT License
src/Day04.kt
mlidal
572,869,919
false
{"Kotlin": 20582}
import java.lang.IllegalArgumentException fun main() { fun part1(input: List<String>): Int { var containsCount = 0 input.forEach { val parts = it.split(",") val (start1, end1) = parts[0].split("-").map { it.toInt() } val (start2, end2) = parts[1].split("-").map...
0
Kotlin
0
0
bea7801ed5398dcf86a82b633a011397a154a53d
1,268
AdventOfCode2022
Apache License 2.0
src/main/kotlin/year2022/day17/Problem.kt
Ddxcv98
573,823,241
false
{"Kotlin": 154634}
package year2022.day17 import IProblem import kotlin.math.max import kotlin.math.min class Problem : IProblem { private val jets = javaClass .getResource("/2022/17.txt")!! .readText() .trim() .toCharArray() private fun cycleSize(matrix: Array<BooleanArray>, i: Int, j: Int): In...
0
Kotlin
0
0
455bc8a69527c6c2f20362945b73bdee496ace41
3,000
advent-of-code
The Unlicense
yandex/y2020/qual/c.kt
mikhail-dvorkin
93,438,157
false
{"Java": 2219540, "Kotlin": 615766, "Haskell": 393104, "Python": 103162, "Shell": 4295, "Batchfile": 408}
package yandex.y2020.qual private fun solve(): Boolean { readLn() val a = readInts().sorted() readLn() val b = readInts().sorted() if (a.size != b.size) return false if (a.isEmpty()) return true val aSame = a.all { it == a[0] } val bSame = b.all { it == b[0] } if (aSame && bSame) return true if (aSame || bSa...
0
Java
1
9
30953122834fcaee817fe21fb108a374946f8c7c
871
competitions
The Unlicense
src/Day25.kt
mjossdev
574,439,750
false
{"Kotlin": 81859}
import java.math.BigInteger fun main() { fun readSnafuNumber(number: String): BigInteger { var factor = BigInteger.ONE var total = BigInteger.ZERO for (digit in number.reversed()) { val value = when (digit) { '=' -> -2 '-' -> -1 '0...
0
Kotlin
0
0
afbcec6a05b8df34ebd8543ac04394baa10216f0
1,829
advent-of-code-22
Apache License 2.0
src/main/kotlin/Day02.kt
uipko
572,710,263
false
{"Kotlin": 25828}
fun main() { val score = scores1("Day02.txt").sum() println("Your total score [1] is $score") val score2 = scores2("Day02.txt").sum() println("Your total score [2] is $score2") } fun scores1(fileName: String): List<Int> { val rounds = mutableListOf<Int>() readInput(fileName).forEach { ...
0
Kotlin
0
0
b2604043f387914b7f043e43dbcde574b7173462
1,105
aoc2022
Apache License 2.0
src/main/kotlin/endredeak/aoc2022/Day11.kt
edeak
571,891,076
false
{"Kotlin": 44975}
package endredeak.aoc2022 fun main() { solve("Monkey in the Middle") { data class Monkey( val items: ArrayDeque<Long>, val op: (Long) -> Long, val divider: Long, val ifTrue: Int, val ifFalse: Int, var activity: Long = 0 ) ...
0
Kotlin
0
0
e0b95e35c98b15d2b479b28f8548d8c8ac457e3a
3,068
AdventOfCode2022
Do What The F*ck You Want To Public License
src/main/kotlin/g1001_1100/s1091_shortest_path_in_binary_matrix/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g1001_1100.s1091_shortest_path_in_binary_matrix // #Medium #Array #Breadth_First_Search #Matrix // #Algorithm_II_Day_8_Breadth_First_Search_Depth_First_Search // #Graph_Theory_I_Day_5_Matrix_Related_Problems // #2023_06_02_Time_305_ms_(98.28%)_Space_47.6_MB_(93.10%) import java.util.LinkedList import java.uti...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,595
LeetCode-in-Kotlin
MIT License
src/day12/Day12.kt
IThinkIGottaGo
572,833,474
false
{"Kotlin": 72162}
package day12 import readInput fun main() { fun part1(input: List<String>): Int { val settled = mutableListOf<Node>() val unsettled = mutableListOf<Node>() val grid = parseInput(input) val startNode = Node(grid.getSpecifyPositionAndReplaceChar('S'), 0) // replace start position...
0
Kotlin
0
0
967812138a7ee110a63e1950cae9a799166a6ba8
5,053
advent-of-code-2022
Apache License 2.0
src/day10/Day10.kt
zypus
573,178,215
false
{"Kotlin": 33417, "Shell": 3190}
package day10 import AoCTask // https://adventofcode.com/2022/day/10 sealed class Operation(val cycles: Int) { data class AddX(val amount: Int): Operation(cycles = 2) object Noop: Operation(cycles = 1) companion object { fun fromString(string: String): Operation { return if (string =...
0
Kotlin
0
0
f37ed8e9ff028e736e4c205aef5ddace4dc73bfc
2,929
aoc-2022
Apache License 2.0
src/exercises/Day12.kt
Njko
572,917,534
false
{"Kotlin": 53729}
// ktlint-disable filename package exercises import readInput data class Point(val x: Int, val y: Int, var visited: Boolean = false) fun main() { fun findPoint(grid: List<String>, point: Char): Point { grid.forEachIndexed { y, line -> val x = line.indexOf(point) if (x != -1) retur...
0
Kotlin
0
2
68d0c8d0bcfb81c183786dfd7e02e6745024e396
3,235
advent-of-code-2022
Apache License 2.0
solutions/aockt/y2023/Y2023D17.kt
Jadarma
624,153,848
false
{"Kotlin": 435090}
package aockt.y2023 import aockt.util.Graph import aockt.util.parse import aockt.util.path import aockt.util.search import aockt.util.spacial.Area import aockt.util.spacial.Direction import aockt.util.spacial.Direction.* import aockt.util.spacial.Point import aockt.util.spacial.move import aockt.util.spacial.opposite ...
0
Kotlin
0
3
19773317d665dcb29c84e44fa1b35a6f6122a5fa
4,250
advent-of-code-kotlin-solutions
The Unlicense
src/Day14.kt
fercarcedo
573,142,185
false
{"Kotlin": 60181}
private val LINE_REGEX = "(?<x>\\d+),(?<y>\\d+)(?:\\s+->\\s+)?".toRegex() private val SAND_START = 500 to 0 data class Line( val start: Pair<Int, Int>, val end: Pair<Int, Int> ) fun Line.isVertical() = start.first == end.first enum class Item(private val text: String) { AIR("."), ROCK("#"), SAND("o"); ...
0
Kotlin
0
0
e34bc66389cd8f261ef4f1e2b7f7b664fa13f778
5,164
Advent-of-Code-2022-Kotlin
Apache License 2.0