path
stringlengths
5
169
owner
stringlengths
2
34
repo_id
int64
1.49M
755M
is_fork
bool
2 classes
languages_distribution
stringlengths
16
1.68k
content
stringlengths
446
72k
issues
float64
0
1.84k
main_language
stringclasses
37 values
forks
int64
0
5.77k
stars
int64
0
46.8k
commit_sha
stringlengths
40
40
size
int64
446
72.6k
name
stringlengths
2
64
license
stringclasses
15 values
src/main/kotlin/cloud/dqn/leetcode/sudoku2/Board.kt
aviuswen
112,305,062
false
null
package cloud.dqn.leetcode.sudoku2 class Board { val grids: Array<Array<DigitValue>> /** * By default create an empty board */ private constructor() { grids = Array( size = BOARD_SIZE, init = { DigitValue.rowFactory(BOARD_SIZE) } ) } constructor(...
0
Kotlin
0
0
23458b98104fa5d32efe811c3d2d4c1578b67f4b
17,161
cloud-dqn-leetcode
No Limit Public License
src/main/kotlin/codes/jakob/aoc/shared/UndirectedGraph.kt
The-Self-Taught-Software-Engineer
433,875,929
false
{"Kotlin": 56277}
package codes.jakob.aoc.shared import java.util.* class UndirectedGraph<T>(input: List<Pair<T, T>>) { private val edges: Set<UndirectedEdge<T>> = buildEdges(input) private val adjacentVertices: Map<Vertex<T>, Set<Vertex<T>>> = buildAdjacentVertices(edges) val vertices: Set<Vertex<T>> = edges.flatMap { set...
0
Kotlin
0
6
d4cfb3479bf47192b6ddb9a76b0fe8aa10c0e46c
5,751
advent-of-code-2021
MIT License
src/main/kotlin/Puzzle21.kt
namyxc
317,466,668
false
null
object Puzzle21 { @JvmStatic fun main(args: Array<String>) { val input = Puzzle21::class.java.getResource("puzzle21.txt").readText() val allergicData = AllergicData(input) println(allergicData.countNonAllergicIngredients()) println(allergicData.listIngredientsByAllergens()) ...
0
Kotlin
0
0
60fa6991ac204de6a756456406e1f87c3784f0af
2,402
adventOfCode2020
MIT License
src/main/kotlin/aoc23/Day18.kt
tom-power
573,330,992
false
{"Kotlin": 254717, "Shell": 1026}
package aoc23 import aoc23.Day18Domain.DigPlan import aoc23.Day18Domain.Lagoon import aoc23.Day18Parser.toLagoon import common.Monitoring import common.Space2D import common.Year23 import kotlin.math.absoluteValue object Day18 : Year23 { fun List<String>.part1(): Long = toLagoon(planFromColours = false) ...
0
Kotlin
0
0
baccc7ff572540fc7d5551eaa59d6a1466a08f56
3,847
aoc
Apache License 2.0
src/leetcode/juneChallenge2020/weektwo/LargestDivisibleSubset.kt
adnaan1703
268,060,522
false
null
package leetcode.juneChallenge2020.weektwo import utils.print fun main() { largestDivisibleSubset(intArrayOf()).print() largestDivisibleSubset(intArrayOf(1, 2, 3)).print() largestDivisibleSubset(intArrayOf(1, 2, 4, 8)).print() } fun largestDivisibleSubset(nums: IntArray): List<Int> { if (nums.isEmpty...
0
Kotlin
0
0
e81915db469551342e78e4b3f431859157471229
1,048
KotlinCodes
The Unlicense
src/main/kotlin/org/agoranomic/assessor/lib/voting_strength/VotingStrengthModification.kt
AgoraNomic
98,589,628
false
{"Kotlin": 1516634, "HTML": 3937}
package org.agoranomic.assessor.lib.voting_strength import kotlinx.collections.immutable.ImmutableMap import kotlinx.collections.immutable.toImmutableMap data class VotingStrengthModificationDescription( val readable: String, val kind: String, val parameters: ImmutableMap<String, String> ) { companion...
0
Kotlin
0
1
a27c3b7d6fcba013983bf103854c6a60c800077c
2,973
assessor
MIT License
src/main/kotlin/org/kotrix/rational/Rational.kt
JarnaChao09
285,169,397
false
{"Kotlin": 446442, "Jupyter Notebook": 26378}
package org.kotrix.rational import kotlin.math.absoluteValue import kotlin.math.sign sealed interface Rational { val numerator: UInt val denominator: UInt val sign: Sign } fun Rational(numerator: Int, denominator: Int = 1, sign: Sign? = null): Rational { val numeratorAbsolute = numerator.absoluteValu...
0
Kotlin
1
5
c5bb19457142ce1f3260e8fed5041a4d0c77fb14
5,060
Kotrix
MIT License
year2017/src/main/kotlin/net/olegg/aoc/year2017/day11/Day11.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2017.day11 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.utils.Vector2D import net.olegg.aoc.year2017.DayOf2017 import kotlin.math.abs /** * See [Year 2017, Day 11](https://adventofcode.com/2017/day/11) */ object Day11 : DayOf2017(11) { override fun first(): Any? { return...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
1,319
adventofcode
MIT License
src/main/kotlin/Day08.kt
N-Silbernagel
573,145,327
false
{"Kotlin": 118156}
fun main() { val input = readFileAsList("Day08") println(Day08.part1(input)) println(Day08.part2(input)) } object Day08 { fun part1(input: List<String>): Int { var visibleItems = 0 for ((rowIndex, row) in input.withIndex()) { for ((itemIndex, tree) in row.withIndex()) { ...
0
Kotlin
0
0
b0d61ba950a4278a69ac1751d33bdc1263233d81
4,285
advent-of-code-2022
Apache License 2.0
src/day10/Day10.kt
PoisonedYouth
571,927,632
false
{"Kotlin": 27144}
package day10 import readInput fun main() { fun part1(input: List<String>): Int { val steps = listOf(20, 60, 100, 140, 180, 220) var x = 1 var cycle = 1 var sum = 0 fun processInstruction() { if (cycle in steps) { sum += cycle * x } ...
0
Kotlin
1
0
dbcb627e693339170ba344847b610f32429f93d1
1,366
advent-of-code-kotlin-2022
Apache License 2.0
kotlin/src/main/kotlin/AoC_Day25.kt
sviams
115,921,582
false
null
object AoC_Day25 { // Yet another concession to mutability...first effort with immutable tape took 27s :( data class CpuState(val tape: MutableMap<Int, Int>, val nextOp: Char, val cursor: Int, val pc: Long, val stopCond: Long) fun parseInput(input: List<String>) : Pair<CpuState, Map<Char, (CpuState) -> C...
0
Kotlin
0
0
19a665bb469279b1e7138032a183937993021e36
2,152
aoc17
MIT License
advent-of-code-2018/src/test/java/aoc/Advent18.kt
yuriykulikov
159,951,728
false
{"Kotlin": 1666784, "Rust": 33275}
package aoc import org.assertj.core.api.Assertions.assertThat import org.junit.Ignore import org.junit.Test class Advent18 { data class Acre(val x: Int, val y: Int, val content: Char) { val pos = x to y } @Test fun `it is a wood`() { assertThat(fieldAfter(testInput, 10)).isEqualTo(11...
0
Kotlin
0
1
f5efe2f0b6b09b0e41045dc7fda3a7565cb21db3
7,132
advent-of-code
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/Dota2Senate.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
7,472
kotlab
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/IsMatch.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,343
kotlab
Apache License 2.0
src/main/kotlin/Day07.kt
N-Silbernagel
573,145,327
false
{"Kotlin": 118156}
fun main() { val input = readFileAsList("Day07") println(Day07.part1(input)) println(Day07.part2(input)) } object Day07 { fun part1(input: List<String>): Int { val rootDir = buildFileSystem(input) val dirSizeMap = mutableMapOf<Dir, Int>() calculateSize(rootDir, dirSizeMap) ...
0
Kotlin
0
0
b0d61ba950a4278a69ac1751d33bdc1263233d81
5,745
advent-of-code-2022
Apache License 2.0
src/main/kotlin/days/Day9.kt
vovarova
572,952,098
false
{"Kotlin": 103799}
package days class Day9 : Day(9) { class Move(val command: Char, val times: Int) val moves: List<Move> = inputList.map { it.split(" ").let { Move(it[0][0], it[1].toInt()) } } data class KnotPosition(val row: Int = 0, val column: Int = 0) { fun up(): KnotPosition = KnotPosition(row + 1, column) ...
0
Kotlin
0
0
e34e353c7733549146653341e4b1a5e9195fece6
2,740
adventofcode_2022
Creative Commons Zero v1.0 Universal
leetcode/src/tree/Q102.kt
zhangweizhe
387,808,774
false
null
package tree import linkedlist.TreeNode import java.util.* import kotlin.collections.ArrayList fun main() { // 102. 二叉树的层序遍历 // https://leetcode-cn.com/problems/binary-tree-level-order-traversal/ val root = TreeNode(3) root.left = TreeNode(9) root.right = TreeNode(20) root.right?.right = Tree...
0
Kotlin
0
0
1d213b6162dd8b065d6ca06ac961c7873c65bcdc
1,732
kotlin-study
MIT License
algorithms/src/main/kotlin/io/nullables/api/playground/algorithms/SierpinskiTriangle.kt
AlexRogalskiy
331,076,596
false
null
/* * Copyright (C) 2021. <NAME>. All Rights Reserved. * * 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 applic...
13
Kotlin
2
2
d7173ec1d9ef227308d926e71335b530c43c92a8
2,896
gradle-kotlin-sample
Apache License 2.0
src/Day06.kt
cypressious
572,898,685
false
{"Kotlin": 77610}
fun main() { fun compute(line: String, size: Int): Int { var substring = line.take(size) var index = size while (true) { if (substring.toCharArray().distinct().size == size) { return index } substring = substring.substring(1) + line[index...
0
Kotlin
0
1
7b4c3ee33efdb5850cca24f1baa7e7df887b019a
764
AdventOfCode2022
Apache License 2.0
src/kotlin/sort/mergesort/MergeSort.kts
carloseduardosx
67,647,496
false
{"Kotlin": 4884}
val defaultArray = intArrayOf(10, 5, 8, 3, 1, 7, 6, 4, 2, 0, 9) fun mergeSort(unsortedArray: IntArray) { splitAndMerge(unsortedArray, 0, unsortedArray.size, IntArray(unsortedArray.size)) unsortedArray.forEach { println(it) } } fun splitAndMerge(unsortedArray: IntArray, first: Int, last: Int, sortedArray: Int...
0
Kotlin
0
0
9e1ca2ebd3a6936cd95e8a9a576d627316ddc701
1,425
Algorithms
MIT License
year2016/src/main/kotlin/net/olegg/aoc/year2016/day18/Day18.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2016.day18 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.year2016.DayOf2016 /** * See [Year 2016, Day 18](https://adventofcode.com/2016/day/18) */ object Day18 : DayOf2016(18) { private val PATTERNS = listOf( "\\^\\^\\.".toRegex(), "\\.\\^\\^".toRegex(), "\\^\\.\\...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
944
adventofcode
MIT License
src/main/kotlin/oct_challenge2021/IslandPerimeter.kt
yvelianyk
405,919,452
false
{"Kotlin": 147854, "Java": 610}
package oct_challenge2021 fun main() { val grid = arrayOf( intArrayOf(0, 1, 0, 0), intArrayOf(1, 1, 1, 0), intArrayOf(0, 1, 0, 0), intArrayOf(1, 1, 0, 0), ) val result = Solution().islandPerimeter(grid) assert(result == 16) println(result) } class Solution { pri...
0
Kotlin
0
0
780d6597d0f29154b3c2fb7850a8b1b8c7ee4bcd
1,536
leetcode-kotlin
MIT License
jvm_sandbox/projects/advent_of_code/src/main/kotlin/year2018/Day4.kt
jduan
166,515,850
false
{"Rust": 876461, "Kotlin": 257167, "Java": 139101, "Python": 114308, "Vim Script": 100117, "Shell": 96665, "C": 67784, "Starlark": 23497, "JavaScript": 20939, "HTML": 12920, "Ruby": 5087, "Thrift": 4518, "Nix": 2919, "HCL": 1069, "Lua": 926, "CSS": 826, "Assembly": 761, "Makefile": 591, "Haskell": 585, "Dockerfile": 50...
package year2018.day4 import java.io.File data class Sleep( // The minute the sleep starts val start: Int, // The minute the sleep ends val end: Int ) { fun minutes() = end - start } data class GuardSleep( val guardId: Int ) { private val sleeps = mutableListOf<Sleep>() fun addSleep(sleep:...
58
Rust
1
0
d5143e89ce25d761eac67e9c357620231cab303e
3,294
cosmos
MIT License
kotlin/src/com/daily/algothrim/leetcode/RemoveDuplicates.kt
idisfkj
291,855,545
false
null
package com.daily.algothrim.leetcode /** * 80. 删除有序数组中的重复项 II * * 给你一个有序数组 nums ,请你 原地 删除重复出现的元素,使每个元素 最多出现两次 ,返回删除后数组的新长度。 * 不要使用额外的数组空间,你必须在 原地 修改输入数组 并在使用 O(1) 额外空间的条件下完成。 */ class RemoveDuplicates { companion object { @JvmStatic fun main(args: Array<String>) { println( ...
0
Kotlin
9
59
9de2b21d3bcd41cd03f0f7dd19136db93824a0fa
2,401
daily_algorithm
Apache License 2.0
src/day17/Rocks.kt
g0dzill3r
576,012,003
false
{"Kotlin": 172121}
package day17 data class Point (val x: Int, val y: Int) { fun add (point: Point): Point = add (point.x, point.y) fun add (dx: Int, dy: Int): Point = Point (x + dx, y + dy) } data class Rock (val raw: String) { val points: List<Point> = parseRock (raw) val width: Int = points.fold (0) { acc, p -> Math.m...
0
Kotlin
0
0
6ec11a5120e4eb180ab6aff3463a2563400cc0c3
1,890
advent_of_code_2022
Apache License 2.0
src/test/kotlin/com/igorwojda/integer/addupto/Solution.kt
igorwojda
159,511,104
false
{"Kotlin": 254856}
package com.igorwojda.integer.addupto // Kotlin idiomatic solution private object Solution1 { private fun addUpTo(n: Int): Int { return (1..n).sum() } } // Kotlin idiomatic solution private object Solution2 { private fun addUpTo(n: Int): Int { return (0..n).fold(0) { accumulated, current -...
9
Kotlin
225
895
b09b738846e9f30ad2e9716e4e1401e2724aeaec
1,078
kotlin-coding-challenges
MIT License
src/main/kotlin/me/dkim19375/adventofcode2022/day/Day2.kt
dkim19375
573,172,567
false
{"Kotlin": 13147}
package me.dkim19375.adventofcode2022.day import me.dkim19375.adventofcode2022.AdventOfCodeDay object Day2 : AdventOfCodeDay() { @JvmStatic fun main(args: Array<String>) = solve() override val day: Int = 2 private val rpsChoices = mapOf( "A" to 1, "B" to 2, "C" to 3, ...
1
Kotlin
0
0
f77c4acec08a4eca92e6d68fe2a5302380688fe6
1,389
AdventOfCode2022
The Unlicense
src/main/kotlin/io/github/pshegger/aoc/y2015/Y2015D15.kt
PsHegger
325,498,299
false
null
package io.github.pshegger.aoc.y2015 import io.github.pshegger.aoc.common.BaseSolver import io.github.pshegger.aoc.common.extractAll import io.github.pshegger.aoc.common.generateSplits import io.github.pshegger.aoc.common.toExtractor import kotlin.math.max class Y2015D15 : BaseSolver() { override val year = 2015 ...
0
Kotlin
0
0
346a8994246775023686c10f3bde90642d681474
2,513
advent-of-code
MIT License
src/8ExponentialTimeAlgorithms/ColoringGraphs.kt
bejohi
136,087,641
false
{"Java": 63408, "Kotlin": 5933, "C++": 5711, "Python": 3670}
import java.util.* import kotlin.system.exitProcess // Solution for https://open.kattis.com/problems/coloring // With help from https://github.com/amartop fun main(args: Array<String>){ val input = Scanner(System.`in`) val vertices = input.nextLine().toInt() val adjMatrix = Array(vertices,{IntArray(verti...
0
Java
0
0
7e346636786215dee4c681b80bc694c8e016e762
1,931
UiB_INF237
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/FindModeInBinarySearchTree.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
8,891
kotlab
Apache License 2.0
src/main/kotlin/adventofcode/year2015/Day18LikeAGifForYourYard.kt
pfolta
573,956,675
false
{"Kotlin": 199554, "Dockerfile": 227}
package adventofcode.year2015 import adventofcode.Puzzle import adventofcode.PuzzleInput import adventofcode.common.Tuple.plus import adventofcode.common.cartesianProduct class Day18LikeAGifForYourYard(customInput: PuzzleInput? = null) : Puzzle(customInput) { override val name = "Like a GIF For Your Yard" pr...
0
Kotlin
0
0
72492c6a7d0c939b2388e13ffdcbf12b5a1cb838
2,049
AdventOfCode
MIT License
src/day5/Solution.kt
Zlate87
572,858,682
false
{"Kotlin": 12960}
package day5 import java.io.File fun main() { fun toStacks(input: List<String>): ArrayList<ArrayDeque<Char>> { val matrix = ArrayList(input.map { it.toCharArray() }) val numberOfRows = (matrix[0].size + 2) / 4 val header = matrix.removeAt(0) println(header) matrix.forEac...
0
Kotlin
0
0
57acf4ede18b72df129ea932258ad2d0e2f1b6c3
4,393
advent-of-code-2022
Apache License 2.0
src/Day01.kt
AmandaLi0
574,592,026
false
{"Kotlin": 5338}
fun main() { // // test if implementation meets criteria from the description, like: // val testInput = readInput("Day01_test") // println(part1(testInput)) // //println(part2(input)) //748958 val input = readInput("Day01") println(cals3Elves(input)) //println(part2(input)) } fun count...
0
Kotlin
0
0
5ce0072f3095408688a7812bc3267834f2ee8cee
1,217
AdventOfCode
Apache License 2.0
src/main/kotlin/com/deflatedpickle/marvin/Version.kt
DeflatedPickle
282,412,324
false
null
/* Copyright (c) 2020 DeflatedPickle under the MIT license */ package com.deflatedpickle.marvin class Version( val major: Int, val minor: Int, val patch: Int = 0 ) : Comparable<Version> { constructor( major: String, minor: String, patch: String = "0" ) : this( major...
2
Kotlin
0
0
83514a67d51f843422e7fb424d480e46490f87f5
3,150
marvin
MIT License
day08/src/main/kotlin/ver_a_and_b.kt
jabbalaci
115,397,721
false
null
import java.io.File object Registers { private val map = mutableMapOf<String, Int>() private var maxValue = 0 fun get(name: String): Int { if (map.containsKey(name) == false) { map[name] = 0 } return map[name]!! } fun inc(name: String, num: Int) { if ...
0
Kotlin
0
0
bce7c57fbedb78d61390366539cd3ba32b7726da
1,982
aoc2017
MIT License
src/coursera/QuickSort.kt
fpr0001
191,991,724
false
null
package coursera // Count the comparisons made by each recursive call var count = 0 fun main() { val intArray = getIntArrayFromFile("QuickSort.txt") count = 0 intArray.quickSort() intArray.map { print("$it, ") } println("\nTotal count: $count") } fun IntArray.quickSort(intRange: IntRange = 0 unti...
0
Kotlin
0
0
8878ef2a08303ea39a414e1ef2e9b499ea597d1c
2,651
Exercises
MIT License
src/main/kotlin/boti996/dsl/proba/models/Bonus.kt
boti996
215,871,891
false
{"HTML": 512127, "Kotlin": 53046, "CSS": 2148}
package boti996.dsl.proba.models /** * this defines bonus-effect ID-s */ enum class BonusEffect(val literal: String) { REGENERATION("regeneration"), STRENGTH("strength"), DEFENSE("defense") } /** * bonus type: this defines a set of [BonusEffect]-s */ enum class BonusType { ANOXIA { overrid...
0
HTML
0
0
dd0ac203b64c7d2857037b81d4432f4b04c347f0
2,186
fish_dsl
MIT License
src/main/kotlin/gameover/fwk/math/MathUtils.kt
gameover-fwk
38,446,869
false
{"Kotlin": 114318}
package gameover.fwk.math import com.badlogic.gdx.math.GridPoint2 import com.badlogic.gdx.math.MathUtils import com.badlogic.gdx.math.Rectangle import com.badlogic.gdx.math.Vector2 import gameover.fwk.pool.Vector2Pool object MathUtils { /** * Compute the distance for a list of points. * For example, i...
0
Kotlin
0
7
7a87e1eba73e4a16a2a3dd58f5818c49d9460996
2,742
gameover-fwk
MIT License
utils/utils-kotlin/src/main/kotlin/de/havox_design/aoc/utils/kotlin/model/coordinates/Coordinate.kt
Gentleman1983
737,309,232
false
{"Kotlin": 746488, "Java": 441473, "Scala": 33415, "Groovy": 5725, "Python": 3319}
package de.havox_design.aoc.utils.kotlin.model.coordinates import kotlin.math.abs data class Coordinate(val x: Int, val y: Int) : Comparable<Coordinate> { override fun compareTo(other: Coordinate): Int = when (val result = y.compareTo(other.y)) { 0 -> x.compareTo(other.x) else -> r...
4
Kotlin
0
1
35ce3f13415f6bb515bd510a1f540ebd0c3afb04
1,490
advent-of-code
Apache License 2.0
Coding Challenges/Advent of Code/2021/Day 10/part2.kt
Alphabeater
435,048,407
false
{"Kotlin": 69566, "Python": 5974}
import java.io.File import java.util.Scanner val list = listOf('(', '[', '{', '<') val lineScores = mutableListOf<Long>() val scoreDict = mapOf('(' to 1, '[' to 2, '{' to 3, '<' to 4) //scores for each character. fun analyzeLine(l: String) { //if it's a corrupted line, skip. If it's an incomplete line, it's evaluated...
0
Kotlin
0
0
05c8d4614e025ed2f26fef2e5b1581630201adf0
2,564
Archive
MIT License
src/aoc2022/Day14.kt
anitakar
576,901,981
false
{"Kotlin": 124382}
package aoc2022 import println import readInput fun main() { fun print(grid: Array<CharArray>) { for (i in grid.indices) { for (j in grid[0].indices) { print(grid[i][j]) } println() } } fun part1(input: List<String>): Int { var ...
0
Kotlin
0
1
50998a75d9582d4f5a77b829a9e5d4b88f4f2fcf
5,558
advent-of-code-kotlin
Apache License 2.0
src/main/kotlin/days/Day11.kt
wmichaelshirk
315,495,224
false
null
package days class Day11 : Day(11) { private val width = inputString.indexOf('\n') + 1 override fun partOne(): Int { val surroundingIndices = listOf( -width - 1, -width , -width + 1, -1, 1, width - 1, width , width + 1 ) var prev = listOf<Char>() var cu...
0
Kotlin
0
0
b36e5236f81e5368f9f6dbed09a9e4a8d3da8e30
2,590
2020-Advent-of-Code
Creative Commons Zero v1.0 Universal
src/y2015/Day11.kt
gaetjen
572,857,330
false
{"Kotlin": 325874, "Mermaid": 571}
package y2015 object Day11 { fun next(str: String): String { val chars = str.toCharArray().toMutableList() var idx = str.length - 1 while (idx >= 0) { chars[idx] = chars[idx] + 1 if (chars[idx] > 'z') { chars[idx] = 'a' idx-- ...
0
Kotlin
0
0
d0b9b5e16cf50025bd9c1ea1df02a308ac1cb66a
1,586
advent-of-code
Apache License 2.0
src/com/freaklius/kotlin/algorithms/sort/Util.kt
vania-pooh
8,736,623
false
null
package com.freaklius.kotlin.algorithms.sort import java.util.Random /** * Contains a set of utility methods like printing array contents and so on */ /** * Prints contents of an array * @param arr an array to be converted to string */ fun <T> arrayToString(arr: Array<T> ) : String{ var str = "Array(" v...
1
Kotlin
14
51
8c5e7b52d2831322d578af895cd4e80fbe471950
1,891
kotlin-algorithms
MIT License
src/main/kotlin/g0201_0300/s0289_game_of_life/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g0201_0300.s0289_game_of_life // #Medium #Top_Interview_Questions #Array #Matrix #Simulation // #2022_11_04_Time_174_ms_(96.97%)_Space_34.2_MB_(93.94%) class Solution { companion object { var dim: Array<IntArray> = arrayOf( intArrayOf(1, 0), intArrayOf(0, 1), intArrayOf(-1, 0), intArra...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,682
LeetCode-in-Kotlin
MIT License
src/Day01.kt
Ajimi
572,961,710
false
{"Kotlin": 11228}
fun main() { fun part1(input: List<String>): Int { return input.caloriesSum().max() } fun part2(input: List<String>): Int { return input.caloriesSum().sortedDescending().subList(0, 3).sum() } // test if implementation meets criteria from the description, like: val testInput = r...
0
Kotlin
0
0
8c2211694111ee622ebb48f52f36547fe247be42
836
adventofcode-2022
Apache License 2.0
src/Day07.kt
kprow
573,685,824
false
{"Kotlin": 23005}
fun main() { fun part1(input: List<String>): Int { var files = mutableListOf<File>() var dirs = mutableListOf<Directory>() for ((index, ls) in input.withIndex()) { val lsResult = ls.split(" ") if (lsResult[0].toIntOrNull() != null) { files += File(lsRe...
0
Kotlin
0
0
9a1f48d2a49aeac71fa948656ae8c0a32862334c
5,232
AdventOfCode2022
Apache License 2.0
src/problems/day10/part1/part1.kt
klnusbaum
733,782,662
false
{"Kotlin": 43060}
package problems.day10.part1 import java.io.File private const val testFile1 = "input/day10/test1.txt" private const val inputFile = "input/day10/input.txt" fun main() { val farthestTileDistance = File(inputFile).bufferedReader().useLines { farthestTileDistance(it) } println("The tile farthest from start is ...
0
Kotlin
0
0
d30db2441acfc5b12b52b4d56f6dee9247a6f3ed
5,689
aoc2023
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/ShortestWordDistance2.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,724
kotlab
Apache License 2.0
Bootcamp_00/src/exercise4/src/main/kotlin/Exercise3.kt
Hasuk1
740,111,124
false
{"Kotlin": 120039}
enum class Mode { CELSIUS, KELVIN, FAHRENHEIT } fun readOutputMode(): Mode { while (true) { try { print("Output mode: ") val input = readLine() ?: throw IllegalArgumentException("The output format is not correct. Standard format - Celsius is set") return when (input.uppercase()) { ...
0
Kotlin
0
1
1dc4de50dd3cd875e3fe76e3da4a58aa04bb87c7
2,483
Kotlin_bootcamp
MIT License
src/main/kotlin/nl/meine/aoc/_2023/Day7.kt
mtoonen
158,697,380
false
{"Kotlin": 201978, "Java": 138385}
package nl.meine.aoc._2023 class Day7 { fun one(input: String): Int { val lines = createHands(input) val h = orderHands(lines) h.forEach { println(it) } return h.mapIndexed { rank, hand -> (rank + 1) * hand.bid } .sum() } fun createHands(input: String): Mutab...
0
Kotlin
0
0
a36addef07f61072cbf4c7c71adf2236a53959a5
12,865
advent-code
MIT License
src/main/kotlin/biodivine/algebra/rootisolation/DescartWithPolyFactorisationRootIsolation.kt
daemontus
160,796,526
false
null
package biodivine.algebra.rootisolation import biodivine.algebra.UPoly import cc.redberry.rings.bigint.BigInteger import cc.redberry.rings.poly.univar.UnivariateFactorization import cc.redberry.rings.poly.univar.UnivariatePolynomial import biodivine.algebra.getDefaultBoundForDescartMethod import biodivine.algebra.getN...
0
Kotlin
0
0
ed4fd35015b73ea3ac36aecb1c5a568f6be7f14c
3,820
biodivine-algebraic-toolkit
MIT License
src/main/kotlin/com/kishor/kotlin/ds/BinarySearchTree.kt
kishorsutar
276,212,164
false
null
package com.kishor.kotlin.ds import kotlin.math.abs class BinarySearchTree<T : Comparable<T>> { var root: Node<T>? = null var nodeCount = 0 data class Node<T>(var data: T, var left: Node<T>? = null, var right: Node<T>? = null) fun isEmpty(): Boolean { return size() == 0 } fun size(...
0
Kotlin
0
0
6672d7738b035202ece6f148fde05867f6d4d94c
7,271
DS_Algo_Kotlin
MIT License
src/main/kotlin/Excercise17.kt
underwindfall
433,989,850
false
{"Kotlin": 55774}
private fun part1() { val input = getInputAsTest("17") val (xr, yr) = input[0].removePrefix("target area: ").split(", ") val (x1, x2) = xr.removePrefix("x=").split("..").map { it.toInt() } val (y1, y2) = yr.removePrefix("y=").split("..").map { it.toInt() } var ans = 0 for (vx0 in 1..1000) { for (vy0 in ...
0
Kotlin
0
0
4fbee48352577f3356e9b9b57d215298cdfca1ed
1,421
advent-of-code-2021
MIT License
domain/src/main/kotlin/com/seanshubin/condorcet/domain/Matrix.kt
SeanShubin
126,547,543
false
null
package com.seanshubin.condorcet.domain import kotlin.math.max import kotlin.math.min class Matrix(val rows: List<List<Int>>) { private var rowCount: Int = 0 private var columnCount: Int = 0 init { for (row in rows) { rowCount += 1 if (columnCount == 0) { c...
0
Kotlin
0
0
a5f887e9ab2281a9c15240a314a6de489ce42f76
3,562
condorcet
The Unlicense
2023/src/main/kotlin/Day20.kt
dlew
498,498,097
false
{"Kotlin": 331659, "TypeScript": 60083, "JavaScript": 262}
object Day20 { fun part1(input: String): Long { var modules = parse(input) var low = 0L var high = 0L repeat(1000) { val (nextModules, pulseCount) = pushButton(modules) low += pulseCount.low high += pulseCount.high modules = nextModules } return low * high } fun...
0
Kotlin
0
0
6972f6e3addae03ec1090b64fa1dcecac3bc275c
5,135
advent-of-code
MIT License
kotlin/src/com/codeforces/round626/B.kt
programmerr47
248,502,040
false
null
package com.codeforces.round626 import java.util.* import kotlin.math.max import kotlin.math.sqrt fun main(args: Array<String>) { // Creates an instance which takes input from standard input (keyboard) val reader = Scanner(System.`in`) rectCount(reader) } private fun rectCount(input: Scanner) { val r...
0
Kotlin
0
0
0b5fbb3143ece02bb60d7c61fea56021fcc0f069
1,650
problemsolving
Apache License 2.0
2015/kotlin/src/main/kotlin/nl/sanderp/aoc/aoc2015/day18/Day18.kt
sanderploegsma
224,286,922
false
{"C#": 233770, "Kotlin": 126791, "F#": 110333, "Go": 70654, "Python": 64250, "Scala": 11381, "Swift": 5153, "Elixir": 2770, "Jinja": 1263, "Ruby": 1171}
package nl.sanderp.aoc.aoc2015.day18 import nl.sanderp.aoc.common.Point2D import nl.sanderp.aoc.common.bounds import nl.sanderp.aoc.common.pointsAround import nl.sanderp.aoc.common.readResource fun simulate(grid: Map<Point2D, Int>, alwaysOn: Collection<Point2D> = emptyList()) = buildMap { alwaysOn.forEach { point...
0
C#
0
6
8e96dff21c23f08dcf665c68e9f3e60db821c1e5
1,347
advent-of-code
MIT License
src/main/kotlin/biz/koziolek/adventofcode/year2023/day14/day14.kt
pkoziol
434,913,366
false
{"Kotlin": 715025, "Shell": 1892}
package biz.koziolek.adventofcode.year2023.day14 import biz.koziolek.adventofcode.* fun main() { val inputFile = findInput(object {}) val platform = parsePlatform(inputFile.bufferedReader().readLines()) println("Total load after sliding north: ${platform.slideNorth().totalLoad}") println("Total load a...
0
Kotlin
0
0
1b1c6971bf45b89fd76bbcc503444d0d86617e95
5,409
advent-of-code
MIT License
src/Day02.kt
floblaf
572,892,347
false
{"Kotlin": 28107}
fun main() { val part1Scoring = mapOf( "A X" to 1+3, "A Y" to 2+6, "A Z" to 3+0, "B X" to 1+0, "B Y" to 2+3, "B Z" to 3+6, "C X" to 1+6, "C Y" to 2+0, "C Z" to 3+3, ) val part2Scoring = mapOf( "A X" to 3+0, "A Y" to 1+3...
0
Kotlin
0
0
a541b14e8cb401390ebdf575a057e19c6caa7c2a
831
advent-of-code-2022
Apache License 2.0
2023/day04-25/src/main/kotlin/Day16.kt
CakeOrRiot
317,423,901
false
{"Kotlin": 62169, "Python": 56994, "C#": 20675, "Rust": 10417}
import java.io.File class Day16 { fun solve1() { val grid = File("inputs/16.txt").inputStream().bufferedReader().lineSequence().map { it.toList() }.toList() println(calcEnergy(grid, Point(0, 0), Point(0, 1))) } fun solve2() { val grid = File("inputs/16.txt").inputStream().buffered...
0
Kotlin
0
0
8fda713192b6278b69816cd413de062bb2d0e400
2,763
AdventOfCode
MIT License
kotlinLeetCode/src/main/kotlin/leetcode/editor/cn/[48]旋转图像.kt
maoqitian
175,940,000
false
{"Kotlin": 354268, "Java": 297740, "C++": 634}
//给定一个 n × n 的二维矩阵表示一个图像。 // // 将图像顺时针旋转 90 度。 // // 说明: // // 你必须在原地旋转图像,这意味着你需要直接修改输入的二维矩阵。请不要使用另一个矩阵来旋转图像。 // // 示例 1: // // 给定 matrix = //[ // [1,2,3], // [4,5,6], // [7,8,9] //], // //原地旋转输入矩阵,使其变为: //[ // [7,4,1], // [8,5,2], // [9,6,3] //] // // // 示例 2: // // 给定 matrix = //[ // [ 5, 1, 9,11], // ...
0
Kotlin
0
1
8a85996352a88bb9a8a6a2712dce3eac2e1c3463
1,510
MyLeetCode
Apache License 2.0
src/main/kotlin/Day10_2.kt
vincent-mercier
726,287,758
false
{"Kotlin": 37963}
import java.io.File import java.io.InputStream import java.lang.Integer.max import java.lang.Integer.min enum class Direction2(val deltaY: Int, val deltaX: Int, val nextDirection: Map<Char, () -> Direction2?>) { S( 0, 0, mapOf( 'S' to { S } ) ), UP( -1, ...
0
Kotlin
0
0
53b5d0a0bb65a77deb5153c8a912d292c628e048
5,000
advent-of-code-2023
MIT License
kotlin/14_Longest_Common_Prefix/solution.kt
giovanniPepi
607,763,568
false
null
// Solution for LeetCode problem #14, Longest Common Prefix // Problem description found on: // https://leetcode.com/problems/longest-common-prefix/ class Solution { fun longestCommonPrefix(strs: Array<String>): String { // finds the length of the shortest word in strs var shortestLen: Int...
0
Kotlin
1
0
ccb853bce41206f30cbfb1ff4ca8e8f22feb0ee2
980
bastterCode
MIT License
src/search/TernarySearch.kt
daolq3012
143,137,563
false
null
package search import sort.HeapSort import java.io.IOException import java.util.* import kotlin.collections.ArrayList class TernarySearch : SearchAlgorithms<Int> { override fun findIndexOf(arr: ArrayList<Int>, value: Int): Int { return ternarySearch(arr, value, 0, arr.size - 1) } /** * @par...
1
Kotlin
11
74
40e00d0d3f1c7cbb93ad28f4197e7ffa5ea36ef9
2,313
Kotlin-Algorithms
Apache License 2.0
src/Day06.kt
Jaavv
571,865,629
false
{"Kotlin": 14896}
// https://adventofcode.com/2022/day/6 fun main() { val testInput = readInput("Day06_test") val input = readInput("Day06") check(day06Part1and2("mjqjpqmgbljsphdztnvjfqwrcgsmlb", 4) == 7) check(day06Part1and2("bvwbjplbgvbhsrlpgdmjqwftvncz", 4) == 5) check(day06Part1and2("nppdvjthqldpwncqszvftbrmjlh...
0
Kotlin
0
0
5ef23a16d13218cb1169e969f1633f548fdf5b3b
1,146
advent-of-code-2022
Apache License 2.0
src/Day19.kt
l8nite
573,298,097
false
{"Kotlin": 105683}
import kotlin.math.max const val ORE = 0 const val CLAY = 1 const val OBSIDIAN = 2 const val GEODE = 3 val resourceNames = listOf("ore", "clay", "obsidian", "geode") val blueprintRegex = ("^Blueprint (\\d+): Each ore robot costs (\\d+) ore. " + "Each clay robot costs (\\d+) ore. " + "Each...
0
Kotlin
0
0
f74331778fdd5a563ee43cf7fff042e69de72272
8,043
advent-of-code-2022
Apache License 2.0
src/Day11.kt
laricchia
434,141,174
false
{"Kotlin": 38143}
import org.jetbrains.kotlinx.multik.api.toNDArray import org.jetbrains.kotlinx.multik.ndarray.data.D2Array import org.jetbrains.kotlinx.multik.ndarray.data.get import org.jetbrains.kotlinx.multik.ndarray.data.set import org.jetbrains.kotlinx.multik.ndarray.operations.all import org.jetbrains.kotlinx.multik.ndarray.oper...
0
Kotlin
0
0
7041d15fafa7256628df5c52fea2a137bdc60727
3,084
Advent_of_Code_2021_Kotlin
Apache License 2.0
kotlin/src/com/s13g/aoc/aoc2022/Day20.kt
shaeberling
50,704,971
false
{"Kotlin": 300158, "Go": 140763, "Java": 107355, "Rust": 2314, "Starlark": 245}
package com.s13g.aoc.aoc2022 import com.s13g.aoc.Result import com.s13g.aoc.Solver import com.s13g.aoc.resultFrom import kotlin.math.abs /** * --- Day 20: Grove Positioning System --- * https://adventofcode.com/2022/day/20 */ class Day20 : Solver { override fun solve(lines: List<String>): Result { val inputA...
0
Kotlin
1
2
7e5806f288e87d26cd22eca44e5c695faf62a0d7
1,981
euler
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/LargestPalindromicNumber.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,895
kotlab
Apache License 2.0
common/src/main/kotlin/combo/math/Estimators.kt
rasros
148,620,275
false
null
package combo.math import combo.util.FloatCircleBuffer import kotlin.math.min import kotlin.math.sqrt interface VarianceEstimator : DataSample { override fun accept(value: Float) = accept(value, 1.0f) /** * @param value include value in estimate * @param weight frequency weight */ override...
0
Kotlin
1
2
2f4aab86e1b274c37d0798081bc5500d77f8cd6f
14,974
combo
Apache License 2.0
src/main/kotlin/days/Day13.kt
MaciejLipinski
317,582,924
true
{"Kotlin": 60261}
package days import java.time.Duration import java.time.Instant import kotlin.math.ceil class Day13 : Day(13) { override fun partOne(): Any { val timestamp = inputList[0].toInt() return inputList[1] .split(",") .filter { it != "x" } .map { it.toInt()...
0
Kotlin
0
0
1c3881e602e2f8b11999fa12b82204bc5c7c5b51
3,626
aoc-2020
Creative Commons Zero v1.0 Universal
backend.native/tests/external/stdlib/collections/ArraysTest/sortedWith.kt
acidburn0zzz
110,847,830
true
{"Kotlin": 3712759, "C++": 728274, "C": 132862, "Groovy": 52992, "JavaScript": 7780, "Shell": 6563, "Batchfile": 6379, "Objective-C++": 5203, "Objective-C": 1891, "Python": 1870, "Pascal": 1698, "Java": 782, "HTML": 185}
import kotlin.test.* private class ArraySortedChecker<A, T>(val array: A, val comparator: Comparator<in T>) { public fun <R> checkSorted(sorted: A.() -> R, sortedDescending: A.() -> R, iterator: R.() -> Iterator<T>) { array.sorted().iterator().assertSorted { a, b -> comparator.compare(a, b) <= 0 } ...
1
Kotlin
0
1
7b9cd6c9f4f3f3218d48acc9ba3b9a1dd62cc57f
1,139
kotlin-native
Apache License 2.0
src/main/kotlin/nl/dirkgroot/adventofcode/year2019/Day02.kt
dirkgroot
317,968,017
false
{"Kotlin": 187862}
package nl.dirkgroot.adventofcode.year2019 import kotlinx.collections.immutable.PersistentList import kotlinx.collections.immutable.toPersistentList import nl.dirkgroot.adventofcode.util.Input import nl.dirkgroot.adventofcode.util.Puzzle class Day02(input: Input, private val replaceInput: Boolean = true) : Puzzle() {...
1
Kotlin
1
1
ffdffedc8659aa3deea3216d6a9a1fd4e02ec128
1,480
adventofcode-kotlin
MIT License
src/main/kotlin/d17/D17_2.kt
MTender
734,007,442
false
{"Kotlin": 108628}
package d17 import d16.Direction import input.Input data class Part1Location( override val row: Int, override val col: Int, val from: Direction, val straight: Int ) : Location(row, col) { override fun getNeighbors(): List<Location> { when (from) { Direction.LEFT -> { ...
0
Kotlin
0
0
a6eec4168b4a98b73d4496c9d610854a0165dbeb
2,194
aoc2023-kotlin
MIT License
2023/15/solve-2.kts
gugod
48,180,404
false
{"Raku": 170466, "Perl": 121272, "Kotlin": 58674, "Rust": 3189, "C": 2934, "Zig": 850, "Clojure": 734, "Janet": 703, "Go": 595}
import java.io.File fun main () { val boxes = (0..255).map { mutableListOf<Pair<String,Int>>() }.toList() val steps = File(args.getOrNull(0) ?: "input").readLines().joinToString("").split(",") steps.forEach { val l = labelFrom(it) val op = opFrom(it) val focal = focalFrom(it) ...
0
Raku
1
5
ca0555efc60176938a857990b4d95a298e32f48a
1,419
advent-of-code
Creative Commons Zero v1.0 Universal
算法/一维数组的动态和1480.kt
Simplation
506,160,986
false
{"Kotlin": 10116}
package com.example.rain_demo.algorithm /** *@author: Rain *@time: 2022/7/14 9:33 *@version: 1.0 *@description: 一维数组的动态和 * 给你一个数组 nums 。数组「动态和」的计算公式为:runningSum[i] = sum(nums[0]…nums[i])。请返回 nums 的动态和。 * val nums = intArrayOf(3, 1, 2, 10, 1) * val nums = intArrayOf(1,2,3,4) */ fun main() { val nums = intA...
0
Kotlin
0
0
d45feaa4c8ea2a08ce7357ee609a2df5b0639b68
1,160
OpenSourceRepository
Apache License 2.0
2021/src/main/kotlin/com/trikzon/aoc2021/Day10.kt
Trikzon
317,622,840
false
{"Kotlin": 43720, "Rust": 21648, "C#": 12576, "C++": 4114, "CMake": 397}
package com.trikzon.aoc2021 import java.util.* import kotlin.collections.ArrayList fun main() { val input = getInputStringFromFile("/day10.txt") benchmark(Part.One, ::day10Part1, input, 436497, 50000) benchmark(Part.One, ::day10Part2, input, 2377613374, 50000) } fun day10Part1(input: String): Int { v...
0
Kotlin
1
0
d4dea9f0c1b56dc698b716bb03fc2ad62619ca08
2,202
advent-of-code
MIT License
src/main/kotlin/Day13.kt
dlew
75,886,947
false
null
import java.util.* class Day13 { data class Coord(val x: Int, val y: Int) companion object { private val ADJACENT = arrayOf( Coord(-1, 0), Coord(0, -1), Coord(1, 0), Coord(0, 1) ) fun bfs(startX: Int, startY: Int, targetX: Int, targetY: Int, favorite: Int): Array<IntA...
0
Kotlin
2
12
527e6f509e677520d7a8b8ee99f2ae74fc2e3ecd
2,506
aoc-2016
MIT License
src/main/kotlin/days/aoc2023/Day19.kt
bjdupuis
435,570,912
false
{"Kotlin": 537037}
package days.aoc2023 import days.Day import java.lang.IllegalStateException class Day19 : Day(2023, 19) { override fun partOne(): Any { return calculatePartOne(inputList) } override fun partTwo(): Any { return calculatePartTwo(inputList) } internal data class Part(val map: Map<St...
0
Kotlin
0
1
c692fb71811055c79d53f9b510fe58a6153a1397
7,544
Advent-Of-Code
Creative Commons Zero v1.0 Universal
src/main/kotlin/com/chriswk/aoc/advent2018/Day16.kt
chriswk
317,863,220
false
{"Kotlin": 481061}
package com.chriswk.aoc.advent2018 object Day16 { val instructionPattern = """.*?(\d+),? (\d+),? (\d+),? (\d+).*""".toRegex() fun partOne(input: List<String>, matchingOpCodeCount: Int): Int { val sampleRuns = parseInput(input) return sampleRuns.count { sample -> findOpCodesWithMatch...
116
Kotlin
0
0
69fa3dfed62d5cb7d961fe16924066cb7f9f5985
7,043
adventofcode
MIT License
core/matchers/src/main/kotlin/au/com/dius/pact/core/matchers/RequestMatching.kt
ryanlevell
342,718,513
true
{"Groovy": 1072122, "Kotlin": 1065230, "Java": 610165, "Scala": 100906, "Clojure": 7519, "ANTLR": 7426, "Dockerfile": 582}
package au.com.dius.pact.core.matchers import au.com.dius.pact.core.model.Interaction import au.com.dius.pact.core.model.Request import au.com.dius.pact.core.model.RequestResponseInteraction import au.com.dius.pact.core.model.Response import mu.KLogging sealed class RequestMatch { private val score: Int get() {...
0
Groovy
0
0
c91f44d2a523240b69899d2c705937ae9cbb5448
3,889
pact-jvm
Apache License 2.0
src/main/kotlin/com/sk/topicWise/tree/543. Diameter of Binary Tree.kt
sandeep549
262,513,267
false
{"Kotlin": 530613}
package com.sk.topicWise.tree import java.util.Stack // backtracking /** * Traverse the tree in dfs, and while backtrack, keep track of 2 things * 1. Farthest leaf node distance from current node, return it to caller adding 1 more edge * 2. Max diameter under this node * * Every node will return max length path ...
1
Kotlin
0
0
cf357cdaaab2609de64a0e8ee9d9b5168c69ac12
1,695
leetcode-kotlin
Apache License 2.0
src/main/kotlin/fijb/leetcode/algorithms/A2AddTwoNumbers.kt
fi-jb
552,324,917
false
{"Kotlin": 22836}
package fijb.leetcode.algorithms //https://leetcode.com/problems/add-two-numbers/ object A2AddTwoNumbers { fun addTwoNumbers(l1: ListNode?, l2: ListNode?): ListNode? { var result : ListNode? = null var it: ListNode? = null var it1 = l1 var it2 = l2 var dev = 0 while...
0
Kotlin
0
0
f0d59da5bcffaa7a008fe6b83853306d40ac4b90
2,046
leetcode
MIT License
src/main/kotlin/aoc/utils/CustomListExtensions.kt
Arch-vile
572,557,390
false
{"Kotlin": 132454}
package aoc.utils import kotlin.math.min fun <T> List<T>.indexesOf(predicate: (T) -> Boolean): List<Int> { val indexes = mutableListOf<Int>() for (i in indices) { if (predicate(this[i])) { indexes.add(i) } } return indexes } /** * Identical to takeWhile but also includes...
0
Kotlin
0
0
e737bf3112e97b2221403fef6f77e994f331b7e9
5,236
adventOfCode2022
Apache License 2.0
kotlin/src/katas/kotlin/leetcode/jump_game/JumpGame.kt
dkandalov
2,517,870
false
{"Roff": 9263219, "JavaScript": 1513061, "Kotlin": 836347, "Scala": 475843, "Java": 475579, "Groovy": 414833, "Haskell": 148306, "HTML": 112989, "Ruby": 87169, "Python": 35433, "Rust": 32693, "C": 31069, "Clojure": 23648, "Lua": 19599, "C#": 12576, "q": 11524, "Scheme": 10734, "CSS": 8639, "R": 7235, "Racket": 6875, "C...
package katas.kotlin.leetcode.jump_game import datsok.* import org.junit.* /** * https://leetcode.com/problems/jump-game-ii/ * * Given an array of non-negative integers, you are initially positioned at the first index of the array. * Each element in the array represents your maximum jump length at that position. ...
7
Roff
3
5
0f169804fae2984b1a78fc25da2d7157a8c7a7be
1,664
katas
The Unlicense
src/main/kotlin/com/misterpemodder/aoc2022/solutions/Day02.kt
MisterPeModder
573,061,300
false
{"Kotlin": 87294}
/* * 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 wr...
0
Kotlin
0
0
af1b258325a7bd036a47b5395c90bbac42bbd337
4,223
AdventOfCode2022
Apache License 2.0
core-types/src/main/java/lang/taxi/policies/Policy.kt
adarro
458,750,628
false
{"Kotlin": 519316, "TypeScript": 56768, "ANTLR": 38921, "JavaScript": 4324, "Python": 2009, "Java": 754, "Batchfile": 133, "Shell": 129, "Dockerfile": 123}
package lang.taxi.policies import lang.taxi.Operator import lang.taxi.types.* import lang.taxi.types.Annotation data class Policy( override val qualifiedName: String, val targetType: Type, val ruleSets: List<RuleSet>, override val annotations: List<Annotation>, override val com...
0
Kotlin
0
0
4e63dc633ef4dd28f6c92f1546640d9b67fa0826
7,898
quarkus-taxi-poc
Apache License 2.0
leetcode2/src/leetcode/PascalsTriangle.kt
hewking
68,515,222
false
null
package leetcode /** * 118. 杨辉三角 * https://leetcode-cn.com/problems/pascals-triangle/ * Created by test * Date 2019/6/7 1:05 * Description * 给定一个非负整数 numRows,生成杨辉三角的前 numRows 行。 在杨辉三角中,每个数是它左上方和右上方的数的和。 示例: 输入: 5 输出: [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] 来源:力扣(LeetCode) 链接:https://leetcode-cn.com...
0
Kotlin
0
0
a00a7aeff74e6beb67483d9a8ece9c1deae0267d
1,451
leetcode
MIT License
src/main/kotlin/ch/uzh/ifi/seal/bencher/Comparators.kt
chrstphlbr
227,602,878
false
{"Kotlin": 918163, "Java": 29153}
package ch.uzh.ifi.seal.bencher private const val equal = 0 object MethodComparator : Comparator<Method> { private val c = compareBy(Method::clazz) .thenBy(Method::name) .thenComparing(ParameterComparator) .thenComparing(JmhParameterComparator) override fun compare(m1: Met...
0
Kotlin
2
4
06601fb4dda3b2996c2ba9b2cd612e667420006f
2,087
bencher
Apache License 2.0
year2021/src/main/kotlin/net/olegg/aoc/year2021/day6/Day6.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2021.day6 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.utils.parseInts import net.olegg.aoc.year2021.DayOf2021 /** * See [Year 2021, Day 6](https://adventofcode.com/2021/day/6) */ object Day6 : DayOf2021(6) { override fun first(): Any? { return solve(80) } override ...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
883
adventofcode
MIT License
Kotlin/src/main/kotlin/org/algorithm/problems/0048_all_nodes_distance_k_in_binary_tree.kt
raulhsant
213,479,201
true
{"C++": 1035543, "Kotlin": 114509, "Java": 27177, "Python": 16568, "Shell": 999, "Makefile": 187}
// Problem Statement // We are given a binary tree (with root node root), a target node, and an integer value K. // // Return a list of the values of all nodes that have a distance K from the // target node. The answer can be returned in any order. /** * Definition for a binary tree node. * class TreeNode(var `val`...
0
C++
0
0
1578a0dc0a34d63c74c28dd87b0873e0b725a0bd
2,414
algorithms
MIT License
BackEnd/src/main/kotlin/com/sorbonne/daar/algorithms/automate/DFA.kt
MalickLSy
622,912,085
false
null
package com.sorbonne.daar.algorithms.automate import java.util.* class DFA(val root: DFAState, val acceptings: Set<DFAState?>) { override fun toString(): String { return root.toString() } companion object { private var allDFAStates: MutableSet<DFAState> = HashSet() /** ...
0
Kotlin
0
0
b22e9e4f1410a63cf689ed66fa88e0a84a20f2a0
4,067
search-engine-book
MIT License
src/Day01.kt
tsdenouden
572,703,357
false
{"Kotlin": 8295}
fun main() { fun getInventories(input: List<String>): MutableList<Int> { val calories: MutableList<Int> = mutableListOf() var currentInventory = 0 input.forEach { line -> if (line == "") { calories.add(currentInventory) currentInventory = 0 ...
0
Kotlin
0
0
68982ebffc116f3b49a622d81e725c8ad2356fed
1,061
aoc-2022-kotlin
Apache License 2.0
src/test/kotlin/org/nield/kotlinstatistics/IntegerStatisticsTest.kt
thomasnield
84,361,977
false
null
package org.nield.kotlinstatistics import org.junit.Assert import org.junit.Test class IntegerStatisticsTest { val intVector = sequenceOf(1, 3, 5, 11) val groups = sequenceOf("A","A","B", "B") @Test fun sumBy() { val r = mapOf("A" to 4, "B" to 16) groups.zip(intVector).sumBy().let...
15
Kotlin
48
840
17f64bae2a3cea2e85f05c08172d19a290561e3b
1,668
kotlin-statistics
Apache License 2.0
codeforces/kotlinheroes3/e.kt
mikhail-dvorkin
93,438,157
false
{"Java": 2219540, "Kotlin": 615766, "Haskell": 393104, "Python": 103162, "Shell": 4295, "Batchfile": 408}
package codeforces.kotlinheroes3 private fun solve() { val (n, k) = readInts() val nei = List(n) { mutableSetOf<Int>() } repeat(n - 1) { val (u, v) = readInts().map { it - 1 } nei[u].add(v); nei[v].add(u) } val leaves = nei.indices.filter { nei[it].size == 1 }.toMutableList() if (k == 1) return println("Yes\...
0
Java
1
9
30953122834fcaee817fe21fb108a374946f8c7c
897
competitions
The Unlicense
src/main/kotlin/krangl/util/Util.kt
stangls
238,162,024
true
{"Kotlin": 252665, "R": 1809, "Java": 1121}
package krangl.util // // Functional Helpers (missing in kotlin-stdlib) // // todo should they go into separate artifact? // adopted from https://stackoverflow.com/questions/44429419/what-is-basic-difference-between-fold-and-reduce-in-kotlin-when-to-use-which // desc from https://stackoverflow.com/questions/17408880...
0
Kotlin
1
0
dfa3a6ccbb6777f97840582076a8f2f1a3308d14
2,073
krangl
MIT License
src/main/kotlin/nl/tiemenschut/aoc/y2023/day20.kt
tschut
723,391,380
false
{"Kotlin": 61206}
package nl.tiemenschut.aoc.y2023 import nl.tiemenschut.aoc.lib.dsl.aoc import nl.tiemenschut.aoc.lib.dsl.day import nl.tiemenschut.aoc.lib.dsl.parser.InputParser import nl.tiemenschut.aoc.y2023.PulseValue.HIGH import nl.tiemenschut.aoc.y2023.PulseValue.LOW sealed class Module(open val name: String, open val connectio...
0
Kotlin
0
1
a1ade43c29c7bbdbbf21ba7ddf163e9c4c9191b3
5,066
aoc-2023
The Unlicense
kotlin/src/com/daily/algothrim/leetcode/NumIslands.kt
idisfkj
291,855,545
false
null
package com.daily.algothrim.leetcode /** * 200. 岛屿数量 * 给你一个由 '1'(陆地)和 '0'(水)组成的的二维网格,请你计算网格中岛屿的数量。 * 岛屿总是被水包围,并且每座岛屿只能由水平方向和/或竖直方向上相邻的陆地连接形成。 * 此外,你可以假设该网格的四条边均被水包围。 */ class NumIslands { companion object { @JvmStatic fun main(args: Array<String>) { println(NumIslands().numIslands...
0
Kotlin
9
59
9de2b21d3bcd41cd03f0f7dd19136db93824a0fa
1,617
daily_algorithm
Apache License 2.0
aoc_2023/src/main/kotlin/problems/day15/LensHashes.kt
Cavitedev
725,682,393
false
{"Kotlin": 228779}
package problems.day15 class LensHashes(lines: List<String>) { val sequences = lines[0].split(",") fun stepIntoValue(step: Char, value: Int): Int { val charCode = step.code return ((value + charCode) * 17) % 256 } fun sequenceIntoValue(sequence: String, value: Int): Int { var ...
0
Kotlin
0
1
aa7af2d5aa0eb30df4563c513956ed41f18791d5
1,975
advent-of-code-2023
MIT License