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/day3/Day3.kt
pocmo
433,766,909
false
{"Kotlin": 134886}
package day3 import java.io.File data class Count( var zeros: Int = 0, var ones: Int = 0 ) fun part1() { val lines = File("day3.txt").readLines() val counts: List<Count> = generateSequence { Count() }.take(12).toList() lines.forEach { line -> line.forEachIndexed { index, cha...
0
Kotlin
1
2
73bbb6a41229e5863e52388a19108041339a864e
3,139
AdventOfCode2021
Apache License 2.0
src/Day05.kt
hottendo
572,708,982
false
{"Kotlin": 41152}
class Stack(crates: List<String>) { var size = crates.size var stackOfCrates = crates.toMutableList() fun moveTo(otherStack: Stack, count: Int) { // add count creates to the other stack (part 1) // val movingCrates: List<String> = this.stackOfCrates.take(count).reversed() // part...
0
Kotlin
0
0
a166014be8bf379dcb4012e1904e25610617c550
3,134
advent-of-code-2022
Apache License 2.0
src/day04.kt
skuhtic
572,645,300
false
{"Kotlin": 36109}
fun main() { day04.execute(onlyTests = true, forceBothParts = true) } val day04 = object : Day<Int>(4, 2, 4) { override val testInput: InputData get() = """ 2-4,6-8 2-3,4-5 5-7,7-9 2-8,3-7 6-6,4-6 2-6,4-8 ...
0
Kotlin
0
0
8de2933df90259cf53c9cb190624d1fb18566868
1,137
aoc-2022
Apache License 2.0
src/Day10.kt
tsschmidt
572,649,729
false
{"Kotlin": 24089}
fun main() { fun part1(input: List<String>): Int { var x = 1 var cycles = 0 val points = setOf(20, 60, 100, 140, 180, 220) val ranges = mutableListOf<Int>() input.forEach { cycles++ if (cycles in points) { ranges.add(cycles * x) ...
0
Kotlin
0
0
7bb637364667d075509c1759858a4611c6fbb0c2
1,678
aoc-2022
Apache License 2.0
src/Day02.kt
TinusHeystek
574,474,118
false
{"Kotlin": 53071}
class Day02 : Day(2) { // --- Part 1 --- private fun getHandScore(hand: Char, handType: String) : Int { return handType.indexOf(hand) } private fun calculateGame(opponentHand: Char, yourHand: Char) : Int { val handType = " XYZ" if ((opponentHand == 'A' && yourHand == 'X') || ...
0
Kotlin
0
0
80b9ea6b25869a8267432c3a6f794fcaed2cf28b
2,066
aoc-2022-in-kotlin
Apache License 2.0
src/Day06.kt
RusticFlare
574,508,778
false
{"Kotlin": 78496}
fun main() { fun part1(input: String): Int { return 4 + input.asSequence() .windowed(size = 4) .indexOfFirst { it.distinct() == it } } fun part2(input: String): Int { return 14 + input.asSequence() .windowed(size = 14) .indexOfFirst { it.disti...
0
Kotlin
0
1
10df3955c4008261737f02a041fdd357756aa37f
1,133
advent-of-code-kotlin-2022
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/CanMergeBST.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2022 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
4
Kotlin
0
19
776159de0b80f0bdc92a9d057c852b8b80147c11
3,578
kotlab
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/CourseSchedule.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2023 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
4
Kotlin
0
19
776159de0b80f0bdc92a9d057c852b8b80147c11
2,855
kotlab
Apache License 2.0
src/main/kotlin/day22/Day22.kt
Arch-vile
317,641,541
false
null
package day22 import java.io.File fun main(args: Array<String>) { val decks = File("./src/main/resources/day22Input.txt") .readText() .split("\n\n") val deck1 = buildDeck(0, decks).toMutableList() val deck2 = buildDeck(1, decks).toMutableList() val result = playGame(deck1, deck2) println("Player $...
0
Kotlin
0
0
12070ef9156b25f725820fc327c2e768af1167c0
1,561
adventOfCode2020
Apache License 2.0
src/test/kotlin/be/brammeerten/y2022/Day23Test.kt
BramMeerten
572,879,653
false
{"Kotlin": 170522}
package be.brammeerten.y2022 import be.brammeerten.C import be.brammeerten.readFile import be.brammeerten.toCharList import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test class Day23Test { @Test fun `part 1a`() { val map = readMap("2022/day23/exampleInput.txt") m...
0
Kotlin
0
0
1defe58b8cbaaca17e41b87979c3107c3cb76de0
4,216
Advent-of-Code
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/ComponentValue.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2022 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
4
Kotlin
0
19
776159de0b80f0bdc92a9d057c852b8b80147c11
2,155
kotlab
Apache License 2.0
src/main/kotlin/days/day16/Day16.kt
Stenz123
725,707,248
false
{"Kotlin": 123279, "Shell": 862}
package days.day16 import days.Day import java.util.* class Day16 : Day(false) { override fun partOne(): Any { val mirrorMap = parseInput(readInput()) val startPositions = LinkedList<Beam>() startPositions.add(Beam(Coordinate(0, 0), Direction.RIGHT)) return simulate(startPositions...
0
Kotlin
1
0
3de47ec31c5241947d38400d0a4d40c681c197be
7,523
advent-of-code_2023
The Unlicense
src/main/kotlin/kt/kotlinalgs/app/searching/SortedArraySearch.ws.kts
sjaindl
384,471,324
false
null
package kt.kotlinalgs.app.searching println("test") println(sortedSearch(intArrayOf(2, 2, 2, 3, 4, 2), 3)) println(sortedSearch(intArrayOf(2, 2, 2, 3, 4, 2), 4)) println(sortedSearch(intArrayOf(2, 2, 2, 3, 4, 2), 2)) println(sortedSearch(intArrayOf(15, 16, 19, 20, 25, 1, 3, 4, 5, 7, 10, 14), 16)) println(sortedSearc...
0
Java
0
0
e7ae2fcd1ce8dffabecfedb893cb04ccd9bf8ba0
2,357
KotlinAlgs
MIT License
generator/api/src/commonMain/kotlin/com/github/jcornaz/kwik/generator/api/GeneratorCombination.kt
aleagnelli
225,024,932
true
{"Kotlin": 147793}
package com.github.jcornaz.kwik.generator.api import kotlin.random.Random private const val NUMBER_OF_SAMPLES_FOR_COMBINATION = 5 /** * Returns a generator of values built from the elements of `this` generator and the [other] generator * using the provided [transform] function applied to each pair of elements. */...
0
null
0
0
9523cdd3bc6c199c8b85f085cb9686e5e43a4d37
5,533
kwik
Apache License 2.0
src/main/kotlin/days/Day14Data.kt
yigitozgumus
572,855,908
false
{"Kotlin": 26037}
package days import utils.SolutionData fun main() { println(" --- Part 1 --- ") Day14Data().solvePart1() println(" --- Part 2 --- ") Day14Data().solvePart2() } class Day14Data : SolutionData(inputFile = "inputs/day14.txt") { val pointLists = rawData.map { it.split("->").map { it.trim().sp...
0
Kotlin
0
0
9a3654b6d1d455aed49d018d9aa02d37c57c8946
2,660
AdventOfCode2022
MIT License
src/pl/shockah/aoc/y2015/Day24.kt
Shockah
159,919,224
false
null
package pl.shockah.aoc.y2015 import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import pl.shockah.aoc.AdventTask import pl.shockah.unikorn.Ref class Day24: AdventTask<List<Int>, Long, Long>(2015, 24) { private data class Group( val list: List<Int> ): List<Int> by list, Comparable<Group> { ...
0
Kotlin
0
0
9abb1e3db1cad329cfe1e3d6deae2d6b7456c785
2,927
Advent-of-Code
Apache License 2.0
aoc2023/src/main/kotlin/de/havox_design/aoc2023/day12/HotSprings.kt
Gentleman1983
737,309,232
false
{"Kotlin": 746488, "Java": 441473, "Scala": 33415, "Groovy": 5725, "Python": 3319}
package de.havox_design.aoc2023.day12 class HotSprings(private var filename: String) { private val DATA_DELIMITER = " " private val GROUPS_DELIMITER = "," private val ICON_BROKEN_SPRING = "#" private val ICON_OPERATIONAL_SPRING = "." private val ICON_UNKNOWN_SPRING = '?' // For Quicksolve ...
4
Kotlin
0
1
35ce3f13415f6bb515bd510a1f540ebd0c3afb04
3,965
advent-of-code
Apache License 2.0
proyek-submission-mpk-2.0.2/src/main/kotlin/com/dicoding/exam/latihanopsional1/App.kt
gilarc
716,165,676
false
{"Kotlin": 77659, "JavaScript": 252}
/**************************************************************************************************** * Perhatian * * * * Ag...
0
Kotlin
0
0
c4e7af027d018681ae47bf7d176b6145581b1fdb
2,364
myDicodingSubmissions
MIT License
src/main/kotlin/adventofcode/year2016/Day04SecurityThroughObscurity.kt
pfolta
573,956,675
false
{"Kotlin": 199554, "Dockerfile": 227}
package adventofcode.year2016 import adventofcode.Puzzle import adventofcode.PuzzleInput class Day04SecurityThroughObscurity(customInput: PuzzleInput? = null) : Puzzle(customInput) { private val rooms by lazy { input .lines() .map { room -> ROOM_REGEX.find(room)!!.destructured } ...
0
Kotlin
0
0
72492c6a7d0c939b2388e13ffdcbf12b5a1cb838
1,622
AdventOfCode
MIT License
2022/kotlin/src/Day02.kt
lucas-larsson
661,837,945
false
null
/** * @author <NAME> * @created 2023-06-26 */ fun main(){ val input = readInput("input/2") val charMapper = mapOf('A' to 1, 'B' to 2, 'C' to 3, 'X' to 1, 'Y' to 2, 'Z' to 3) fun myWinScore(elf: Char, mine: Char): Int { return when { (elf == 'A' && mine == 'Z') || (elf == 'B' && mi...
0
Rust
0
0
74c0af10732b424116c7eccf22a6288674b4e8c7
1,457
aoc
MIT License
src/maia/util/combinatorics.kt
waikato-maia
387,324,750
false
{"Kotlin": 249102}
package maia.util import java.math.BigInteger /** * Calculates the number of possible permutations of a collection * of the given size. * * @param size * The number of items in the collection. * @return * The number of possible permutations of a collection * of the given size. */ f...
0
Kotlin
0
0
b8ca03697de549dad17dbd7c3860d44247e2e973
16,286
maia-util
Apache License 2.0
src/main/kotlin/g1601_1700/s1639_number_of_ways_to_form_a_target_string_given_a_dictionary/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g1601_1700.s1639_number_of_ways_to_form_a_target_string_given_a_dictionary // #Hard #Array #String #Dynamic_Programming // #2023_06_18_Time_408_ms_(100.00%)_Space_53.4_MB_(71.43%) class Solution { fun numWays(words: Array<String>, target: String): Int { val counts = precompute(words) val m...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,793
LeetCode-in-Kotlin
MIT License
src/main/kotlin/day13/Day13MineCartMadness.kt
Zordid
160,908,640
false
null
package day13 import shared.allCoordinates import shared.readPuzzle enum class Heading(val dx: Int, val dy: Int, val symbol: Char) { N(0, -1, '^'), E(1, 0, '>'), S(0, 1, 'v'), W(-1, 0, '<'); val left get() = values()[(ordinal - 1 + values().size) % values().size] val right get() = values()[(ordinal +...
0
Kotlin
0
0
f246234df868eabecb25387d75e9df7040fab4f7
3,693
adventofcode-kotlin-2018
Apache License 2.0
src/main/kotlin/com/ginsberg/advent2022/Day09.kt
tginsberg
568,158,721
false
{"Kotlin": 113322}
/* * Copyright (c) 2022 by <NAME> */ /** * Advent of Code 2022, Day 9 - Rope Bridge * Problem Description: http://adventofcode.com/2022/day/9 * Blog Post/Commentary: https://todd.ginsberg.com/post/advent-of-code/2022/day9/ */ package com.ginsberg.advent2022 import kotlin.math.absoluteValue import kotlin.math.si...
0
Kotlin
2
26
2cd87bdb95b431e2c358ffaac65b472ab756515e
2,009
advent-2022-kotlin
Apache License 2.0
src/day05/Day05.kt
IThinkIGottaGo
572,833,474
false
{"Kotlin": 72162}
package day05 import getOrAdd import readString fun main() { fun part1(input: String): String { val (stackString, procedureString) = input.split("\n\n") val stacks = processStackString(stackString) val procedures = buildProcedures(procedureString) CrateMover9000(procedures).process...
0
Kotlin
0
0
967812138a7ee110a63e1950cae9a799166a6ba8
2,865
advent-of-code-2022
Apache License 2.0
src/main/kotlin/io/github/fbiville/solver/Solver.kt
fbiville
129,937,320
false
null
package io.github.fbiville.solver import io.github.fbiville.solver.SolutionBranch.Companion.initialMove class Solver(initialValue: Number, maxMoves: Int, val targetValue: Number, val operations: List<NamedFunction>) { private val values = Tree(operations.size, maxMoves, ini...
4
Kotlin
0
0
490d55d8b6af8fc40704439c19effbcc1a8f9e1b
1,866
calculator-solver
Apache License 2.0
src/main/kotlin/com/github/michaelbull/advent2023/day5/AlmanacMap.kt
michaelbull
726,012,340
false
{"Kotlin": 195941}
package com.github.michaelbull.advent2023.day5 fun Iterable<AlmanacMap>.lookup(index: Long): Long { return fold(index) { acc, map -> map[acc] } } fun Iterable<AlmanacMap>.lookup(ranges: List<LongRange>): List<LongRange> { return fold(ranges) { acc, map -> acc.flatMap(map::get) } } dat...
0
Kotlin
0
1
ea0b10a9c6528d82ddb481b9cf627841f44184dd
1,544
advent-2023
ISC License
src/2022/Day04.kt
ttypic
572,859,357
false
{"Kotlin": 94821}
package `2022` import readInput fun main() { fun String.toRange(): ClosedRange<Int> { val (start, end) = this.split("-").map(String::toInt) return start..end } fun ClosedRange<Int>.containedIn(other: ClosedRange<Int>) = endInclusive >= other.endInclusive && start <= other.start ...
0
Kotlin
0
0
b3e718d122e04a7322ed160b4c02029c33fbad78
1,193
aoc-2022-in-kotlin
Apache License 2.0
src/Day03.kt
Teg79
573,881,244
false
{"Kotlin": 4306}
fun main() { fun priority(type: Char) = if (type.isLowerCase()) type - 'a' + 1 else type - 'A' + 27 fun Sequence<List<String>>.intersectionPriority() = map { s -> s.map { it.asIterable().toSet() } } .map { it.reduce { acc, elem -> acc intersect elem } } .map { i...
0
Kotlin
0
0
735ed402e8dbee2011d75c71545c14589c0aabb4
919
aoc-2022
Apache License 2.0
src/Day04.kt
befrvnk
574,229,637
false
{"Kotlin": 15788}
import kotlin.math.max import kotlin.math.min fun List<String>.parse(): List<List<IntRange>> { return map { section -> section.split(",").map { elf -> elf.split("-").map { it.toInt() }.let { (first, second) -> first..second } } } } fun main() { fun part1(input: List<String>): I...
0
Kotlin
0
0
68e5dd5656c052d8c8a2ea9e03c62f4cd2438dd7
1,096
aoc-2022-kotlin
Apache License 2.0
src/Day01.kt
josepatinob
571,756,490
false
{"Kotlin": 17374}
fun main() { fun part1(input: List<String>): Int { var mostCalories = 0 var calorieCount = 0 for (i in input) { if (i.isNotEmpty()) { calorieCount += i.toInt() } else { if (calorieCount > mostCalories) { mostCalories...
0
Kotlin
0
0
d429a5fff7ddc3f533d0854e515c2ba4b0d461b0
1,442
aoc-kotlin-2022
Apache License 2.0
src/main/kotlin/day09/Day09.kt
daniilsjb
572,664,294
false
{"Kotlin": 69004}
package day09 import java.io.File import kotlin.math.absoluteValue import kotlin.math.sign fun main() { val data = parse("src/main/kotlin/day09/Day09.txt") val answer1 = part1(data) val answer2 = part2(data) println("🎄 Day 09 🎄") println() println("[Part 1]") println("Answer: $answer...
0
Kotlin
0
0
6f0d373bdbbcf6536608464a17a34363ea343036
1,694
advent-of-code-2022
MIT License
2017/src/main/kotlin/Day20.kt
dlew
498,498,097
false
{"Kotlin": 331659, "TypeScript": 60083, "JavaScript": 262}
import utils.splitNewlines import java.util.regex.Pattern import kotlin.math.abs object Day20 { private val PATTERN = Pattern.compile("p=<(-?\\d+),(-?\\d+),(-?\\d+)>, v=<(-?\\d+),(-?\\d+),(-?\\d+)>, a=<(-?\\d+),(-?\\d+),(-?\\d+)>") fun part1(input: String): Int { val particles = parseParticles(input) ret...
0
Kotlin
0
0
6972f6e3addae03ec1090b64fa1dcecac3bc275c
2,660
advent-of-code
MIT License
src/Day25.kt
Kvest
573,621,595
false
{"Kotlin": 87988}
fun main() { val testInput = readInput("Day25_test") check(part1(testInput) == "2=-1=0") val input = readInput("Day25") println(part1(input)) } private fun part1(input: List<String>): String { val sum = input.sumOf(String::SNAFUToInt) return sum.toSNAFU() } private fun String.SNAFUToInt(): L...
0
Kotlin
0
0
6409e65c452edd9dd20145766d1e0ea6f07b569a
1,031
AOC2022
Apache License 2.0
src/main/kotlin/dev/bogwalk/batch7/Problem75.kt
bog-walk
381,459,475
false
null
package dev.bogwalk.batch7 import dev.bogwalk.util.maths.pythagoreanTriplet import dev.bogwalk.util.maths.sum /** * Problem 75: Singular Integer Right Triangles * * https://projecteuler.net/problem=75 * * Goal: Given a length L, find how many values of L <= N can form exactly 1 integer-sided * right-angle trian...
0
Kotlin
0
0
62b33367e3d1e15f7ea872d151c3512f8c606ce7
2,405
project-euler-kotlin
MIT License
src/Day17.kt
mikemac42
573,071,179
false
{"Kotlin": 45264}
import java.io.File fun main() { val testInput = """>>><<><>><<<>><>>><<<>>><<<><<<>><>><<>>""" val realInput = File("src/Day17.txt").readText() val part1TestOutput = towerHeight(testInput, 2022) println("Part 1 Test Output: $part1TestOutput") check(part1TestOutput == 3068) val part1RealOutput = towerHei...
0
Kotlin
1
0
909b245e4a0a440e1e45b4ecdc719c15f77719ab
3,872
advent-of-code-2022
Apache License 2.0
src/Day07.kt
juliantoledo
570,579,626
false
{"Kotlin": 34375}
fun main() { class Dir( var name: String, var parent: Dir? = null, var dirs: MutableList<Dir> = mutableListOf(), var files: MutableMap<String, Int> = mutableMapOf() ){ fun allDirs(): List<Dir> = dirs + dirs.flatMap { it.allDirs() } fun size(): Int = files.values....
0
Kotlin
0
0
0b9af1c79b4ef14c64e9a949508af53358335f43
1,646
advent-of-code-kotlin-2022
Apache License 2.0
Retos/Reto #6 - PIEDRA, PAPEL, TIJERA, LAGARTO, SPOCK [Media]/kotlin/malopezrom.kts
mouredev
581,049,695
false
{"Python": 3866914, "JavaScript": 1514237, "Java": 1272062, "C#": 770734, "Kotlin": 533094, "TypeScript": 457043, "Rust": 356917, "PHP": 281430, "Go": 243918, "Jupyter Notebook": 221090, "Swift": 216751, "C": 210761, "C++": 164758, "Dart": 159755, "Ruby": 70259, "Perl": 52923, "VBScript": 49663, "HTML": 45912, "Raku": ...
package com.malopezrom.reto6 /* * Crea un programa que calcule quien gana más partidas al piedra, * papel, tijera, lagarto, spock. * - El resultado puede ser: "Player 1", "Player 2", "Tie" (empate) * - La función recibe un listado que contiene pares, representando cada jugada. * - El par puede contener combinacion...
4
Python
2,929
4,661
adcec568ef7944fae3dcbb40c79dbfb8ef1f633c
3,619
retos-programacion-2023
Apache License 2.0
src/main/kotlin/day13/Day13.kt
Mee42
433,459,856
false
{"Kotlin": 42703, "Java": 824}
package dev.mee42.day13 import dev.mee42.* val test = """ 6,10 0,14 9,10 0,3 10,4 4,11 6,0 6,12 4,1 0,13 10,12 3,4 3,0 8,4 1,10 2,14 8,10 9,0 fold along y=7 fold along x=5 """.trimIndent() fun main() { val inputRaw = if(1 == 0) test else input(day = 13, year = 2021) val (inputDots, inputInstructions) = input...
0
Kotlin
0
0
db64748abc7ae6a92b4efa8ef864e9bb55a3b741
1,379
aoc-2021
MIT License
src/Day10.kt
Kietyo
573,293,671
false
{"Kotlin": 147083}
import kotlin.math.absoluteValue import kotlin.math.min import kotlin.math.pow import kotlin.math.sign import kotlin.math.sqrt fun main() { fun part1(input: List<String>): Unit { var currCycle = 1 var xRegister = 1 val cyclesToRecord = setOf( 20, 60, 100, 140, 180, 220 ...
0
Kotlin
0
0
dd5deef8fa48011aeb3834efec9a0a1826328f2e
2,779
advent-of-code-2022-kietyo
Apache License 2.0
src/main/kotlin/day17/part2/Part2.kt
bagguley
329,976,670
false
null
package day17.part2 import day17.data const val active = '#' var worldMap:MutableMap<String, Boolean> = mutableMapOf() fun main() { val input = data initWorld(input) advanceWorld() advanceWorld() advanceWorld() advanceWorld() advanceWorld() advanceWorld() println(worldMap.valu...
0
Kotlin
0
0
6afa1b890924e9459f37c604b4b67a8f2e95c6f2
2,803
adventofcode2020
MIT License
src/main/kotlin/day22/Code.kt
fcolasuonno
317,324,330
false
null
package day22 import isDebug import java.io.File fun main() { val name = if (isDebug()) "test.txt" else "input.txt" System.err.println(name) val dir = ::main::class.java.`package`.name val input = File("src/main/kotlin/$dir/$name").readLines() val parsed = parse(input) part1(parsed) part2(...
0
Kotlin
0
0
e7408e9d513315ea3b48dbcd31209d3dc068462d
2,404
AOC2020
MIT License
src/main/kotlin/aoc2015/Day18.kt
lukellmann
574,273,843
false
{"Kotlin": 175166}
package aoc2015 import AoCDay import util.illegalInput // https://adventofcode.com/2015/day/18 object Day18 : AoCDay<Int>( title = "Like a GIF For Your Yard", part1Answer = 768, part2Answer = 781, ) { private fun parseConfiguration(input: String) = input .lines() .map { line -> ...
0
Kotlin
0
1
344c3d97896575393022c17e216afe86685a9344
2,185
advent-of-code-kotlin
MIT License
src/main/kotlin/chjaeggi/Day7.kt
chjaeggi
296,447,759
false
null
package chjaeggi class Day7(private val input: List<String>) { private val parentsPerBag: MutableMap<String, List<String>> = mutableMapOf() private val childrenPerBag: MutableMap<String, MutableMap<String, Int>> = mutableMapOf() init { input.forEach { val splitted = it.split("contain...
0
Kotlin
0
1
3ab7867a5c3b06b8f5f90380f0ada1a73f5ffa71
2,435
aoc2020
Apache License 2.0
src/main/kotlin/org/sjoblomj/adventofcode/day3/Visualiser.kt
sjoblomj
225,241,573
false
null
package org.sjoblomj.adventofcode.day3 import org.sjoblomj.adventofcode.day3.Instruction.Direction.* fun visualise(firstInstructions: String, secondInstructions: String = ""): String { val symbolMap = HashMap<Coord, Char>() createSymbolMap(symbolMap, firstInstructions) createSymbolMap(symbolMap, secondInstruction...
0
Kotlin
0
0
f8d03f7ef831bc7e26041bfe7b1feaaadcb40e68
1,856
adventofcode2019
MIT License
src/main/kotlin/mkuhn/aoc/Day10.kt
mtkuhn
572,236,871
false
{"Kotlin": 53161}
package mkuhn.aoc import mkuhn.aoc.util.readInput fun main() { val input = readInput("Day10") println(day10part1(input)) println(day10part2(input)) } fun day10part1(input: List<String>): Int = input.asSequence() .map { it.parseInstruction() } .padCyclesWithFalseInstruction() ....
0
Kotlin
0
1
89138e33bb269f8e0ef99a4be2c029065b69bc5c
1,562
advent-of-code-2022
Apache License 2.0
src/day4/Day4.kt
quinlam
573,215,899
false
{"Kotlin": 31932}
package day4 import utils.Day /** * Actual answers after submitting; * part1: 644 * part2: 926 */ class Day4 : Day<Int, List<CampRanges>>( testPart1Result = 2, testPart2Result = 4 ) { override fun part1Answer(input: List<CampRanges>): Int { return input.sumOf { rangeIsContained(it) } } ...
0
Kotlin
0
0
d304bff86dfecd0a99aed5536d4424e34973e7b1
1,687
advent-of-code-2022
Apache License 2.0
src/Day05.kt
devPalacio
574,493,024
false
{"Kotlin": 8009, "Python": 1346}
fun main() { val input = readInput("day05") val crates = input.takeWhile { it.contains("[") } val totalRows = input.first { it.contains(" 1") }.trim().last().toString().toInt() val rawCommands = input.filter { it.startsWith('m') } // create holding structure for data val crateStructure9000 = Li...
0
Kotlin
0
0
648755244e07887335d05601b5fe78bdcb8b1baa
2,206
AoC-2022
Apache License 2.0
src/Day03.kt
matheusfinatti
572,935,471
false
{"Kotlin": 12612}
fun main() { val input = readInput("Day03").split("\n") input.map { items -> items.chunked(items.count() / 2) } .map { sacks -> val hash = mutableSetOf<Char>() sacks[0].forEach { c -> hash.add(c) } sacks[1].forEach { c -> if...
0
Kotlin
0
0
a914994a19261d1d81c80e0ef8e196422e3cd508
1,172
adventofcode2022
Apache License 2.0
src/Day05.kt
zt64
572,594,597
false
null
fun main() { val input = readInput("Day05") val regex = """move (\d{1,2}) from (\d{1,2}) to (\d{1,2})""".toRegex() fun part1(input: String): String { val sections = input.split("\n\n") val storage = sections[0].lines() val instructions = sections[1].lines() val columns = s...
0
Kotlin
0
0
4e4e7ed23d665b33eb10be59670b38d6a5af485d
1,927
aoc-2022
Apache License 2.0
src/main/kotlin/com/github/michaelbull/advent/day14/NanoFactory.kt
michaelbull
225,205,583
false
null
package com.github.michaelbull.advent.day14 class NanoFactory(reactions: List<Reaction>) { private val reactionsByChemical = reactions.associateBy { it.output.name } fun oreForOneFuel(): Long { return ORE.amountToProduce(ONE_FUEL) } fun producableFuel(): Long { return FUEL.amountProd...
0
Kotlin
0
2
d271a7c43c863acd411bd1203a93fd10485eade6
2,466
advent-2019
ISC License
src/Day01.kt
ghasemdev
572,632,405
false
{"Kotlin": 7010}
import kotlin.math.max fun main() { fun part1(input: List<String>): Int { var max = Int.MIN_VALUE var temp = 0 input.forEachIndexed { index, calorie -> if (calorie.isNotEmpty()) { temp += calorie.toInt() } else { max = max(max, temp) ...
0
Kotlin
0
1
7aa5e7824c0d2cf2dad94ed8832a6b9e4d36c446
1,338
aoc-2022-in-kotlin
Apache License 2.0
src/main/kotlin/day12.kt
Gitvert
433,947,508
false
{"Kotlin": 82286}
fun day12() { val lines: List<String> = readFile("day12.txt") day12part1(lines) day12part2(lines) } fun day12part1(lines: List<String>) { val caves = initCaveMap(lines) val path: MutableList<Cave> = mutableListOf() val paths: MutableList<List<Cave>> = mutableListOf() findPath(caves, caves...
0
Kotlin
0
0
02484bd3bcb921094bc83368843773f7912fe757
2,752
advent_of_code_2021
MIT License
src/main/kotlin/g2501_2600/s2577_minimum_time_to_visit_a_cell_in_a_grid/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g2501_2600.s2577_minimum_time_to_visit_a_cell_in_a_grid // #Hard #Array #Breadth_First_Search #Matrix #Heap_Priority_Queue #Graph #Shortest_Path // #2023_07_10_Time_1446_ms_(100.00%)_Space_62.8_MB_(100.00%) import java.util.PriorityQueue class Solution { fun minimumTime(grid: Array<IntArray>): Int { ...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,686
LeetCode-in-Kotlin
MIT License
src/main/kotlin/com/hj/leetcode/kotlin/problem64/Solution.kt
hj-core
534,054,064
false
{"Kotlin": 619841}
package com.hj.leetcode.kotlin.problem64 /** * LeetCode page: [64. Minimum Path Sum](https://leetcode.com/problems/minimum-path-sum/); */ class Solution { /* Complexity: * Time O(MN) and Space O(N) where M and N are the number of rows and columns of grid; */ fun minPathSum(grid: Array<IntArray>): I...
1
Kotlin
0
1
14c033f2bf43d1c4148633a222c133d76986029c
1,380
hj-leetcode-kotlin
Apache License 2.0
src/Day03.kt
stephenkao
572,205,897
false
{"Kotlin": 14623}
fun main() { fun getAdjustedCharCode(c: Char): Int { return when(c) { in 'A'..'Z' -> c.code - 38 in 'a'..'z' -> c.code - 96 else -> 0 } } fun part1(input: List<String>): Int { fun getCommonCharPriority(str: String): Int { val halfIdx =...
0
Kotlin
0
0
7a1156f10c1fef475320ca985badb4167f4116f1
1,511
advent-of-code-kotlin-2022
Apache License 2.0
year2021/src/main/kotlin/net/olegg/aoc/year2021/day5/Day5.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2021.day5 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.utils.Vector2D import net.olegg.aoc.utils.parseInts import net.olegg.aoc.year2021.DayOf2021 import kotlin.math.absoluteValue import kotlin.math.sign /** * See [Year 2021, Day 5](https://adventofcode.com/2021/day/5) */ obje...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
2,135
adventofcode
MIT License
src/Day15.kt
MerickBao
572,842,983
false
{"Kotlin": 28200}
import kotlin.math.abs fun main() { val beacon = HashSet<Long>() val base = 10000000000 val all = mutableListOf<List<Long>>() fun count(input: String) { val xx = arrayListOf<Long>() val yy = arrayListOf<Long>() var idx = 0 while (idx < input.length) { if (in...
0
Kotlin
0
0
70a4a52aa5164f541a8dd544c2e3231436410f4b
2,690
aoc-2022-in-kotlin
Apache License 2.0
src/Day10.kt
sitamshrijal
574,036,004
false
{"Kotlin": 34366}
fun main() { fun parse(input: List<String>): List<Instruction> = input.map { it.parse() } fun signalStrength(instructions: List<Instruction>, cycle: Int): Int { var remaining = cycle var X = 1 for (instruction in instructions) { if (remaining <= instruction.cycles) { ...
0
Kotlin
0
0
fd55a6aa31ba5e3340be3ea0c9ef57d3fe9fd72d
1,159
advent-of-code-2022
Apache License 2.0
leetcode/kotlin/pacific-atlantic-water-flow.kt
PaiZuZe
629,690,446
false
null
class Solution { fun pacificAtlantic(heights: Array<IntArray>): List<List<Int>> { val resp = mutableListOf<List<Int>>() val visitsPacific = Array(heights.size) { BooleanArray(heights[0].size) { false } } val visitsAtlantic = Array(heights.size) { BooleanArray(heights[0].size) { false } } ...
0
Kotlin
0
0
175a5cd88959a34bcb4703d8dfe4d895e37463f0
2,598
interprep
MIT License
src/day15/Code.kt
fcolasuonno
225,219,560
false
null
package day15 import IntCode import IntCodeComputer import isDebug import java.io.File fun main() { val name = if (isDebug()) "test.txt" else "input.txt" System.err.println(name) val dir = ::main::class.java.`package`.name val input = File("src/$dir/$name").readLines() val parsed = parse(input) ...
0
Kotlin
0
0
d1a5bfbbc85716d0a331792b59cdd75389cf379f
3,883
AOC2019
MIT License
src/Day02.kt
Jenner-Zhl
576,294,907
false
{"Kotlin": 8369}
const val ROCK = "A" const val ROCK_RESPONSE = "X" const val PAPER = "B" const val PAPER_RESPONSE = "Y" const val SCISSORS = "C" const val SCISSORS_RESPONSE = "Z" const val SCORE_ROCK = 1 const val SCORE_PAPER = 2 const val SCORE_SCISSORS = 3 const val SCORE_DRAW = 3 const val SCORE_WIN = 6 enum class Response(val s...
0
Kotlin
0
0
5940b844155069e020d1859bb2d3fb06cb820981
3,241
aoc
Apache License 2.0
src/main/kotlin/advent/day4/GiantSquid.kt
hofiisek
434,171,205
false
{"Kotlin": 51627}
package advent.day4 import advent.loadInput import java.io.File /** * @author <NAME> */ fun part1(input: File): Int { val inputLines = input.readLines() val numbers = inputLines.first().split(",").map { it.toInt() } val boards = constructBoards(inputLines.drop(1)) numbers.forEach { number -> ...
0
Kotlin
0
2
3bd543ea98646ddb689dcd52ec5ffd8ed926cbbb
1,902
Advent-of-code-2021
MIT License
src/Day04.kt
ahmadshabib
573,197,533
false
{"Kotlin": 13577}
fun main() { val input = readInput("Day04") println(firstSolution(input)) println(secondSolution(input)) } fun firstSolution(input: List<String>): Int = input .map { converty(it) }.filter { (it.first.first <= it.second.first && it.first.second >= it.second.seco...
0
Kotlin
0
0
81db1b287ca3f6cae95dde41919bfa539ac3adb5
942
advent-of-code-kotlin-22
Apache License 2.0
src/Day06.kt
paulgrugnale
573,105,050
false
{"Kotlin": 6378}
fun main() { fun part1(input: List<String>): Int { return input.first().windowedSequence(4).indexOfFirst { it.toSet().size == 4 } + 4 } fun part2(input: List<String>): Int { return input.first().windowedSequence(14).indexOfFirst { it.toSet().size == 14 ...
0
Kotlin
0
0
e62edc817a8b75e401d6c8a0a66243d009c31fbd
946
advent2022
Apache License 2.0
2021/src/day20/Solution.kt
vadimsemenov
437,677,116
false
{"Kotlin": 56211, "Rust": 37295}
package day20 import java.nio.file.Files import java.nio.file.Paths fun main() { fun wrap(field: List<String>, surrounding: Char = '.'): List<String> { val length = field.first().length val darkRow = buildString(length) { repeat(length) { append(surrounding) } } val fix = List(3) { darkRow } return ...
0
Kotlin
0
0
8f31d39d1a94c862f88278f22430e620b424bd68
1,916
advent-of-code
Apache License 2.0
src/main/kotlin/com/hj/leetcode/kotlin/problem12/Solution.kt
hj-core
534,054,064
false
{"Kotlin": 619841}
package com.hj.leetcode.kotlin.problem12 /** * LeetCode page: [12. Integer to Roman](https://leetcode.com/problems/integer-to-roman/); */ class Solution { private val romanSymbols = hashMapOf<Int, String>().apply { this[1] = "I" this[5] = "V" this[10] = "X" this[50] = "L" ...
1
Kotlin
0
1
14c033f2bf43d1c4148633a222c133d76986029c
1,844
hj-leetcode-kotlin
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/EqualMatrixPairs.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2022 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
4
Kotlin
0
19
776159de0b80f0bdc92a9d057c852b8b80147c11
1,787
kotlab
Apache License 2.0
src/aoc2020/Day02.kt
matusekma
572,617,724
false
{"Kotlin": 119912, "JavaScript": 2024}
package aoc2020 import readInput class Day02 { fun part1(input: List<String>): Int { var sum = 0 for (line in input) { val (times, c, pass) = line.split(' ') val (minTimes, maxTimes) = times.split('-').map { it.toInt() } val char = c[0] var count = ...
0
Kotlin
0
0
744392a4d262112fe2d7819ffb6d5bde70b6d16a
1,187
advent-of-code
Apache License 2.0
src/main/kotlin/grappolo/Cluster.kt
xrrocha
264,292,094
false
null
package grappolo class Cluster(set: Set<Int>, matrix: SimilarityMatrix) { class ClusterElement(val index: Int, val intraSimilarity: Double) { override fun toString(): String = "ClusterElement(index: $index, intraSimilarity: ${intraSimilarity.fmt(4)})" } val elements: List<ClusterElement> val ...
0
Kotlin
0
0
93a065ab98d5551bc2f2e39ff4b069d524e04870
2,579
grappolo-kotlin
Apache License 2.0
src/Day10.kt
hijst
572,885,261
false
{"Kotlin": 26466}
import kotlin.math.abs fun main() { fun part1(input: List<String>): Int { val states = mutableListOf(1, 1) input.forEach { op -> if (op == "noop") { states.add(states.last()) } else { states.add(states.last()) states.add(states...
0
Kotlin
0
0
2258fd315b8933642964c3ca4848c0658174a0a5
1,317
AoC-2022
Apache License 2.0
src/main/kotlin/d21/D21_2.kt
MTender
734,007,442
false
{"Kotlin": 108628}
package d21 import d18.set import input.Input fun simulate(lines: List<String>, steps: Int, start: Pair<Int, Int>): Int { val countEvens = (start.first + start.second + steps) % 2 == 0 val markedLines = bfs(lines, steps, start) return count(markedLines, countEvens) } fun main() { val totalSteps = 2...
0
Kotlin
0
0
a6eec4168b4a98b73d4496c9d610854a0165dbeb
2,195
aoc2023-kotlin
MIT License
src/main/kotlin/day6/Day6.kt
stoerti
726,442,865
false
{"Kotlin": 19680}
package day5 import io.github.stoerti.aoc.IOUtils import io.github.stoerti.aoc.StringExt.longValues import kotlin.math.ceil import kotlin.math.floor import kotlin.math.sqrt fun main(args: Array<String>) { val lines = IOUtils.readInput("day_6_input").toMutableList().also { it.add("") } val raceTimes = lines[0].re...
0
Kotlin
0
0
05668206293c4c51138bfa61ac64073de174e1b0
1,486
advent-of-code
Apache License 2.0
src/main/kotlin/days/Day17.kt
mstar95
317,305,289
false
null
package days class Day17 : Day(17) { override fun partOne(): Any { val input = countActiveAfter(1, 3, inputList) println(input) return input } override fun partTwo(): Any { val input = countActiveAfter(6, 4, inputList) return input } data class Dimensiona...
0
Kotlin
0
0
ca0bdd7f3c5aba282a7aa55a4f6cc76078253c81
1,740
aoc-2020
Creative Commons Zero v1.0 Universal
relive-simulator-core/src/commonMain/kotlin/xyz/qwewqa/relive/simulator/core/stage/utils/Statistics.kt
qwewqa
390,928,568
false
{"Kotlin": 22070220, "HTML": 63800, "CSS": 40067, "Python": 15224, "JavaScript": 1490}
package xyz.qwewqa.relive.simulator.core.stage.utils import xyz.qwewqa.relive.simulator.common.MarginResult import xyz.qwewqa.relive.simulator.common.SimulationMarginResultType import xyz.qwewqa.relive.simulator.common.StatisticsSummary import xyz.qwewqa.relive.simulator.core.stage.MarginStageResult import xyz.qwewqa....
1
Kotlin
10
6
530a00afb9931cd75f9a5f3bfa517015dd648fd2
3,707
relight
MIT License
src/main/kotlin/adventofcode/day20.kt
Kvest
163,103,813
false
null
package adventofcode import java.io.File import kotlin.math.max import kotlin.math.min import kotlin.system.measureTimeMillis fun main(args: Array<String>) { val time = measureTimeMillis { first20(File("./data/day20.txt").readText()) } println("For $time ms\n") val time2 = measureTimeMillis {...
0
Kotlin
0
0
d94b725575a8a5784b53e0f7eee6b7519ac59deb
6,386
aoc2018
Apache License 2.0
src/main/kotlin/Day04.kt
Vampire
572,990,104
false
{"Kotlin": 57326}
fun main() { fun inputToRanges(input: List<String>) = input .map { it .split(",") .map { it.split("-").map(String::toInt) } .map { (a, b) -> IntRange(a, b) } } fun part1(input: List<String>) = inputToRanges(input) .count { (x, ...
0
Kotlin
0
0
16a31a0b353f4b1ce3c6e9cdccbf8f0cadde1f1f
764
aoc-2022
Apache License 2.0
src/main/Day03.kt
ssiegler
572,678,606
false
{"Kotlin": 76434}
package day03 import utils.readInput @JvmInline value class Rucksack(private val items: List<ItemType>) { private val firstCompartment: List<ItemType> get() = items.subList(0, items.size / 2) private val secondCompartment: List<ItemType> get() = items.subList(items.size / 2, items.size) v...
0
Kotlin
0
0
9133485ca742ec16ee4c7f7f2a78410e66f51d80
1,306
aoc-2022
Apache License 2.0
src/Day04.kt
phoenixli
574,035,552
false
{"Kotlin": 29419}
fun main() { fun part1(input: List<String>): Int { var count = 0 input.forEach{ val assignments = it.split(",") if (isContained(assignments)) { count++ } } return count } fun part2(input: List<String>): Int { var ...
0
Kotlin
0
0
5f993c7b3c3f518d4ea926a792767a1381349d75
1,587
Advent-of-Code-2022
Apache License 2.0
src/main/kotlin/com/groundsfam/advent/y2021/d07/Day07.kt
agrounds
573,140,808
false
{"Kotlin": 281620, "Shell": 742}
package com.groundsfam.advent.y2021.d07 import com.groundsfam.advent.DATAPATH import com.groundsfam.advent.timed import kotlin.io.path.div import kotlin.io.path.useLines import kotlin.math.abs fun minFuelOne(positions: List<Int>): Int { val median = positions.sorted().let { it[it.size / 2] } retu...
0
Kotlin
0
1
c20e339e887b20ae6c209ab8360f24fb8d38bd2c
1,223
advent-of-code
MIT License
kotlin/structures/TreapIndexed.kt
polydisc
281,633,906
true
{"Java": 540473, "Kotlin": 515759, "C++": 265630, "CMake": 571}
package structures import java.util.function.Predicate // https://cp-algorithms.com/data_structures/treap.html object TreapIndexed { var random: Random = Random() fun split(root: Node?, minRight: Int): TreapPair { if (root == null) return TreapPair(null, null) root.push() return if (No...
1
Java
0
0
4566f3145be72827d72cb93abca8bfd93f1c58df
7,131
codelibrary
The Unlicense
inputmask/src/main/kotlin/com/redmadrobot/inputmask/helper/AffinityCalculationStrategy.kt
RedMadRobot
71,991,744
false
null
package com.redmadrobot.inputmask.helper import com.redmadrobot.inputmask.model.CaretString /** * ### AffinityCalculationStrategy * * Allows to opt for a different mask picking algorithm in text field listeners. */ enum class AffinityCalculationStrategy { /** * Default strategy. * * Uses ``Mask...
6
Kotlin
112
1,193
df452edc0c52a37e5082adcfc3d05d77b5aa34e8
4,728
input-mask-android
MIT License
src/exercises/Day16.kt
Njko
572,917,534
false
{"Kotlin": 53729}
// ktlint-disable filename package exercises import readInput data class Valve( val name: String, val flowRate: Int, var isOpen: Boolean = false ) fun main() { fun extractValves(input: List<String>): Pair<MutableList<Valve>, Map<String, List<String>>> { val pattern = "^Valve ([A-Z]{2}) .*=(\\...
0
Kotlin
0
2
68d0c8d0bcfb81c183786dfd7e02e6745024e396
2,225
advent-of-code-2022
Apache License 2.0
app/src/main/kotlin/day03/Day03.kt
meli-w
433,710,859
false
{"Kotlin": 52501}
package day03 import common.InputRepo import common.readSessionCookie import common.solve import java.lang.IllegalStateException fun main(args: Array<String>) { val day = 3 val input = InputRepo(args.readSessionCookie()).get(day = day) solve(day, input, ::solveDay03Part1, ::solveDay03Part2) } fun solve...
0
Kotlin
0
1
f3b96c831d6c8e21de1ac866cf9c64aaae2e5ea1
1,849
AoC-2021
Apache License 2.0
src/test/kotlin/be/brammeerten/y2022/Day25Test.kt
BramMeerten
572,879,653
false
{"Kotlin": 170522}
package be.brammeerten.y2022 import be.brammeerten.readFile import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test class Day25Test { @Test fun `part 0`() { val numbers = mapOf( 1 to Num("1"), 2 to Num("2"), 3 to Num("1="), 4...
0
Kotlin
0
0
1defe58b8cbaaca17e41b87979c3107c3cb76de0
2,757
Advent-of-Code
MIT License
src/Day05.kt
saphcarter
573,329,337
false
null
fun main() { fun String.locateCrate(index: Int): Char? { val crateIndex = 1 + (4 * index) return if (crateIndex > this.length) null else { val crate = this[crateIndex] if (crate.isWhitespace()) null else crate } } fun parseCrates(input: List<String>): List<A...
0
Kotlin
0
0
2037106e961dc58e75df2fbf6c31af6e0f44777f
2,282
aoc-2022
Apache License 2.0
src/main/kotlin/github/walkmansit/aoc2020/Day03.kt
walkmansit
317,479,715
false
null
package github.walkmansit.aoc2020 class Day03(val input: List<String>) : DayAoc<Int, Long> { private val appendPoint = Point(3, 1) private data class Point(val x: Int, val y: Int) private class CustomMap(val lines: List<String>) { private val points = listOf(Point(1, 1), Point(3, 1), Point(5, 1...
0
Kotlin
0
0
9c005ac4513119ebb6527c01b8f56ec8fd01c9ae
1,637
AdventOfCode2020
MIT License
day8/src/main/kotlin/com/lillicoder/adventofcode2023/day8/Day8.kt
lillicoder
731,776,788
false
{"Kotlin": 98872}
package com.lillicoder.adventofcode2023.day8 import kotlin.math.max fun main() { val day8 = Day8() val network = NetworkParser().parseFile("input.txt") println("Total number of steps required to navigate the network is ${day8.part1(network)}.") println("Total number of steps required to navigate the n...
0
Kotlin
0
0
390f804a3da7e9d2e5747ef29299a6ad42c8d877
7,882
advent-of-code-2023
Apache License 2.0
src/leetcodeProblem/leetcode/editor/en/FindFirstAndLastPositionOfElementInSortedArray.kt
faniabdullah
382,893,751
false
null
//Given an array of integers nums sorted in non-decreasing order, find the //starting and ending position of a given target value. // // If target is not found in the array, return [-1, -1]. // // You must write an algorithm with O(log n) runtime complexity. // // // Example 1: // Input: nums = [5,7,7,8,8,10], tar...
0
Kotlin
0
6
ecf14fe132824e944818fda1123f1c7796c30532
2,232
dsa-kotlin
MIT License
src/main/kotlin/info/jukov/adventofcode/y2022/Day15.kt
jukov
572,271,165
false
{"Kotlin": 78755}
package info.jukov.adventofcode.y2022 import info.jukov.adventofcode.Day import info.jukov.adventofcode.util.calcDistance import info.jukov.adventofcode.util.combine import info.jukov.adventofcode.util.delta import java.io.BufferedReader import kotlin.math.max import kotlin.math.min object Day15 : Day() { overri...
0
Kotlin
1
0
5fbdaf39a508dec80e0aa0b87035984cfd8af1bb
3,870
AdventOfCode
The Unlicense
src/main/kotlin/ir/ahmadmo/math/timeseries/trend/Trend.kt
ahmadmo
292,615,866
false
null
package ir.ahmadmo.math.timeseries.trend import ir.ahmadmo.math.EPSILON import ir.ahmadmo.math.timeseries.* import org.apache.commons.math3.stat.StatUtils import kotlin.math.abs import kotlin.math.atan /** * A trend is simply a [TimeSeries]. */ typealias Trend = TimeSeries fun Trend.resistanceLine(): LinearTrendLi...
0
Kotlin
0
4
b7101a87455714d61385f241e3aef9566b86b683
3,500
math-time-series
MIT License
src/main/aoc2016/Day2.kt
nibarius
154,152,607
false
{"Kotlin": 963896}
package aoc2016 class Day2(val input: List<String>) { private var currX = -1 private var currY = -1 private fun moveIfPossible(dialPad: Map<Pair<Int, Int>, Char>, x: Int, y: Int) { if (dialPad.contains(Pair(x, y))) { currX = x currY = y } } private fun find...
0
Kotlin
0
6
f2ca41fba7f7ccf4e37a7a9f2283b74e67db9f22
1,934
aoc
MIT License
src/Day08.kt
laricchia
434,141,174
false
{"Kotlin": 38143}
/* * 0: 1: 2: 3: 4: aaaa .... aaaa aaaa .... b c . c . c . c b c b c . c . c . c b c .... .... dddd dddd dddd e f . f e . . f . f e f . f e . . f . f gggg .... gggg gggg .... 5: ...
0
Kotlin
0
0
7041d15fafa7256628df5c52fea2a137bdc60727
5,123
Advent_of_Code_2021_Kotlin
Apache License 2.0
src/test/kotlin/edu/rice/fset/HashFamilyTest.kt
danwallach
362,519,139
false
null
package edu.rice.fset import io.kotest.core.spec.style.FreeSpec import io.kotest.matchers.doubles.shouldBeLessThan import io.kotest.matchers.shouldBe import io.kotest.matchers.shouldNotBe import io.kotest.property.checkAll import kotlin.math.sqrt /** * Returns a list of population counts of each bit in the input, *...
0
Kotlin
0
0
18972974f130c64762ae81d7106a1ec2fa5a51dc
2,353
fset-kotlin
MIT License
src/main/kotlin/unibz/cs/semint/kprime/domain/db/schemalgo/decomposeTo3NF.kt
kprime-dev
722,929,885
false
{"Kotlin": 383495, "XSLT": 1078, "HTML": 372, "Makefile": 218}
package unibz.cs.semint.kprime.domain.db.schemalgo import unibz.cs.semint.kprime.domain.db.* fun decomposeTo3NF(attrs:Set<Column>, fds:Set<Constraint>): Set<Relation> { val result = HashSet<Relation>() val minimalBasis = minimalBasis(fds) decomposeOnPotentialRelations(minimalBasis, result) removeSubsu...
0
Kotlin
0
0
63429395f454148e1652bc0b597c32dd08c15383
1,743
kprime-arm
MIT License
src/main/kotlin/y2022/day03/Day3.kt
TimWestmark
571,510,211
false
{"Kotlin": 97942, "Shell": 1067}
package y2022.day03 fun main() { AoCGenerics.printAndMeasureResults( part1 = { part1() }, part2 = { part2() } ) } fun input(): List<Pair<String, String>> { return AoCGenerics.getInputLines("/y2022/day03/input.txt").map { line -> Pair(line.substring(0, line.length/2) ,li...
0
Kotlin
0
0
23b3edf887e31bef5eed3f00c1826261b9a4bd30
1,044
AdventOfCode
MIT License
src/main/kotlin/endredeak/aoc2022/Day14.kt
edeak
571,891,076
false
{"Kotlin": 44975}
package endredeak.aoc2022 import kotlin.math.abs import kotlin.math.max import kotlin.math.sign fun main() { solve("Regolith Reservoir") { fun List<Pair<Int, Int>>.draw(): List<Pair<Int, Int>> { val (fx, fy) = this.first() val (tx, ty) = this.last() var (cx, cy) = fx to...
0
Kotlin
0
0
e0b95e35c98b15d2b479b28f8548d8c8ac457e3a
2,135
AdventOfCode2022
Do What The F*ck You Want To Public License
src/Day03.kt
josemarcilio
572,290,152
false
{"Kotlin": 5535}
fun main() { fun part1(input: List<String>): Int { return input.sumOf { val (a, b) = it.chunked(it.length / 2).map(String::toSet) a.intersect(b).first().alphabeticalOrder() } } fun part2(input: List<String>): Int { return input .map { it.toSet() }...
0
Kotlin
0
0
d628345afeb014adce189fddac53a1fcd98479fb
748
advent-of-code-2022
Apache License 2.0
src/Day04.kt
Migge
572,695,764
false
{"Kotlin": 9496}
private fun part1(input: List<String>): Int = input .ints() .map { it.chunked(2) { (a, b) -> a..b } } .count { (x, y) -> x.all { it in y } || y.all { it in x } } private fun part2(input: List<String>): Int = input .ints() .map { it.chunked(2) { (a, b) -> a..b } } .count { (x, y) -> x.any { it i...
0
Kotlin
0
0
c7ca68b2ec6b836e73464d7f5d115af3e6592a21
563
adventofcode2022
Apache License 2.0
2016/src/main/java/p1/Problem1.kt
ununhexium
113,359,669
false
null
package p1 import more.Input import more.format import more.next import more.previous import p1.Direction.DOWN import p1.Direction.LEFT import p1.Direction.RIGHT import p1.Direction.UP import p1.Position.x import p1.Position.y import java.io.FileWriter import kotlin.math.abs import kotlin.math.ceil import kotlin.math....
6
Kotlin
0
0
d5c38e55b9574137ed6b351a64f80d764e7e61a9
3,064
adventofcode
The Unlicense