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
app/src/main/java/nerd/tuxmobil/fahrplan/congress/repositories/SessionsTransformer.kt
johnjohndoe
12,616,092
true
null
package nerd.tuxmobil.fahrplan.congress.repositories import androidx.annotation.VisibleForTesting import nerd.tuxmobil.fahrplan.congress.models.RoomData import nerd.tuxmobil.fahrplan.congress.models.ScheduleData import nerd.tuxmobil.fahrplan.congress.models.Session class SessionsTransformer @VisibleForTesting constru...
0
Kotlin
3
21
081e90400c2e9f6c0445197b654efb904cc8f3ed
3,193
CampFahrplan
Apache License 2.0
maxsubarray/src/main/kotlin/com/felipecsl/Main.kt
felipecsl
94,643,403
false
null
package com.felipecsl // https://www.hackerrank.com/challenges/maxsubarray fun main(args: Array<String>) { val totalArrays = readLine()!!.trim().toInt() val arrays = (0 until totalArrays).map { readLine() // arr length, unused readInputLine() } arrays.forEach { println("${maxContiguousSubArray(it)...
0
Kotlin
0
3
a4c07dd1531aae23d67ff52284b6fcca17b6c37c
832
hackerrank
MIT License
utility/bases/src/main/java/com/shamlou/bases/dataStructure/RadixTree.kt
keivanshamlu
453,712,116
false
{"Kotlin": 140153}
package com.shamlou.bases.dataStructure import java.util.* /** * (In the following comparisons, it is assumed that the keys are of length k * and the data structure contains n members.) */ class RadixTree<T>(private val root: Node<T> = Node(false)) { /** * checks whether tree is empty or not */ ...
0
Kotlin
0
0
631b1d7bd0997d985866f42e25db4f1cc4e11297
6,034
All-cities
Apache License 2.0
src/main/kotlin/year2021/day-14.kt
ppichler94
653,105,004
false
{"Kotlin": 182859}
package year2021 import lib.aoc.Day import lib.aoc.Part import lib.memoize fun main() { Day(14, 2021, PartA14(), PartB14()).run() } open class PartA14(private val steps: Long = 10) : Part() { private data class Counter(val data: MutableMap<Char, Long>) { constructor(text: String) : this(mutableMapOf(...
0
Kotlin
0
0
49dc6eb7aa2a68c45c716587427353567d7ea313
2,114
Advent-Of-Code-Kotlin
MIT License
aoc_2023/src/main/kotlin/problems/day11/Galaxies.kt
Cavitedev
725,682,393
false
{"Kotlin": 228779}
package problems.day11 import kotlin.math.abs class Galaxies(lines: List<String>) { val galaxiesList: List<Galaxy> init { val galaxiesMut = mutableListOf<Galaxy>() for (i in lines.indices) { val line = lines[i] for (j in line.indices) { val char = lin...
0
Kotlin
0
1
aa7af2d5aa0eb30df4563c513956ed41f18791d5
1,543
advent-of-code-2023
MIT License
src/main/kotlin/solving/Solver.kt
marrow16
426,714,749
false
{"Kotlin": 41948}
package solving import Puzzle import words.Word import java.util.* import java.util.concurrent.atomic.AtomicLong class Solver(private val puzzle: Puzzle) { private val explored = AtomicLong() private val solutions: MutableList<Solution> = ArrayList() private var beginWord: Word = puzzle.startWord priv...
0
Kotlin
0
2
b5c0db038b5d1e58e4710a8189e9205c49741010
3,903
KotlinWordLadder
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/LastStoneWeight.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2020 <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,504
kotlab
Apache License 2.0
2015/src/main/kotlin/com/koenv/adventofcode/Day6.kt
koesie10
47,333,954
false
null
package com.koenv.adventofcode class Day6Part1(val width: Int, val height: Int) { val grid: Array<Array<Int>> val numberOfLightsInOnState: Int get() = grid.sumBy { it.sum() } val numberOfLightsInOffState: Int get() = width * height - numberOfLightsInOnState init {...
0
Kotlin
0
0
29f3d426cfceaa131371df09785fa6598405a55f
3,972
AdventOfCode-Solutions-Kotlin
MIT License
kotlin/src/com/s13g/aoc/aoc2023/Day13.kt
shaeberling
50,704,971
false
{"Kotlin": 300158, "Go": 140763, "Java": 107355, "Rust": 2314, "Starlark": 245}
package com.s13g.aoc.aoc2023 import com.s13g.aoc.Result import com.s13g.aoc.Solver import com.s13g.aoc.resultFrom /** * --- Day 13: Point of Incidence --- * https://adventofcode.com/2023/day/13 */ class Day13 : Solver { override fun solve(lines: List<String>): Result { val inputs = mutableListOf(mutableListO...
0
Kotlin
1
2
7e5806f288e87d26cd22eca44e5c695faf62a0d7
1,456
euler
Apache License 2.0
src/main/kotlin/com/jacobhyphenated/day24/Day24.kt
jacobhyphenated
572,119,677
false
{"Kotlin": 157591}
package com.jacobhyphenated.day24 import com.jacobhyphenated.Day import java.io.File import kotlin.math.pow // Planet of Discord class Day24: Day<List<List<Boolean>>> { override fun getInput(): List<List<Boolean>> { return parseInputGrid( this.javaClass.classLoader.getResource("day24/input.txt...
0
Kotlin
0
0
1a0b9cb6e9a11750c5b3b5a9e6b3d63649bf78e4
7,099
advent2019
The Unlicense
project-kotlin-js/src/main/kotlin/Solver.kt
PoorLazyCoder
454,526,909
false
null
class Solver( private var g: List<String>, var y1: List<String>, var y2: List<String>, var y3: List<String>, private var gray: String ) { fun solve(): List<List<String>> { var words = getAllDicWords().toList() if (g.joinToString("").trim().isEmpty()) g = listOf() if (y1.joinToStr...
0
Kotlin
1
1
4a92e313d38dde60c11c14764825071e4c0a07ea
2,835
Wordle-Helper-Kotlin-JS
MIT License
aoc21/day_15/main.kt
viktormalik
436,281,279
false
{"Rust": 227300, "Go": 86273, "OCaml": 82410, "Kotlin": 78968, "Makefile": 13967, "Roff": 9981, "Shell": 2796}
import pathutils.Pos import pathutils.fourNeighs import pathutils.shortest import java.io.File fun neighs(pos: Pos, cave: Array<IntArray>): List<Pos> = fourNeighs(pos, 0, cave.size - 1, 0, cave[0].size - 1) fun dstFun(@Suppress("UNUSED_PARAMETER") from: Pos, to: Pos, cave: Array<IntArray>): Int = cave[to.x][t...
0
Rust
1
0
f47ef85393d395710ce113708117fd33082bab30
1,251
advent-of-code
MIT License
year2021/src/main/kotlin/net/olegg/aoc/year2021/day11/Day11.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2021.day11 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.utils.Directions.Companion.NEXT_8 import net.olegg.aoc.utils.Vector2D import net.olegg.aoc.utils.fit import net.olegg.aoc.utils.get import net.olegg.aoc.utils.set import net.olegg.aoc.year2021.DayOf2021 /** * See [Year 202...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
2,755
adventofcode
MIT License
src/chapter2/problem7/solution2.kts
neelkamath
395,940,983
false
null
/* Question: Intersection: Given two (singly) linked lists, determine if the two lists intersect. Return the intersecting node. Note that the intersection is defined based on reference, not value. That is, if the kth node of the first linked list is the exact same node (by reference) as the jth node of the second linke...
0
Kotlin
0
0
4421a061e5bf032368b3f7a4cee924e65b43f690
3,204
ctci-practice
MIT License
src/main/kotlin/days/Day4.kt
butnotstupid
433,717,137
false
{"Kotlin": 55124}
package days class Day4 : Day(4) { override fun partOne(): Any { val numberSeq = inputList[0].split(",").map { it.toLong() } val boards = inputList.drop(1).chunked(6).map { block -> block.drop(1).map { line -> line.split(" ").filter { it.isNotEmpty() }.map { it.toLong()...
0
Kotlin
0
0
a06eaaff7e7c33df58157d8f29236675f9aa7b64
3,308
aoc-2021
Creative Commons Zero v1.0 Universal
src/main/kotlin/com/groundsfam/advent/y2022/d03/Day03.kt
agrounds
573,140,808
false
{"Kotlin": 281620, "Shell": 742}
package com.groundsfam.advent.y2022.d03 import com.groundsfam.advent.DATAPATH import com.groundsfam.advent.timed import kotlin.io.path.div import kotlin.io.path.useLines fun priority(item: Char): Int = if (item in 'a'..'z') { item - 'a' + 1 } else { // it's between 'A' and 'Z' item - 'A' + 2...
0
Kotlin
0
1
c20e339e887b20ae6c209ab8360f24fb8d38bd2c
1,362
advent-of-code
MIT License
src/Day11.kt
realpacific
573,561,400
false
{"Kotlin": 59236}
class Monkey(val id: Int, operation: String, test: String) { private val itemsInHand = mutableListOf<Long>() var inspectionCount = 0 private set private lateinit var throwToFn: (Boolean) -> Int val divisibleBy by lazy { val testRegex = Regex("Test: divisible by (\\d+)").find(test)!! ...
0
Kotlin
0
0
f365d78d381ac3d864cc402c6eb9c0017ce76b8d
4,780
advent-of-code-2022
Apache License 2.0
src/test/kotlin/ch/ranil/aoc/aoc2023/Day01.kt
stravag
572,872,641
false
{"Kotlin": 234222}
package ch.ranil.aoc.aoc2023 import ch.ranil.aoc.AbstractDay import org.junit.jupiter.api.Test import kotlin.test.assertEquals class Day01 : AbstractDay() { @Test fun part1() { assertEquals(142, compute1(testInput)) assertEquals(55488, compute1(puzzleInput)) } @Test fun part2Dumm...
0
Kotlin
1
0
dbd25877071cbb015f8da161afb30cf1968249a8
1,916
aoc
Apache License 2.0
src/Day13.kt
coolcut69
572,865,721
false
{"Kotlin": 36853}
import com.beust.klaxon.JsonArray import com.beust.klaxon.Parser.Companion.default private val JSON_PARSER = default() fun main() { fun part1(inputs: List<String>): Int { var sum = 0 repeat((inputs.size + 1) / 3) { index -> val x = index * 3 val left = inputs[x + 0] ...
0
Kotlin
0
0
031301607c2e1c21a6d4658b1e96685c4135fd44
2,043
aoc-2022-in-kotlin
Apache License 2.0
forth/src/main/kotlin/Forth.kt
3mtee
98,672,009
false
null
class Forth { companion object { private val OPS: Map<String, (List<Int>) -> List<Int>> = mapOf( "+" to { require(it.size >= 2) { "tsk-tsk-tsk" } it.dropLast(2) + it.takeLast(2).sum() }, "-" to { require(it.size >= 2) { "ts...
0
Kotlin
0
0
6e3eb88cf58d7f01af2236e8d4727f3cd5840065
3,220
exercism-kotlin
Apache License 2.0
src/day12/Day12.kt
ZsemberiDaniel
159,921,870
false
null
package day12 import RunnablePuzzleSolver import java.lang.StringBuilder class Day12 : RunnablePuzzleSolver { lateinit var initialState: CharArray lateinit var transitions: Map<String, Char> override fun readInput1(lines: Array<String>) { initialState = lines[0].substring(15).toCharArray() ...
0
Kotlin
0
0
bf34b93aff7f2561f25fa6bd60b7c2c2356b16ed
4,756
adventOfCode2018
MIT License
src/main/kotlin/com/marcdenning/adventofcode/day12/Day12b.kt
marcdenning
317,730,735
false
{"Kotlin": 87536}
package com.marcdenning.adventofcode.day12 import java.io.File import kotlin.math.abs fun main(args: Array<String>) { var ship = Ship( Coordinates(0, 0, 90), Coordinates(10, 1, 0) ) File(args[0]).readLines().map { parseInstruction(it) } .forEach { ship = moveShipToWaypoint(ship, i...
0
Kotlin
0
0
b227acb3876726e5eed3dcdbf6c73475cc86cbc1
3,429
advent-of-code-2020
MIT License
src/main/kotlin/day25.kt
gautemo
433,582,833
false
{"Kotlin": 91784}
import shared.Point import shared.XYMap import shared.getText fun cucumbersStopsAt(input: String): Int{ val bottom = CucumbersMap(input) return bottom.waitForCucumbersToStop() } open class CucumberSpace data class Cucumber(val eastDir: Boolean) : CucumberSpace(){ fun next(current: Point, width: Int, heigh...
0
Kotlin
0
0
c50d872601ba52474fcf9451a78e3e1bcfa476f7
1,855
AdventOfCode2021
MIT License
src/Day03.kt
thiyagu06
572,818,472
false
{"Kotlin": 17748}
import java.io.File fun main() { fun parseInput(file: String): List<String> { return File(file).readLines() } fun Char.priority(): Int { return when (this) { in 'a'..'z' -> this - 'a' + 1 in 'A'..'Z' -> this - 'A' + 27 else -> 0 } } fun...
0
Kotlin
0
0
55a7acdd25f1a101be5547e15e6c1512481c4e21
951
aoc-2022
Apache License 2.0
src/main/kotlin/nl/kelpin/fleur/advent2018/Day06.kt
fdlk
159,925,533
false
null
package nl.kelpin.fleur.advent2018 class Day06(input: List<String>) { val points: List<Point> = input.map { Point(it) } val xRange: IntRange = points.map { it.x }.range() val yRange: IntRange = points.map { it.y }.range() private val pointsWithInfiniteArea: Set<Point> = rectangle().filter(:...
0
Kotlin
0
3
a089dbae93ee520bf7a8861c9f90731eabd6eba3
1,191
advent-2018
MIT License
year2017/src/main/kotlin/net/olegg/aoc/year2017/day25/Day25.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2017.day25 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.year2017.DayOf2017 /** * See [Year 2017, Day 25](https://adventofcode.com/2017/day/25) */ object Day25 : DayOf2017(25) { private val HEADER_PATTERN = ( "Begin in state ([A-Z]+)\\.\\n" + "Perform a diagnostic c...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
1,968
adventofcode
MIT License
src/Day01.kt
Riari
574,587,661
false
{"Kotlin": 83546, "Python": 1054}
fun main() { // Processes input into a list of total calories per elf in descending order fun processInput(input: List<String>): List<Int> { val elves = mutableListOf<Int>() var total = 0 input.forEach { val calories = it.toIntOrNull() if (calories == null) { ...
0
Kotlin
0
0
8eecfb5c0c160e26f3ef0e277e48cb7fe86c903d
939
aoc-2022
Apache License 2.0
src/Day04.kt
mborromeo
571,999,097
false
{"Kotlin": 10600}
fun main() { fun sectionsData(it: String): List<Int> { return it.split(",").map{ it.split("-").map { it.toInt() } }.flatten() } fun part1(input: List<String>): Int { return input.count { val (a, b, c, d) = sectionsData(it) ...
0
Kotlin
0
0
d01860ecaff005aaf8e1e4ba3777a325a84c557c
680
advent-of-code-kotlin-2022
Apache License 2.0
src/main/kotlin/g1401_1500/s1438_longest_continuous_subarray_with_absolute_diff_less_than_or_equal_to_limit/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g1401_1500.s1438_longest_continuous_subarray_with_absolute_diff_less_than_or_equal_to_limit // #Medium #Array #Heap_Priority_Queue #Sliding_Window #Ordered_Set #Queue #Monotonic_Queue // #2023_06_07_Time_479_ms_(75.00%)_Space_50.3_MB_(100.00%) import java.util.ArrayDeque class Solution { fun longestSubar...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,250
LeetCode-in-Kotlin
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/CountBinarySubstrings.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2021 <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,971
kotlab
Apache License 2.0
src/day5/result.kt
davidcurrie
437,645,413
false
{"Kotlin": 37294}
package day5 import java.io.File import kotlin.math.absoluteValue import kotlin.math.max import kotlin.math.sign data class Line(val x1: Int, val y1: Int, val x2: Int, val y2: Int) fun main() { val input = File("src/day5/input.txt").readLines() val regex = Regex("([0-9]*),([0-9]*) -> ([0-9]*),([0-9]*)") ...
0
Kotlin
0
0
dd37372420dc4b80066efd7250dd3711bc677f4c
1,100
advent-of-code-2021
MIT License
src/main/kotlin/de/consuli/aoc/year2022/days/Day09.kt
ulischulte
572,773,554
false
{"Kotlin": 40404}
package de.consuli.aoc.year2022.days import de.consuli.aoc.common.Day import de.consuli.aoc.util.Point import de.consuli.aoc.util.Point.Companion.printMatrixContainingPoints class Day09 : Day(9, 2022) { private val movesTestInput: List<String> private val moves: List<String> init { moves = readM...
0
Kotlin
0
2
21e92b96b7912ad35ecb2a5f2890582674a0dd6a
1,929
advent-of-code
Apache License 2.0
src/main/kotlin/nl/tue/setschematics/util/Support.kt
stenwessel
316,495,569
false
{"Java": 137813, "Kotlin": 123105}
package nl.tue.setschematics.util import nl.hannahsten.utensils.collections.forEachPair import nl.hannahsten.utensils.math.matrix.distanceTo import nl.tue.setschematics.Data import nl.tue.setschematics.grid.Grid import nl.tue.setschematics.grid.GridLocation import nl.tue.setschematics.hypergraph.Vertex import nl.tue.s...
0
Java
0
0
7e26b70cb0054006897b2b0118024ee34794ab30
2,067
setschematics
MIT License
src/main/kotlin/io/paly/esetsalaryslipparser/statistics/IncomeStatistics.kt
PaLy
437,696,484
false
{"Kotlin": 14570}
package io.paly.esetsalaryslipparser.statistics import io.paly.esetsalaryslipparser.format.format import io.paly.esetsalaryslipparser.format.width import io.paly.esetsalaryslipparser.parser.WageIncome import io.paly.esetsalaryslipparser.print.Printer import kotlin.math.max import kotlin.math.min class IncomeStatistic...
0
Kotlin
0
0
9e841fad768dcc07dcbe6d80b220d8194eca3876
2,776
eset-salary-slips
MIT License
code-sample-kotlin/algorithms/src/main/kotlin/com/codesample/algo/unions.kt
aquatir
76,377,920
false
{"Java": 674809, "Python": 143889, "Kotlin": 112192, "Haskell": 57852, "Elixir": 33284, "TeX": 20611, "Scala": 17065, "Dockerfile": 6314, "HTML": 4714, "Shell": 387, "Batchfile": 316, "Erlang": 269, "CSS": 97}
package com.codesample.algo abstract class Union<T>() { /** Make two elements point to same union */ abstract fun union(fst: T, snd: T) /** Return true if two elements are connected or false otherwise. Same elements are always considered connected */ abstract fun connected(fst: T, snd: T): Boolean } ...
1
Java
3
6
eac3328ecd1c434b1e9aae2cdbec05a44fad4430
6,490
code-samples
MIT License
src/main/kotlin/ru/glukhov/aoc/Day5.kt
cobaku
576,736,856
false
{"Kotlin": 25268}
package ru.glukhov.aoc import java.io.BufferedReader import java.util.stream.Collectors private data class Command(val count: Int, val source: Int, val destination: Int) private class Cargo(private val space: List<ArrayDeque<String>>) { fun execute(cmd: Command) { val source = space[cmd.source] ...
0
Kotlin
0
0
a40975c1852db83a193c173067aba36b6fe11e7b
3,374
aoc2022
MIT License
2021/src/main/kotlin/de/skyrising/aoc2021/day10/solution.kt
skyrising
317,830,992
false
{"Kotlin": 411565}
package de.skyrising.aoc2021.day10 import de.skyrising.aoc.* import it.unimi.dsi.fastutil.longs.LongArrayList val test = TestInput(""" [({(<(())[]>[[{[]{<()<>> [(()[<>])]({[<{<<[]>>( {([(<{}[<>[]}>{[]{[(<()> (((({<>}<{<{<>}{[]{[]{} [[<[([]))<([[{}[[()]]] [{[{({}]{}}([{[{{{}}([] {<[[]]>}<{[...
0
Kotlin
0
0
19599c1204f6994226d31bce27d8f01440322f39
2,183
aoc
MIT License
src/main/kotlin/com/groundsfam/advent/y2015/d07/Day07.kt
agrounds
573,140,808
false
{"Kotlin": 281620, "Shell": 742}
package com.groundsfam.advent.y2015.d07 import com.groundsfam.advent.DATAPATH import kotlin.io.path.div import kotlin.io.path.useLines val MAX_SIGNAL = 0x10000.toUInt() typealias Signal = UInt infix fun Signal.shiftLeft(amount: Int) = shl(amount) % MAX_SIGNAL infix fun Signal.shiftRight(amount: Int) = shr(amount) fu...
0
Kotlin
0
1
c20e339e887b20ae6c209ab8360f24fb8d38bd2c
3,559
advent-of-code
MIT License
src/nativeMain/kotlin/com.qiaoyuang.algorithm/special/Questions75.kt
qiaoyuang
100,944,213
false
{"Kotlin": 338134}
package com.qiaoyuang.algorithm.special fun test75() { printlnResult( array = intArrayOf(2, 3, 3, 7, 3, 9, 2, 1, 7, 2), comparator = intArrayOf(3, 2, 1), ) } /** * Questions 75: */ private fun sortArrayWithOther(array: IntArray, comparator: IntArray): IntArray { val comparatorMap = build...
0
Kotlin
3
6
66d94b4a8fa307020d515d4d5d54a77c0bab6c4f
1,084
Algorithm
Apache License 2.0
src/main/kotlin/Day1.kt
d1snin
726,126,205
false
{"Kotlin": 14602}
/* * 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 wr...
0
Kotlin
0
0
8b5b34c4574627bb3c6b1a12664cc6b4c9263e30
2,575
aoc-2023
Apache License 2.0
utils/common/src/main/kotlin/Utils.kt
edulix
387,533,227
true
{"Kotlin": 3735276, "JavaScript": 265776, "HTML": 115254, "Haskell": 30438, "CSS": 24947, "Python": 20673, "FreeMarker": 16268, "Shell": 12654, "Dockerfile": 12222, "Roff": 7585, "Scala": 6656, "Ruby": 4423, "ANTLR": 1883, "Go": 1235, "Rust": 280, "Emacs Lisp": 191}
/* * Copyright (C) 2017-2019 HERE Europe B.V. * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
5
Kotlin
0
0
65e7b34f5106c08589b5e4f42f9a349d1290ae9b
4,102
ort
Apache License 2.0
src/array/LeetCode238.kt
Alex-Linrk
180,918,573
false
null
package array /** * 给定长度为 n 的整数数组 nums,其中 n > 1,返回输出数组 output ,其中 output[i] 等于 nums 中除 nums[i] 之外其余各元素的乘积。 * *示例: * *输入: [1,2,3,4] *输出: [24,12,8,6] *说明: 请不要使用除法,且在 O(n) 时间复杂度内完成此题。 * *进阶: *你可以在常数空间复杂度内完成这个题目吗?( 出于对空间复杂度分析的目的,输出数组不被视为额外空间。) * *来源:力扣(LeetCode) *链接:https://leetcode-cn.com/problems/product-of...
0
Kotlin
0
0
59f4ab02819b7782a6af19bc73307b93fdc5bf37
1,202
LeetCode
Apache License 2.0
src/main/kotlin/com/dvdmunckhof/aoc/event2023/Day01.kt
dvdmunckhof
318,829,531
false
{"Kotlin": 195848, "PowerShell": 1266}
package com.dvdmunckhof.aoc.event2023 class Day01(private val input: List<String>) { fun solvePart1(): Int { return input.sumOf { line -> line.first(Char::isDigit).digitToInt() * 10 + line.last(Char::isDigit).digitToInt() } } fun solvePart2(): Int { val digits = arrayO...
0
Kotlin
0
0
025090211886c8520faa44b33460015b96578159
922
advent-of-code
Apache License 2.0
advent-of-code-2022/src/main/kotlin/year_2022/Day02.kt
rudii1410
575,662,325
false
{"Kotlin": 37749}
package year_2022 import util.Runner fun main() { fun part1(input: List<String>): Int { val shapeScore = mapOf( 'X' to 1, 'Y' to 2, 'Z' to 3 ) val gameScore = mapOf( "A Y" to 6, "B Z" to 6, "C X" to 6, "A X...
1
Kotlin
0
0
ab63e6cd53746e68713ddfffd65dd25408d5d488
1,023
advent-of-code
Apache License 2.0
src/main/kotlin/leetcode/Problem2002.kt
fredyw
28,460,187
false
{"Java": 1280840, "Rust": 363472, "Kotlin": 148898, "Shell": 604}
package leetcode import kotlin.math.max /** * https://leetcode.com/problems/maximum-product-of-the-length-of-two-palindromic-subsequences/ */ class Problem2002 { fun maxProduct(s: String): Int { return maxProduct(s, 0, "", "") } private fun maxProduct(s: String, i: Int, word1: String, word2: St...
0
Java
1
4
a59d77c4fd00674426a5f4f7b9b009d9b8321d6d
994
leetcode
MIT License
presentation/javagilde/code/src/main/kotlin/javagilde/final.kt
fifth-postulate
325,780,327
false
{"Java": 31591, "Elm": 28872, "Kotlin": 20652, "JavaScript": 16757, "Python": 13953, "HTML": 5089, "CSS": 1346, "Makefile": 1194}
package javagilde // We willen expressies parsen, d.w.z 5*2 + 1 sealed class Expression { abstract fun evaluate(): Int } data class Multiplication(val left: Expression, val right: Expression): Expression() { override fun evaluate(): Int = left.evaluate() * right.evaluate() } data class Addition(val ...
3
Java
0
0
61f2c626d6303d88b4b919a1b85a17d6e7290e7d
3,611
parser-combinators
MIT License
src/main/kotlin/com/keithwedinger/Day3.kt
jkwuc89
112,970,285
false
null
package com.keithwedinger import kotlin.math.abs import kotlin.math.ceil import kotlin.math.pow import kotlin.math.sqrt /** * Day 3 Puzzle * http://adventofcode.com/2017/day/3 * * @author <NAME> <br> * Created On: 12/6/17 */ class Day3 { fun getSpiralMemoryAccessSteps(input: Int) : Int { if (input =...
0
Kotlin
0
0
3b88f64a498e4640b021cc91160a5adfcb01d0ec
3,193
adventofcode
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/CheckStraightLine.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
1,747
kotlab
Apache License 2.0
src/main/kotlin/recur/Target.kt
yx-z
106,589,674
false
null
package recur import util.* import java.lang.Math.floor // given a list of distinct heights of people H[1..n] // a shorter guy can aim his/her gun @ his/her neighbor! // a taller guy can aim @ the first one who is even taller than him/her // return l[1..n], r[1..n] where l represents the index who can target to the l...
0
Kotlin
0
1
15494d3dba5e5aa825ffa760107d60c297fb5206
2,062
AlgoKt
MIT License
Retos/Reto #4 - PRIMO, FIBONACCI Y PAR [Media]/kotlin/masdos.kt
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": ...
fun main() { /* * Escribe un programa que, dado un número, compruebe y muestre si es primo, fibonacci y par. * Ejemplos: * - Con el número 2, nos dirá: "2 es primo, fibonacci y es par" * - Con el número 7, nos dirá: "7 es primo, no es fibonacci y es impar" */ println(describeNumber(2)) println(de...
4
Python
2,929
4,661
adcec568ef7944fae3dcbb40c79dbfb8ef1f633c
1,330
retos-programacion-2023
Apache License 2.0
src/Day09.kt
vi-quang
573,647,667
false
{"Kotlin": 49703}
import kotlin.math.abs /** * Main ------------------------------------------------------------------- */ fun main() { fun Int.toIdentity(): Int { if (this == 0) { return 0 } if (this < 1) { return -1 } else { return 1 } } fun ...
0
Kotlin
0
2
ae153c99b58ba3749f16b3fe53f06a4b557105d3
2,670
aoc-2022
Apache License 2.0
src/main/kotlin/g2301_2400/s2376_count_special_integers/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g2301_2400.s2376_count_special_integers // #Hard #Dynamic_Programming #Math #2023_07_02_Time_125_ms_(100.00%)_Space_32.8_MB_(100.00%) @Suppress("NAME_SHADOWING") class Solution { private lateinit var cntMap: IntArray // number n as an array, splitted by each digit private lateinit var digits: IntA...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,739
LeetCode-in-Kotlin
MIT License
2k23/aoc2k23/src/main/kotlin/20.kt
papey
225,420,936
false
{"Rust": 88237, "Kotlin": 63321, "Elixir": 54197, "Crystal": 47654, "Go": 44755, "Ruby": 24620, "Python": 23868, "TypeScript": 5612, "Scheme": 117}
package d20 import input.read fun main() { println("Part 1: ${part1(read("20.txt"))}") println("Part 2: ${part2(read("20.txt"))}") } fun part1(input: List<String>): Int { val modules = parseInput(input) val counter = Counter() repeat(1000) { press(modules, counter) } return coun...
0
Rust
0
3
cb0ea2fc043ebef75aff6795bf6ce8a350a21aa5
4,473
aoc
The Unlicense
src/main/kotlin/cloud/dqn/leetcode/MergeTwoSortedLists.kt
aviuswen
112,305,062
false
null
package cloud.dqn.leetcode /** * https://leetcode.com/problems/merge-two-sorted-lists/description/ * Merge two sorted linked lists and return it as a new list. * The new list should be made by splicing together the nodes * of the first two lists. * * Definition for singly-linked list. * class ListNode(var `va...
0
Kotlin
0
0
23458b98104fa5d32efe811c3d2d4c1578b67f4b
2,000
cloud-dqn-leetcode
No Limit Public License
year2023/src/main/kotlin/net/olegg/aoc/year2023/day3/Day3.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2023.day3 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.utils.Directions.Companion.NEXT_8 import net.olegg.aoc.utils.Vector2D import net.olegg.aoc.utils.get import net.olegg.aoc.year2023.DayOf2023 /** * See [Year 2023, Day 3](https://adventofcode.com/2023/day/3) */ object Day3 ...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
1,562
adventofcode
MIT License
src/aoc2022/Day03.kt
FluxCapacitor2
573,641,929
false
{"Kotlin": 56956}
package aoc2022 import Day import intersect object Day03 : Day(2022, 3) { override fun part1() { val sum = lines.sumOf { line -> // Split each line/rucksack into two halves val (firstHalf, secondHalf) = line.chunked(line.length / 2) // Find the common character between...
0
Kotlin
0
0
a48d13763db7684ee9f9129ee84cb2f2f02a6ce4
1,407
advent-of-code-2022
Apache License 2.0
kotlin/dp/MaxPalindrome.kt
polydisc
281,633,906
true
{"Java": 540473, "Kotlin": 515759, "C++": 265630, "CMake": 571}
package dp import numeric.FFT import optimization.Simplex // Find maximum palindromic subsequence of the given string object MaxPalindrome { fun maxPalindrome(p: String): String { val n: Int = p.length() val s: CharArray = p.toCharArray() val dp = Array(n + 1) { IntArray(n + 1) } f...
1
Java
0
0
4566f3145be72827d72cb93abca8bfd93f1c58df
1,741
codelibrary
The Unlicense
src/main/kotlin/com/jacobhyphenated/advent2022/day20/Day20.kt
jacobhyphenated
573,603,184
false
{"Kotlin": 144303}
package com.jacobhyphenated.advent2022.day20 import com.jacobhyphenated.advent2022.Day import kotlin.math.absoluteValue /** * Day 20: Grove Positioning System * * Decrypt the coordinates using a custom move encryption. * * The puzzle input is an array of values that represents a circular list. * Using the origi...
0
Kotlin
0
0
9f4527ee2655fedf159d91c3d7ff1fac7e9830f7
4,671
advent2022
The Unlicense
src/main/kotlin/euclidea/Numeric.kt
jedwidz
589,137,278
false
null
package euclidea import kotlin.math.max import kotlin.math.min import kotlin.math.sign fun solveByBisection(o1: Double, o2: Double, f: (Double) -> Double): Double { var x1 = min(o1, o2) var x2 = max(o1, o2) val so1 = sign(f(x1)) val so2 = sign(f(x2)) if (so1 == 0.0) return x1 if (so2 =...
0
Kotlin
0
1
70f7a397bd6abd0dc0d6c295ba9625e6135b2167
1,288
euclidea-solver
MIT License
src/chapter3/section1/ex4.kt
w1374720640
265,536,015
false
{"Kotlin": 1373556}
package chapter3.section1 import extensions.shuffle import java.util.* /** * 开发抽象数据类型Time和Event来处理表3.1.5中的例子中的数据 * * 解:自定义可以比较的Time类,Event类直接用String类代替 */ fun main() { val inputArray = arrayOf( Time("09:00:00") to "Chicago", Time("09:00:03") to "Phoenix", Time("09:00:13") t...
0
Kotlin
1
6
879885b82ef51d58efe578c9391f04bc54c2531d
2,940
Algorithms-4th-Edition-in-Kotlin
MIT License
src/main/kotlin/g1101_1200/s1187_make_array_strictly_increasing/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g1101_1200.s1187_make_array_strictly_increasing // #Hard #Array #Dynamic_Programming #Binary_Search // #2023_05_25_Time_308_ms_(100.00%)_Space_41.1_MB_(100.00%) class Solution { fun makeArrayIncreasing(arr1: IntArray, arr2: IntArray): Int { arr2.sort() var start = 0 for (i in arr2....
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,522
LeetCode-in-Kotlin
MIT License
src/aoc22/Day10.kt
mihassan
575,356,150
false
{"Kotlin": 123343}
@file:Suppress("PackageDirectoryMismatch") package aoc22.day10 import lib.Solution sealed interface Instruction { object Noop : Instruction data class AddX(val value: Int) : Instruction companion object { fun parse(line: String): Instruction = when { line.startsWith("noop") -> Noop line.starts...
0
Kotlin
0
0
698316da8c38311366ee6990dd5b3e68b486b62d
2,105
aoc-kotlin
Apache License 2.0
kotlin/src/com/s13g/aoc/aoc2023/Day16.kt
shaeberling
50,704,971
false
{"Kotlin": 300158, "Go": 140763, "Java": 107355, "Rust": 2314, "Starlark": 245}
package com.s13g.aoc.aoc2023 import com.s13g.aoc.Result import com.s13g.aoc.Solver import com.s13g.aoc.XY import com.s13g.aoc.add import com.s13g.aoc.resultFrom import kotlin.math.max /** * --- Day 16: The Floor Will Be Lava --- * https://adventofcode.com/2023/day/16 */ class Day16 : Solver { override fun solve(...
0
Kotlin
1
2
7e5806f288e87d26cd22eca44e5c695faf62a0d7
2,740
euler
Apache License 2.0
src/Day16.kt
palex65
572,937,600
false
{"Kotlin": 68582}
@file:Suppress("PackageDirectoryMismatch") package day16 import readInput import java.util.PriorityQueue import kotlin.math.* const val INT = """(\d+)""" const val NAME = """([A-Z]+)""" const val REST = """([A-Z, ]+)""" val valvePattern = Regex("""Valve $NAME has flow rate=$INT; tunnels? leads? to valves? $REST$""") ...
0
Kotlin
0
2
35771fa36a8be9862f050496dba9ae89bea427c5
4,832
aoc2022
Apache License 2.0
src/main/kotlin/nl/dirkgroot/adventofcode/year2020/Day12.kt
dirkgroot
317,968,017
false
{"Kotlin": 187862}
package nl.dirkgroot.adventofcode.year2020 import nl.dirkgroot.adventofcode.util.Input import nl.dirkgroot.adventofcode.util.Puzzle import java.lang.IllegalStateException import kotlin.math.abs class Day12(input: Input) : Puzzle() { private val instructions by lazy { input.lines().map { it[0] to it.substring(1).t...
1
Kotlin
1
1
ffdffedc8659aa3deea3216d6a9a1fd4e02ec128
2,172
adventofcode-kotlin
MIT License
src/main/kotlin/io/nozemi/aoc/solutions/year2020/day02/PasswordPhilosophy.kt
Nozemi
433,882,587
false
{"Kotlin": 92614, "Shell": 421}
package io.nozemi.aoc.solutions.year2020.day02 import io.nozemi.aoc.puzzle.Puzzle import io.nozemi.aoc.utils.countChar import java.util.regex.Pattern import kotlin.reflect.KFunction0 class PasswordPhilosophy(input: String) : Puzzle<List<String>>(input) { override fun Sequence<String>.parse(): List<String> = this...
0
Kotlin
0
0
fc7994829e4329e9a726154ffc19e5c0135f5442
2,261
advent-of-code
MIT License
src/main/kotlin/sschr15/aocsolutions/util/Algo.kt
sschr15
317,887,086
false
{"Kotlin": 184127, "TeX": 2614, "Python": 446}
package sschr15.aocsolutions.util import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap import sschr15.aocsolutions.util.watched.WatchedLong import java.math.BigInteger import java.util.* import kotlin.math.absoluteValue typealias BigPoint = Pair<WatchedLong, WatchedLong> typealias BiggerPoint = Pair<BigInteger,...
0
Kotlin
0
0
e483b02037ae5f025fc34367cb477fabe54a6578
2,444
advent-of-code
MIT License
src/main/kotlin/biz/koziolek/adventofcode/year2022/day09/day9.kt
pkoziol
434,913,366
false
{"Kotlin": 715025, "Shell": 1892}
package biz.koziolek.adventofcode.year2022.day09 import biz.koziolek.adventofcode.Coord import biz.koziolek.adventofcode.findInput import kotlin.math.abs import kotlin.math.max import kotlin.math.min import kotlin.math.sign fun main() { val inputFile = findInput(object {}) val moves = parseMoves(inputFile.buf...
0
Kotlin
0
0
1b1c6971bf45b89fd76bbcc503444d0d86617e95
5,400
advent-of-code
MIT License
src/main/kotlin/days_2020/Day10.kt
BasKiers
434,124,805
false
{"Kotlin": 40804}
package days_2020 import util.Day class Day10 : Day(10, 2020) { val input = inputList.map(String::toInt).let { list -> list + 0 + (list.maxOf { it } + 3) }.sorted() override fun partOne(): Any { val groups = input.zipWithNext().groupBy { (a, b) -> b - a } return groups[1]!!.size * (groups[3]!...
0
Kotlin
0
0
870715c172f595b731ee6de275687c2d77caf2f3
1,433
advent-of-code-2021
Creative Commons Zero v1.0 Universal
src/main/kotlin/g2401_2500/s2421_number_of_good_paths/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g2401_2500.s2421_number_of_good_paths // #Hard #Array #Tree #Graph #Union_Find #2023_07_04_Time_909_ms_(100.00%)_Space_65.8_MB_(100.00%) class Solution { fun numberOfGoodPaths(vals: IntArray, edges: Array<IntArray>): Int { val n = vals.size val parent = IntArray(n) val maxElement =...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,322
LeetCode-in-Kotlin
MIT License
advent/src/test/kotlin/org/elwaxoro/advent/y2021/Dec20.kt
elwaxoro
328,044,882
false
{"Kotlin": 376774}
package org.elwaxoro.advent.y2021 import org.elwaxoro.advent.Coord import org.elwaxoro.advent.PuzzleDayTester import org.elwaxoro.advent.bounds /** * Trench Map */ class Dec20 : PuzzleDayTester(20, 2021) { override fun part1(): Any = glowUpLikeALot(2).size override fun part2(): Any = glowUpLikeALot(50).siz...
0
Kotlin
4
0
1718f2d675f637b97c54631cb869165167bc713c
2,094
advent-of-code
MIT License
advent-of-code-2021/src/code/day10/Main.kt
Conor-Moran
288,265,415
false
{"Kotlin": 53347, "Java": 14161, "JavaScript": 10111, "Python": 6625, "HTML": 733}
package code.day10 import java.io.File import java.util.* fun main() { doIt("Day 10 Part 1: Test Input", "src/code/day10/test.input", part1) doIt("Day 10 Part 1: Real Input", "src/code/day10/part1.input", part1) doIt("Day 10 Part 2: Test Input", "src/code/day10/test.input", part2); doIt("Day 10 Part 2...
0
Kotlin
0
0
ec8bcc6257a171afb2ff3a732704b3e7768483be
3,457
misc-dev
MIT License
src/chapter4/section2/ex23_StrongComponent.kt
w1374720640
265,536,015
false
{"Kotlin": 1373556}
package chapter4.section2 import edu.princeton.cs.algs4.Bag import edu.princeton.cs.algs4.Queue /** * 强连通分量 * 设计一种线性时间的算法来计算给定顶点v所在的强连通分量。 * 在这个算法的基础上设计一种平方时间的算法来计算有向图的所有强连通分量。 * * 解:遍历所有顶点,标记可以从顶点v到达的所有顶点 * 获取有向图的反向图GR,遍历所有顶点,标记可以从顶点v到达的所有顶点 * 在两张图中同时被标记为可达的顶点在顶点v的强连通分量中 */ class StrongComponentSingleVertex(...
0
Kotlin
1
6
879885b82ef51d58efe578c9391f04bc54c2531d
2,402
Algorithms-4th-Edition-in-Kotlin
MIT License
src/year2022/day04/Day04.kt
lukaslebo
573,423,392
false
{"Kotlin": 222221}
package year2022.day04 import check import readInput fun main() { // test if implementation meets criteria from the description, like: val testInput = readInput("2022", "Day04_test") check(part1(testInput), 2) check(part2(testInput), 4) val input = readInput("2022", "Day04") println(part1(inp...
0
Kotlin
0
1
f3cc3e935bfb49b6e121713dd558e11824b9465b
1,068
AdventOfCode
Apache License 2.0
src/main/kotlin/datastructures/trees/trie/Trie.kt
amykv
538,632,477
false
{"Kotlin": 169929}
package datastructures.trees.trie fun main() { val trie = Trie() trie.insert("cooling") trie.insert("cool") println(trie.root.children['c']!!.children['e']?.children) println(trie.delete("cool")) println(trie.findWord("cool")) println(trie.root.children['c']!!.children['o']?.children) } cl...
0
Kotlin
0
2
93365cddc95a2f5c8f2c136e5c18b438b38d915f
1,780
dsa-kotlin
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/KnightDialer.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,846
kotlab
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/ValidateBinarySearchTree.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2021 <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
4,170
kotlab
Apache License 2.0
src/main/kotlin/day4.kt
Gitvert
433,947,508
false
{"Kotlin": 82286}
fun day4() { val lines: List<String> = readFile("day04.txt") day4part1(lines) day4part2(lines) } fun day4part1(lines: List<String>) { val bingoNumbers: List<Int> = lines[0].split(",").map { Integer.valueOf(it) } val bingoCards = createBingoCards(lines.subList(2, lines.size-1)) val answer = p...
0
Kotlin
0
0
02484bd3bcb921094bc83368843773f7912fe757
3,423
advent_of_code_2021
MIT License
src/main/kotlin/abc/191-e.kt
kirimin
197,707,422
false
null
package abc import java.util.* fun main(args: Array<String>) { val sc = Scanner(System.`in`) val n = sc.nextInt() val m = sc.nextInt() val abc = (0 until m).map { Triple(sc.next().toInt(), sc.next().toInt(), sc.next().toInt()) } println(problem191e(n, m, abc)) } fun problem191e(n: Int, m: Int, ab...
0
Kotlin
1
5
23c9b35da486d98ab80cc56fad9adf609c41a446
1,976
AtCoderLog
The Unlicense
src/day10/Day10.kt
HGilman
572,891,570
false
{"Kotlin": 109639, "C++": 5375, "Python": 400}
package day10 import readInput fun main() { val day = 10 val testInput = readInput("day$day/testInput") check(part1(testInput) == 13140) val input = readInput("day$day/input") println(part1(input)) part2(input) } sealed class Command(val cycles: Int) object Noop : Command(1) class AddX(val x...
0
Kotlin
0
1
d05a53f84cb74bbb6136f9baf3711af16004ed12
2,027
advent-of-code-2022
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/PacificAtlanticWaterFlow.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2021 <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
4,246
kotlab
Apache License 2.0
src/main/kotlin/me/peckb/aoc/_2023/calendar/day18/Day18.kt
peckb1
433,943,215
false
{"Kotlin": 956135}
package me.peckb.aoc._2023.calendar.day18 import me.peckb.aoc._2023.calendar.day18.Day18.Direction.* import javax.inject.Inject import me.peckb.aoc.generators.InputGenerator.InputGeneratorFactory class Day18 @Inject constructor( private val generatorFactory: InputGeneratorFactory, ) { fun partOne(filename: Strin...
0
Kotlin
1
3
2625719b657eb22c83af95abfb25eb275dbfee6a
2,493
advent-of-code
MIT License
kotlin/src/main/kotlin/adventofcode/y2018/Day2.kt
3ygun
115,948,057
false
null
package adventofcode.y2018 import adventofcode.DataLoader import adventofcode.Day object Day2 : Day { val STAR1_DATA = DataLoader.readLinesFromFor("/y2018/Day2Star1.txt") val STAR2_DATA = DataLoader.readLinesFromFor("/y2018/Day2Star2.txt") override val day: Int = 2 override fun star1Run(): String { ...
0
Kotlin
0
0
69f95bca3d22032fba6ee7d9d6ec307d4d2163cf
2,837
adventofcode
MIT License
src/main/kotlin/Day22.kt
clechasseur
318,029,920
false
null
object Day22 { private val deck1 = listOf( 24, 22, 26, 6, 14, 19, 27, 17, 39, 34, 40, 41, 23, 30, 36, 11, 28, 3, 10, 21, 9, 50, 32, ...
0
Kotlin
0
0
6173c9da58e3118803ff6ec5b1f1fc1c134516cb
3,216
adventofcode2020
MIT License
books/grokking-algorithms/recursion/Recursion.kts
eng-mohamedalmahdy
450,924,598
false
{"Kotlin": 9454}
fun factorial(x:Int):Int{ var res = 1 repeat(x){ res *= it+1 } return res } // fact(x) = x * fact(x-1) // fact(0 & 1) = 1 fun factorial(x: Int): Int { if (x == 1 || x == 0) return 1 return x * factorial(x - 1) } val x = factorial(3) fun pow(base: Int, power: Int): Int { var res = 1 repeat(...
0
Kotlin
0
7
88b9f0593d3b4dc1d4a0a89f8907fd218ece3393
592
meow-readings
Apache License 2.0
day18/Kotlin/day18.kt
Ad0lphus
353,610,043
false
{"C++": 195638, "Python": 139359, "Kotlin": 80248}
import java.io.* fun print_day_18() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 18" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Snailfish -c -f small") val re...
0
C++
0
0
02f219ea278d85c7799d739294c664aa5a47719a
4,919
AOC2021
Apache License 2.0
src/aoc2022/Day13.kt
anitakar
576,901,981
false
{"Kotlin": 124382}
package aoc2022 import org.json.JSONArray import println import readInput fun main() { fun inRightOrder(left: List<Any>, right: List<Any>): Pair<Boolean, Boolean> { for (i in left.indices) { if (i >= right.size) { return Pair(false, true) } if (left[i]...
0
Kotlin
0
1
50998a75d9582d4f5a77b829a9e5d4b88f4f2fcf
4,941
advent-of-code-kotlin
Apache License 2.0
src/main/kotlin/fp/kotlin/example/chapter06/solution/6-4-treeInsertTailrec.kt
funfunStory
101,662,895
false
null
package fp.kotlin.example.chapter06.solution import fp.kotlin.example.chapter05.FunStream import fp.kotlin.example.chapter05.addHead import fp.kotlin.example.chapter05.funStreamOf /** * * 연습문제 6-4 * * SOF가 일어나지 않도록 insertTailrec을 작성해보자. * * 힌트 : 함수의 선언 타입은 아래와 같다. * 필요하다면 내부 함수를 별도로 생성하자. * */ fun mai...
1
Kotlin
23
39
bb10ea01d9f0e1b02b412305940c1bd270093cb6
3,493
fp-kotlin-example
MIT License
src/main/kotlin/com/hj/leetcode/kotlin/problem23/Solution2.kt
hj-core
534,054,064
false
{"Kotlin": 619841}
package com.hj.leetcode.kotlin.problem23 import com.hj.leetcode.kotlin.common.model.ListNode /** * LeetCode page: [23. Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/); */ class Solution2 { /* Complexity: * Time O(NLogK) and Space O(LogK) where N is the total nodes of lists and K ...
1
Kotlin
0
1
14c033f2bf43d1c4148633a222c133d76986029c
1,711
hj-leetcode-kotlin
Apache License 2.0
src/main/kotlin/ru/timakden/aoc/year2015/Day16.kt
timakden
76,895,831
false
{"Kotlin": 321649}
package ru.timakden.aoc.year2015 import arrow.core.Option import arrow.core.none import arrow.core.some import arrow.core.tail import ru.timakden.aoc.util.measure import ru.timakden.aoc.util.readInput import ru.timakden.aoc.year2015.Day16.Aunt.Compound.* /** * [Day 16: Aunt Sue](https://adventofcode.com/2015/day/16)...
0
Kotlin
0
3
acc4dceb69350c04f6ae42fc50315745f728cce1
5,128
advent-of-code
MIT License
src/Day21.kt
MartinsCode
572,817,581
false
{"Kotlin": 77324}
fun parseName(text: String): String { return text.split(": ")[0] } fun parseTask(text: String): String { return text.split(": ")[1] } fun isOperation(text: String): Boolean { return (text.contains(" + ") || text.contains(" - ") || text.contains(" * ") || text.contains(" / ")) } fun findOperand1(calc: Str...
0
Kotlin
0
0
1aedb69d80ae13553b913635fbf1df49c5ad58bd
5,745
AoC-2022-12-01
Apache License 2.0
src/Day01.kt
sungi55
574,867,031
false
{"Kotlin": 23985}
fun main() { val day = "Day01" fun part1(input: String): Int = input.sumTopOfCalories(1) fun part2(input: String): Int = input.sumTopOfCalories(3) val testInput = readInputText(name = "${day}_test") val input = readInputText(name = day) check(part1(testInput) == 24000) check(part2(test...
0
Kotlin
0
0
2a9276b52ed42e0c80e85844c75c1e5e70b383ee
648
aoc-2022
Apache License 2.0
Kotlin for Java Developers/Week 2/Mastermind/Task/src/mastermind/playMastermind.kt
Jatin-8898
179,338,476
false
{"Jupyter Notebook": 2864151, "HTML": 502909, "MATLAB": 289940, "Kotlin": 93513, "Python": 27760, "CSS": 18638, "JavaScript": 17671, "Rich Text Format": 15630, "Java": 13100, "C++": 9237, "C#": 1784}
package mastermind /*import kotlin.random.Random*/ import java.util.Random val ALPHABET = 'A'..'F' const val CODE_LENGTH = 4 fun main() { val differentLetters = false playMastermind(differentLetters) } fun playMastermind( differentLetters: Boolean, secret: String = generateSecret(different...
50
Jupyter Notebook
6
22
1b507a3f5a4f6a21ac480a2cf994d51a6f3767a8
1,635
coursera
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/KInversePairsArray.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
5,932
kotlab
Apache License 2.0
advent-of-code-2021/src/main/kotlin/Day14.kt
jomartigcal
433,713,130
false
{"Kotlin": 72459}
//Day 14: Extended Polymerization //https://adventofcode.com/2021/day/14 import java.io.File fun main() { val lines = File("src/main/resources/Day14.txt").readLines() val template = lines.first() val rules = lines.drop(2).associate { val (adjacentElements, insertElement) = it.split(" -> ") ...
0
Kotlin
0
0
6b0c4e61dc9df388383a894f5942c0b1fe41813f
1,473
advent-of-code
Apache License 2.0
Kotlin/sort/QuickSort/src/QuickSort.kt
HarshCasper
274,711,817
false
{"C++": 1488046, "Java": 948670, "Python": 703942, "C": 615475, "JavaScript": 228879, "Go": 166382, "Dart": 107821, "Julia": 82766, "C#": 76519, "Kotlin": 40240, "PHP": 5465}
/* QuickSort Algortihm works on Divide and Conquer Algorithm. It creates two empty arrays to hold elements less than the pivot value and elements greater than the pivot value, and then recursively sort the sub arrays. There are two basic operations in the algorithm, swapping items in place and partitioning a section o...
2
C++
1,086
877
4f1e5bdd6d9d899fa354de94740e0aecf5ecd2be
2,328
NeoAlgo
MIT License
14/kotlin/src/main/kotlin/se/nyquist/Rules.kt
erinyq712
437,223,266
false
{"Kotlin": 91638, "C#": 10293, "Emacs Lisp": 4331, "Java": 3068, "JavaScript": 2766, "Perl": 1098}
package se.nyquist class Rules(private val ruleMap: Map<String, Char>) { fun getDistribution(i: Int, s: Map.Entry<String, Long>): Map<Char, Long> { return getDistribution(i, s.key, s.value) } fun getDistribution(i: Int, s: String): Map<Char, Long> { return getDistribution(i, s, 1L) } ...
0
Kotlin
0
0
b463e53f5cd503fe291df692618ef5a30673ac6f
2,456
adventofcode2021
Apache License 2.0
2023/src/main/kotlin/de/skyrising/aoc2023/day13/solution.kt
skyrising
317,830,992
false
{"Kotlin": 411565}
package de.skyrising.aoc2023.day13 import de.skyrising.aoc.* val test = TestInput(""" #.##..##. ..#.##.#. ##......# ##......# ..#.##.#. ..##..##. #.#.##.#. #...##..# #....#..# ..##..### #####.##. #####.##. ..##..### #....#..# """) fun CharGrid.checkVertica...
0
Kotlin
0
0
19599c1204f6994226d31bce27d8f01440322f39
1,180
aoc
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/AverageOfSubtree.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
1,766
kotlab
Apache License 2.0
app/src/main/java/com/dlight/algoguide/dsa/dynamic_programming/Longest_Common_Subsequence/lcs.kt
kodeflap
535,790,826
false
{"Kotlin": 129527}
package com.dlight.algoguide.dsa.dynamic_programming.Longest_Common_Subsequence import java.util.* object lcs { @JvmStatic fun main(args: Array<String>) { val s1 = "abcde" val s2 = "ace" println("The Length of Longest Common Subsequence is " + longestCommonSubsequence(s1, s2)) } ...
0
Kotlin
9
10
c4a7ddba54daecb219a1befa12583e3e8f3fa066
1,091
Algo_Guide
Apache License 2.0