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/g1601_1700/s1654_minimum_jumps_to_reach_home/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g1601_1700.s1654_minimum_jumps_to_reach_home // #Medium #Array #Dynamic_Programming #Breadth_First_Search // #Graph_Theory_I_Day_11_Breadth_First_Search // #2023_06_15_Time_192_ms_(100.00%)_Space_38.3_MB_(100.00%) import java.util.LinkedList import java.util.Queue class Solution { private class Pair(var ...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,627
LeetCode-in-Kotlin
MIT License
src/main/kotlin/me/peckb/aoc/_2023/calendar/day17/Day17.kt
peckb1
433,943,215
false
{"Kotlin": 956135}
package me.peckb.aoc._2023.calendar.day17 import javax.inject.Inject import me.peckb.aoc.generators.InputGenerator.InputGeneratorFactory import kotlin.math.max class Day17 @Inject constructor( private val generatorFactory: InputGeneratorFactory, ) { fun partOne(filename: String) = generatorFactory.forFile(filena...
0
Kotlin
1
3
2625719b657eb22c83af95abfb25eb275dbfee6a
2,056
advent-of-code
MIT License
mobile/src/main/java/ch/epfl/sdp/mobile/application/chess/notation/CommonNotationCombinators.kt
epfl-SDP
462,385,783
false
{"Kotlin": 1271815, "Shell": 359}
package ch.epfl.sdp.mobile.application.chess.notation import ch.epfl.sdp.mobile.application.chess.engine.Board import ch.epfl.sdp.mobile.application.chess.engine.Position import ch.epfl.sdp.mobile.application.chess.parser.Combinators.filter import ch.epfl.sdp.mobile.application.chess.parser.Combinators.flatMap import ...
15
Kotlin
2
13
71f6e2a5978087205b35f82e89ed4005902d697e
1,884
android
MIT License
src/main/kotlin/aoc2022/Day21.kt
j4velin
572,870,735
false
{"Kotlin": 285016, "Python": 1446}
package aoc2022 import readInput private typealias Name = String object Day21 { private class Monkey( val name: Name, private var number: Long?, private val operation: () -> Long? = { number } ) { companion object { lateinit var allMonkeys: Map<Name, Monkey> ...
0
Kotlin
0
0
f67b4d11ef6a02cba5b206aba340df1e9631b42b
7,228
adventOfCode
Apache License 2.0
Tic-Tac-Toe.kt
AlphaCodingPilot
319,027,540
false
{"Kotlin": 15793}
val brett = mutableListOf( 0, 0, 0, 0, 0, 0, 0, 0, 0 ) fun menschZug(): Int { println("Du bist am Zug") while (true) { val eingabe = readLine()?.toIntOrNull() if (eingabe != null && eingabe > 0 && eingabe < 10) { if (brett[eingabe - 1] == 0) { brett[eingabe -...
0
Kotlin
0
0
2206e08785b879ad1c3c661f1e7d34a019bbfb71
4,549
AI-Collection
MIT License
src/main/kotlin/com/eric/leetcode/ArithmeticSlicesIISubsequence.kt
wanglikun7342
163,727,208
false
{"Kotlin": 172132, "Java": 27019}
package com.eric.leetcode import java.util.HashMap /** * 暴力解法,DFS */ //class ArithmeticSlicesIISubsequence { // // var num = 0 // // // fun numberOfArithmeticSlices(A: IntArray): Int { // num = 0 // for (index in A.indices) { // dfs(A, index, Long.MIN_VALUE, 1) // } // ...
0
Kotlin
2
8
d7fb5ff5a0a64d9ce0a5ecaed34c0400e7c2c89c
1,965
Leetcode-Kotlin
Apache License 2.0
kotlinLeetCode/src/main/kotlin/leetcode/editor/cn/[66]加一.kt
maoqitian
175,940,000
false
{"Kotlin": 354268, "Java": 297740, "C++": 634}
//给定一个由 整数 组成的 非空 数组所表示的非负整数,在该数的基础上加一。 // // 最高位数字存放在数组的首位, 数组中每个元素只存储单个数字。 // // 你可以假设除了整数 0 之外,这个整数不会以零开头。 // // // // 示例 1: // // //输入:digits = [1,2,3] //输出:[1,2,4] //解释:输入数组表示数字 123。 // // // 示例 2: // // //输入:digits = [4,3,2,1] //输出:[4,3,2,2] //解释:输入数组表示数字 4321。 // // // 示例 3: // // //输入:digits = [0] /...
0
Kotlin
0
1
8a85996352a88bb9a8a6a2712dce3eac2e1c3463
1,433
MyLeetCode
Apache License 2.0
y2019/src/main/kotlin/adventofcode/y2019/Day13.kt
Ruud-Wiegers
434,225,587
false
{"Kotlin": 503769}
package adventofcode.y2019 import adventofcode.io.AdventSolution import adventofcode.language.intcode.IntCodeProgram fun main() = Day13.solve() object Day13 : AdventSolution(2019, 13, "Arcade") { override fun solvePartOne(input: String) = IntCodeProgram.fromData(input).run { execute() generateSe...
0
Kotlin
0
3
fc35e6d5feeabdc18c86aba428abcf23d880c450
1,399
advent-of-code
MIT License
src/main/kotlin/days/Day13.kt
hughjdavey
159,955,618
false
null
package days import util.Tracks import util.infiniteList class Day13 : Day(13) { override fun partOne(): Any { val initialState = Day13.initCarts(inputList) var iteration = 1 while (initialState.flatten().none { it.second != null && it.second!!.state == 'X' }) { Day13.doTick(...
0
Kotlin
0
0
4f163752c67333aa6c42cdc27abe07be094961a7
4,978
aoc-2018
Creative Commons Zero v1.0 Universal
opta-router-solver/timefold/src/main/kotlin/io/github/pintowar/opta/router/solver/timefold/Extensions.kt
pintowar
120,393,481
false
{"Kotlin": 156826, "Vue": 72961, "TypeScript": 5560, "JavaScript": 463, "HTML": 388, "CSS": 58}
package io.github.pintowar.opta.router.solver.timefold import io.github.pintowar.opta.router.core.domain.models.LatLng import io.github.pintowar.opta.router.core.domain.models.Route import io.github.pintowar.opta.router.core.domain.models.VrpProblem import io.github.pintowar.opta.router.core.domain.models.VrpSolution ...
1
Kotlin
2
28
4c49f6c5bbb16ad8a68eb15fae87c6ddc59aede0
4,329
opta-router
Apache License 2.0
src/main/kotlin/endredeak/aoc2023/Day11.kt
edeak
725,919,562
false
{"Kotlin": 26575}
package endredeak.aoc2023 import kotlin.math.abs fun main() { solve("Cosmic Expansion") { fun Pair<Long, Long>.dist(other: Pair<Long, Long>) = abs(other.first - first) + abs(other.second - second) fun coordinate(c: Int, adds: List<Int>, factor: Long) = c.toLong() + adds.count { c > it } * (factor ...
0
Kotlin
0
0
92c684c42c8934e83ded7881da340222ff11e338
1,134
AdventOfCode2023
Do What The F*ck You Want To Public License
src/week3/CourseSchedule.kt
anesabml
268,056,512
false
null
package week3 import java.util.* import kotlin.system.measureNanoTime class CourseSchedule { /** BFS */ fun canFinish(numCourses: Int, prerequisites: Array<IntArray>): Boolean { val graph = Array<MutableList<Int>>(numCourses) { mutableListOf() } val inDegree = IntArray(numCourses) f...
0
Kotlin
0
1
a7734672f5fcbdb3321e2993e64227fb49ec73e8
2,380
leetCode
Apache License 2.0
day10/kotlin/RJPlog/day2110_1_2.kts
razziel89
438,180,535
true
{"Rust": 368326, "Python": 219109, "Go": 200337, "Kotlin": 80185, "Groovy": 67858, "JavaScript": 45619, "TypeScript": 43504, "CSS": 35030, "Shell": 18611, "C": 5260, "Ruby": 2359, "Dockerfile": 2285, "HTML": 227, "C++": 153}
import java.io.File //fun main(args: Array<String>) { var solution1: Int var solution2: Long var points = mutableMapOf<Int, Int>() points.put(3, 0) points.put(57, 0) points.put(1197, 0) points.put(25137, 0) var correctInstructions = mutableListOf<String>() var scoresSolution2 = mutableListOf<Long>() // t...
1
Rust
0
0
91a801b3c812cc3d37d6088a2544227cf158d114
3,003
aoc-2021
MIT License
src/Day02.kt
theofarris27
574,591,163
false
null
fun main() { fun part1(input: List<String>): Int { return input.size } fun part2(input: List<String>): Int { var sum = 0; var win = 6 var loss = 0 var tie = 3 var x = 1 var y = 2 var z = 3 for (lines in ...
0
Kotlin
0
0
cf77115471a7f1caeedf13ae7a5cdcbdcec3eab7
1,754
AdventOfCode
Apache License 2.0
aoc-2020/src/commonMain/kotlin/fr/outadoc/aoc/twentytwenty/Day04.kt
outadoc
317,517,472
false
{"Kotlin": 183714}
package fr.outadoc.aoc.twentytwenty import fr.outadoc.aoc.scaffold.Day import fr.outadoc.aoc.scaffold.readDayInput class Day04 : Day<Int> { companion object { private val knownProperties = listOf("byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid", "cid") } private val input: List<PassportCandidate>...
0
Kotlin
0
0
54410a19b36056a976d48dc3392a4f099def5544
2,882
adventofcode
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/RotateList.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,988
kotlab
Apache License 2.0
src/day06/Day06.kt
martin3398
572,166,179
false
{"Kotlin": 76153}
package day06 import readInput fun main() { fun part1(input: String): Int { for (index in 0 until input.length - 4) { val lastsSet = setOf<Char>(input[index], input[index + 1], input[index + 2], input[index + 3]) if (lastsSet.size == 4) { return index + 4 ...
0
Kotlin
0
0
4277dfc11212a997877329ac6df387c64be9529e
1,110
advent-of-code-2022
Apache License 2.0
src/com/ssynhtn/medium/NQueens.kt
ssynhtn
295,075,844
false
{"Java": 639777, "Kotlin": 34064}
package com.ssynhtn.medium class NQueens { fun solveNQueens2(n: Int): Int { val table = Array<CharArray>(n, {i -> CharArray(n)}) for (i in 0 until n) { for (j in 0 until n) { table[i][j] = '.' } } return putQueens(table, 0) } priva...
0
Java
0
0
511f65845097782127bae825b07a51fe9921c561
2,585
leetcode
Apache License 2.0
src/2023/Day1_2.kts
Ozsie
318,802,874
false
{"Kotlin": 99344, "Python": 1723, "Shell": 975}
import java.io.File val numbers = mutableListOf<Int>() val digitsAsStrings = mapOf( "one" to "1", "two" to "2", "three" to "3", "four" to "4", "five" to "5", "six" to "6", "seven" to "7", "eight" to "8", "nine" to "9", ) fun String.containsAny(map: Map<String, String>) = map.keys.a...
0
Kotlin
0
0
d938da57785d35fdaba62269cffc7487de67ac0a
1,033
adventofcode
MIT License
src/test/kotlin/com/github/mpe85/grampa/grammar/SequenceRuleTests.kt
mpe85
138,511,038
false
{"Kotlin": 269689, "Java": 1073}
package com.github.mpe85.grampa.grammar import com.github.mpe85.grampa.legalCodePoints import com.github.mpe85.grampa.parser.Parser import com.github.mpe85.grampa.rule.Rule import com.github.mpe85.grampa.rule.StringRule import io.kotest.core.spec.style.StringSpec import io.kotest.matchers.shouldBe import io.kotest.pro...
0
Kotlin
1
11
b3638090a700d2f6213b0f4e10d525c0e4444d94
3,095
grampa
MIT License
src/Day04.kt
Arclights
574,085,358
false
{"Kotlin": 11490}
fun main() { fun parseInput(input: List<String>) = input .map { line -> line.split(",") .map { elf -> elf.split("-") .let { ids -> ids[0].toInt()..ids[1].toInt() } .toSet() } .let ...
0
Kotlin
0
0
121a81ba82ba0d921bd1b689241ffa8727bc806e
915
advent_of_code_2022
Apache License 2.0
aoc2016/src/main/kotlin/io/github/ajoz/aoc16/Day4.kt
ajoz
116,427,939
false
null
package io.github.ajoz.aoc16 import java.io.File /** * --- Day 4: Security Through Obscurity --- * * Finally, you come across an information kiosk with a list of rooms. Of * course, the list is encrypted and full of decoy data, but the instructions to * decode the list are barely hidden nearby. Better remove the...
0
Kotlin
0
0
49ba07dd5fbc2949ed3c3ff245d6f8cd7af5bebe
4,169
challenges-kotlin
Apache License 2.0
src/Day21.kt
frozbiz
573,457,870
false
{"Kotlin": 124645}
class SimpleTree { interface Node { fun value(): Long fun value(target: Long): Long val human: Boolean } class ValueNode(val storedValue: Long): Node { override fun value() = storedValue override val human: Boolean get() = false override fun value(target: Lon...
0
Kotlin
0
0
4feef3fa7cd5f3cea1957bed1d1ab5d1eb2bc388
4,971
2022-aoc-kotlin
Apache License 2.0
2020/11/week3/minhyungPark/algorithm/LeetCode1647.kt
Road-of-CODEr
270,008,701
false
{"Java": 199573, "C++": 42297, "JavaScript": 29489, "Kotlin": 28801, "Python": 20313, "HTML": 7981, "Shell": 7160}
/** * Leetcode 1647. Minimum Deletions to Make Character Frequencies Unique * https://leetcode.com/contest/weekly-contest-214/problems/minimum-deletions-to-make-character-frequencies-unique/ */ class LeetCode1647 { fun minDeletions(s: String): Int { val frequency = IntArray(26) s.forEach { c -> ...
3
Java
11
36
1c603bc40359aeb674da9956129887e6f7c8c30a
725
stupid-week-2020
MIT License
src/day01/Day01.kt
taer
573,051,280
false
{"Kotlin": 26121}
package day01 import readInput import split fun main() { fun sumElves(input: List<String>): List<Int> { return input.asSequence() .split { it.isBlank() } .map { it.sumOf { a -> a.toInt()} } .toList() } fun part1(input: List<String>): Int { val elves = s...
0
Kotlin
0
0
1bd19df8949d4a56b881af28af21a2b35d800b22
718
aoc2022
Apache License 2.0
src/questions/WordBreak.kt
realpacific
234,499,820
false
null
package questions import _utils.UseCommentAsDocumentation import utils.shouldBe import kotlin.collections.HashSet /** * Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a * space-separated sequence of one or more dictionary words. * Note that the same word in the dictio...
4
Kotlin
5
93
22eef528ef1bea9b9831178b64ff2f5b1f61a51f
1,841
algorithms
MIT License
Day6/memory_banks.kt
fpeterek
155,423,059
false
null
// Solves both first and second problem fun redistribute(banks: MutableList<Int>) { val max = banks.max()!! var index = banks.indexOf(max) var blocksToAlloc = max banks[index] = 0 while (blocksToAlloc > 0) { ++index if (index >= banks.size) { index = 0 } ...
0
Kotlin
0
0
d5bdf89e106cd84bb4ad997363a887c02cb6664b
1,091
Advent-Of-Code
MIT License
numth/src/main/kotlin/net/fwitz/math/numth/numbers/Divisibility.kt
txshtkckr
410,419,365
false
{"Kotlin": 558762}
package net.fwitz.math.numth.numbers import kotlin.math.absoluteValue import kotlin.math.sqrt object Divisibility { fun factor(n: Int): List<Int> { when (n) { -3 -> return listOf(-1, 1, 3) -2 -> return listOf(-1, 1, 2) -1 -> return listOf(-1, 1) 0 -> return ...
0
Kotlin
1
0
c6ee97ab98115e044a46490ef3a26c51752ae6d6
1,812
fractal
Apache License 2.0
kotlin/0752-open-the-lock.kt
neetcode-gh
331,360,188
false
{"JavaScript": 473974, "Kotlin": 418778, "Java": 372274, "C++": 353616, "C": 254169, "Python": 207536, "C#": 188620, "Rust": 155910, "TypeScript": 144641, "Go": 131749, "Swift": 111061, "Ruby": 44099, "Scala": 26287, "Dart": 9750}
class Solution { fun openLock(deadends: Array<String>, target: String): Int { val deadEndSet = hashSetOf<String>() deadends.forEach { deadEndSet.add(it) } if (target in deadEndSet || "0000" in deadEndSet) return -1 // [ (String,Level) ] val queue: Queue<Pair<String, Int>> = ...
337
JavaScript
2,004
4,367
0cf38f0d05cd76f9e96f08da22e063353af86224
2,238
leetcode
MIT License
src/main/kotlin/info/dgjones/barnable/grammar/Suffix.kt
jonesd
442,279,905
false
{"Kotlin": 474251}
/* * 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...
1
Kotlin
0
0
b5b7453e2fe0b2ae7b21533db1b2b437b294c63f
2,306
barnable
Apache License 2.0
kotlin/594.Longest Harmonious Subsequence(最长和谐子序列).kt
learningtheory
141,790,045
false
{"Python": 4025652, "C++": 1999023, "Java": 1995266, "JavaScript": 1990554, "C": 1979022, "Ruby": 1970980, "Scala": 1925110, "Kotlin": 1917691, "Go": 1898079, "Swift": 1827809, "HTML": 124958, "Shell": 7944}
/** <p>We define a harmonious array is an array where the difference between its maximum value and its minimum value is <b>exactly</b> 1.</p> <p>Now, given an integer array, you need to find the length of its longest harmonious subsequence among all its possible <a href="https://en.wikipedia.org/wiki/Subsequence">subs...
0
Python
1
3
6731e128be0fd3c0bdfe885c1a409ac54b929597
1,631
leetcode
MIT License
src/main/kotlin/graph/variation/Bipartite.kt
yx-z
106,589,674
false
null
package graph.variation import graph.core.Edge import graph.core.Graph import graph.core.Vertex // check if an undirected graph G = (V, E) is bipartite, that is, // let V be partitioned into two sets A and B, and every edge e in E satisfies // that one endpoint is in A and the other is in B fun <V> Graph<V>.isBiparti...
0
Kotlin
0
1
15494d3dba5e5aa825ffa760107d60c297fb5206
1,376
AlgoKt
MIT License
src/main/kotlin/com/meghneelgore/trie/Trie.kt
meghneelgore
210,950,584
false
null
package com.meghneelgore.trie import java.io.File /** * This class creates a Trie from: * 1) A List<String> of a word list * 2) A file containing a word list. Each word must start on the first column of a new line. Words starting with a `#` * will be ignored. * * A Trie is a prefix tree. Each node in the trie h...
0
Kotlin
0
0
4e86f3748eb7d417e154015f4fa4e0d0ffde3f5f
10,699
trie
MIT License
2021/src/main/kotlin/com/trikzon/aoc2021/Day1.kt
Trikzon
317,622,840
false
{"Kotlin": 43720, "Rust": 21648, "C#": 12576, "C++": 4114, "CMake": 397}
package com.trikzon.aoc2021 fun main() { val input = getInputStringFromFile("/day1.txt") benchmark(Part.One, ::dayOnePartOne, input, 1624, 50000) benchmark(Part.Two, ::dayOnePartTwo, input, 1653, 50000) } fun dayOnePartOne(input: String): Int { val depths = input.lines().map { line -> line.toInt() } ...
0
Kotlin
1
0
d4dea9f0c1b56dc698b716bb03fc2ad62619ca08
947
advent-of-code
MIT License
i18n/src/main/kotlin/com/kamelia/sprinkler/i18n/Plural.kt
Black-Kamelia
579,095,832
false
{"Kotlin": 647359, "Java": 18620}
package com.kamelia.sprinkler.i18n import com.kamelia.sprinkler.i18n.Options.COUNT import java.util.Locale /** * The plural value of the translation. It can be used to disambiguate translations depending on the number of * items. * * @see COUNT * @see TranslatorConfiguration.Builder.pluralMapper */ enum class P...
3
Kotlin
0
6
c86847064925469383cdde0cce68572bcde1e57b
3,084
Sprinkler
MIT License
src/main/kotlin/day19/main.kt
janneri
572,969,955
false
{"Kotlin": 99028}
package day19 import util.readInput data class Robot( val oreCost: Int = 0, val clayCost: Int = 0, val obsidianCost: Int = 0, ) data class Blueprint( val id: Int, val oreRobot: Robot, val clayRobot: Robot, val obsidianRobot: Robot, val geodeRobot: Robot, // We can use this to prun...
0
Kotlin
0
0
1de6781b4d48852f4a6c44943cc25f9c864a4906
7,072
advent-of-code-2022
MIT License
src/Day06.kt
ChenJiaJian96
576,533,624
false
{"Kotlin": 11529}
fun main() { fun String.findFirstMarkerIndex(markerLength: Int): Int { for (index in 0 until this.length - markerLength) { this.substring(index, index + markerLength).toSet().also { if (it.size == markerLength) { return index + markerLength } ...
0
Kotlin
0
0
b1a88f437aee756548ac5ba422e2adf2a43dce9f
850
Advent-Code-2022
Apache License 2.0
app/src/main/java/com/peluso/walletguru/model/Account.kt
pelusodan
351,481,020
false
null
package com.peluso.walletguru.model import com.kirkbushman.araw.models.Submission import com.peluso.walletguru.model.Account.Companion.orderSubmissions import java.util.* import kotlin.collections.ArrayList import kotlin.collections.LinkedHashMap import kotlin.math.abs /** * Class which represents a financial accoun...
0
Kotlin
0
0
c4b4bcd766612a4669bbfdba597fc1cbbc89e974
2,641
WalletGuru
MIT License
kotlin/src/main/kotlin/com/zortek/kata/yatzy/DiceRoll.kt
ZorteK
452,356,448
true
{"Java": 18208, "Kotlin": 14204, "C++": 12092, "Swift": 10541, "C#": 10261, "PHP": 10148, "TypeScript": 8658, "JavaScript": 8377, "Perl": 8167, "Clojure": 8035, "Python": 7794, "Ruby": 6749, "Elixir": 6335, "C": 6001, "CMake": 1327, "Makefile": 103, "Batchfile": 69}
package com.zortek.kata.yatzy import java.util.stream.Stream class DiceRoll(private val dice: List<Int>) { fun yatzy(): Boolean { return groupByValue() .values .any { it == 5 } } fun isFullHouse(): Boolean { val hasThreeOfAKind = getDiceWithCountGreaterThan(3) != 0...
0
Java
0
0
885ee1f9abdd9d88fd28eeea6b61e07d1b97f706
2,115
Yatzy-Refactoring-Kata
MIT License
kabac/src/main/kotlin/no/nav/personoversikt/common/kabac/CombiningAlgorithm.kt
navikt
505,819,547
false
{"Kotlin": 167360}
package no.nav.personoversikt.common.kabac import no.nav.personoversikt.common.kabac.utils.Key interface CombiningAlgorithm { fun combine(policies: List<Kabac.Policy>): Kabac.Policy companion object { val firstApplicable: CombiningAlgorithm = FirstApplicable() val denyOverride: CombiningAlgor...
1
Kotlin
0
0
64707e48b53bf939ee55eead605dd330d2f56e81
2,605
modia-common-utils
MIT License
src/commonMain/kotlin/io/github/alexandrepiveteau/graphs/algorithms/EdmondsKarp.kt
alexandrepiveteau
630,931,403
false
{"Kotlin": 132267}
@file:JvmName("Algorithms") @file:JvmMultifileClass package io.github.alexandrepiveteau.graphs.algorithms import io.github.alexandrepiveteau.graphs.* import io.github.alexandrepiveteau.graphs.builder.buildDirectedNetwork import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName import kotlin.math.min /** Returns...
9
Kotlin
0
6
a4fd159f094aed5b6b8920d0ceaa6a9c5fc7679f
3,109
kotlin-graphs
MIT License
src/day07/Day07.kt
schrami8
572,631,109
false
{"Kotlin": 18696}
package day07 import readInput enum class FileType { DIRECTORY, FILE } interface FileSystemObject { fun getName(): String fun getSize(): Int fun getType(): FileType fun addChild(child: FileSystemObject) fun getChildren(): List<FileSystemObject> fun getPar...
0
Kotlin
0
0
215f89d7cd894ce58244f27e8f756af28420fc94
4,509
advent-of-code-kotlin
Apache License 2.0
src/day6/fr/Day06_1.kt
BrunoKrantzy
433,844,189
false
{"Kotlin": 63580}
package day6.fr import java.io.File private fun readChars(): CharArray = readLn().toCharArray() private fun readLn() = readLine()!! // string line private fun readSb() = StringBuilder(readLn()) private fun readInt() = readLn().toInt() // single int private fun readLong() = readLn().toLong() // single long private fun...
0
Kotlin
0
0
0d460afc81fddb9875e6634ee08165e63c76cf3a
1,649
Advent-of-Code-2021
Apache License 2.0
src/test/kotlin/se/radicalcode/aoc/4Tests.kt
gwendo
162,547,004
false
null
package se.radicalcode.aoc import kotlin.test.assertEquals import org.junit.Test as test class TestGuardProblem { @test fun testParseEvent() { val input = "[1518-11-01 00:00] Guard #10 begins shift" val input2 = "[1518-10-16 23:59] Guard #409 begins shift" println(parseDate(input)) ...
0
Kotlin
0
0
12d0c841c91695e215f06efaf62d06a5480ba7a2
2,672
advent-of-code-2018
MIT License
src/main/kotlin/tr/emreone/adventofcode/days/Day25.kt
EmRe-One
433,772,813
false
{"Kotlin": 118159}
package tr.emreone.adventofcode.days import tr.emreone.kotlin_utils.Logger.logger import tr.emreone.kotlin_utils.automation.Day import tr.emreone.kotlin_utils.math.Point2D class Day25 : Day(25, 2021, "Sea Cucumber") { class SeaCucumber(input: List<String>) { private val width = input.first().length ...
0
Kotlin
0
0
516718bd31fbf00693752c1eabdfcf3fe2ce903c
3,209
advent-of-code-2021
Apache License 2.0
017. Find Three Largest Numbers/FindThreeLargestNumbers.kt
jerrycychen
461,704,376
false
{"Java": 46772, "Kotlin": 35765}
package com.algoexpert.program fun findThreeLargestNumbers(array: List<Int>): List<Int> { val threeLargest = mutableListOf(Int.MIN_VALUE, Int.MIN_VALUE, Int.MIN_VALUE) for (num in array) { updateLargest(threeLargest, num) } return threeLargest } fun updateLargest(threeLargest: MutableList<Int>...
0
Java
3
4
c853c5935c202520f74650c85d1ed70ff398b2ea
846
algoexpert
MIT License
src/main/kotlin/se/saidaspen/aoc/aoc2021/Day16.kt
saidaspen
354,930,478
false
{"Kotlin": 301372, "CSS": 530}
package se.saidaspen.aoc.aoc2021 import se.saidaspen.aoc.util.Day import se.saidaspen.aoc.util.StringTokenizer import se.saidaspen.aoc.util.toBinary import java.lang.RuntimeException fun main() = Day16.run() object Day16 : Day(2021, 16) { override fun part1(): Any { val decoder = PacketDecoder() ...
0
Kotlin
0
1
be120257fbce5eda9b51d3d7b63b121824c6e877
3,707
adventofkotlin
MIT License
src/day04/Day04.kt
Frank112
572,910,492
false
null
package day04 import assertThat import readInput fun main() { val inputParseRegex = Regex("^(\\d+)-(\\d+),(\\d+)-(\\d+)$") fun parseInput(input: List<String>): List<Pair<CleaningAssignment, CleaningAssignment>> { return input.map { l -> inputParseRegex.matchEntire(l)!!.groupValues.drop(1).map { s ->...
0
Kotlin
0
0
1e927c95191a154efc0fe91a7b89d8ff526125eb
1,175
advent-of-code-2022
Apache License 2.0
kotlin/11.kt
NeonMika
433,743,141
false
{"Kotlin": 68645}
class Day11 : Day<TwoDimensionalArray<Int>>("11") { override fun dataStar1(lines: List<String>): TwoDimensionalArray<Int> = TwoDimensionalArray(lines.map { it.toCharArray().map(Char::digitToInt) }) override fun dataStar2(lines: List<String>): TwoDimensionalArray<Int> = dataStar1(lines) fun step(da...
0
Kotlin
0
0
c625d684147395fc2b347f5bc82476668da98b31
1,563
advent-of-code-2021
MIT License
src/Day1/Day01.kt
lukeqwas
573,403,156
false
null
package Day1 import readInput fun main() { // 4*O(N) == O(N) val testInput = readInput("Day01") val totalElfCalories = mutableListOf<Long>() var curCalorie = 0L for (calorie in testInput) { if(calorie.equals("")) { totalElfCalories.add(curCalorie) curCalorie = 0 ...
0
Kotlin
0
0
6174a8215f8d4dc6d33fce6f8300a4a8999d5431
1,082
aoc-kotlin-2022
Apache License 2.0
base/src/main/java/com/mindera/skeletoid/utils/versioning/Versioning.kt
Mindera
85,591,428
false
null
package com.mindera.skeletoid.utils.versioning import kotlin.math.sign object Versioning { /** * Compares two version strings. * Credits to: https://gist.github.com/antalindisguise/d9d462f2defcfd7ae1d4 * * Use this instead of String.compareTo() for a non-lexicographical * comparison that...
7
Kotlin
3
24
881de796fbbe835c74f69f36ccf327bdcb0029f3
1,942
skeletoid
MIT License
src/main/kotlin/at2020/day1/At2020Day1KTS.kt
JeanBarbosa27
575,328,729
false
{"Kotlin": 10872}
package at2020.day1 import java.io.File class At2020Day1KTS { private val numbers = File("src/main/kotlin/at2020/day1/expense-report.txt").readLines().map(String::toInt) private fun partOneEasiestWay(targetSum: Int) { for(firstNumber in numbers) { for (secondNumber in numbers) { ...
0
Kotlin
0
0
62c4e514cd9a306e6a4b5dbd0c146213f08e05f3
2,328
advent-of-code-solving-kotlin
MIT License
src/main/kotlin/com/github/asher_stern/parser/tree/TreeUtils.kt
asher-stern
109,838,279
false
null
package com.github.asher_stern.parser.tree import com.github.asher_stern.parser.grammar.NakedRule import com.github.asher_stern.parser.grammar.SyntacticItem import com.github.asher_stern.parser.utils.Array1 import java.util.* /** * Created by <NAME> on November-03 2017. */ fun <N, T> extractNakedRuleFromNode(conte...
0
Kotlin
0
0
4d54f49eae47260a299ca375fc5442f002032116
2,708
parser
MIT License
q3/question3.kt
engividal
254,778,920
false
null
// 3. Check words with typos: // There are three types of typos that can be performed on strings: insert a character, // remove a character, or replace a character. Given two strings, write a function to // check if they are one typo (or zero typos) away. // Examples: // pale, ple ­> true // pales, pale ­> true // pale...
0
Kotlin
0
0
930a76acd5e87c7083785772762be829b92bb917
1,517
code-challenge
MIT License
kt-fuzzy/src/commonMain/kotlin/ca.solostudios.fuzzykt/FuzzyKt.kt
solo-studios
420,274,115
false
{"Kotlin": 201452, "SCSS": 10556, "JavaScript": 3786, "FreeMarker": 2581}
/* * kt-fuzzy - A Kotlin library for fuzzy string matching * Copyright (c) 2021-2023 solonovamax <<EMAIL>> * * The file FuzzyKt.kt is part of kotlin-fuzzy * Last modified on 01-08-2023 10:18 p.m. * * MIT License * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this softwar...
2
Kotlin
0
5
b3ae4f9f0e15ee38feb81b0edd88cdad68124b21
3,623
kt-fuzzy
MIT License
src/day06/Day06.kt
skempy
572,602,725
false
{"Kotlin": 13581}
package day06 import readInputAsList fun main() { fun findMarker( input: List<String>, sizeOfPacket: Int, ): Int { return input.first() .windowed(sizeOfPacket) .indexOfFirst { packet -> packet.toSet().size == sizeOfPacket } + sizeOfPacket } fun part1(...
0
Kotlin
0
0
9b6997b976ea007735898083fdae7d48e0453d7f
960
AdventOfCode2022
Apache License 2.0
src/main/kotlin/adventofcode/day16/Volcano.kt
jwcarman
573,183,719
false
{"Kotlin": 183494}
/* * Copyright (c) 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 i...
0
Kotlin
0
0
d6be890aa20c4b9478a23fced3bcbabbc60c32e0
2,734
adventofcode2022
Apache License 2.0
src/Day05.kt
petoS6
573,018,212
false
{"Kotlin": 14258}
fun main() { fun part1(input: List<String>): String { input.moves().forEach { move -> val crate = crates[move.second].takeLast(move.first).reversed() repeat(move.first) { crates[move.second].removeLast() } crates[move.third] = crates[move.third].apply { addAll(crate) } } return crates.j...
0
Kotlin
0
0
40bd094155e664a89892400aaf8ba8505fdd1986
1,849
kotlin-aoc-2022
Apache License 2.0
classroom/src/main/kotlin/com/radix2/algorithms/week4/MaxPQ.kt
rupeshsasne
190,130,318
false
{"Java": 66279, "Kotlin": 50290}
package com.radix2.algorithms.week4 class MaxPQ<T : Comparable<T>>(capacity: Int) { private var array = Array<Comparable<Any>?>(capacity) { null } private var n = 0 companion object { @Suppress("UNCHECKED_CAST") fun <T : Comparable<T>> sort(array: Array<Comparable<T>>) { for ...
0
Java
0
1
341634c0da22e578d36f6b5c5f87443ba6e6b7bc
2,468
coursera-algorithms-part1
Apache License 2.0
2021/src/test/kotlin/Day16.kt
jp7677
318,523,414
false
{"Kotlin": 171284, "C++": 87930, "Rust": 59366, "C#": 1731, "Shell": 354, "CMake": 338}
import kotlin.test.Test import kotlin.test.assertEquals class Day16 { @Test fun `run part 01`() { val bits = getTransmissionBits() val version = getPacket(bits).first assertEquals(960, version) } @Test fun `run part 02`() { val bits = getTransmissionBits() ...
0
Kotlin
1
2
8bc5e92ce961440e011688319e07ca9a4a86d9c9
3,745
adventofcode
MIT License
2019/DEC02/src/main/kotlin/day2/App.kt
PeteShepley
318,600,713
false
{"Java": 34659, "Swift": 17998, "Kotlin": 13744, "JavaScript": 11010, "Python": 10738, "Ruby": 9264, "Groovy": 7165, "TypeScript": 6589, "Clojure": 5976, "C#": 5078, "Lua": 4960, "Pascal": 2496, "Go": 2408, "Rust": 2219, "CMake": 1776, "C++": 776, "C": 640, "Shell": 131}
package day2 class Computer(val program: Array<Int>) { private var pointer: Int = 0 fun execute() { while (pointer < program.size) { when (program[pointer]) { 1 -> { add() pointer += 4 } 2 -> { mult() pointer += 4 } 99 -> po...
0
Java
0
0
f9679c17054e7d74b9cb3d1f11cef722aa1df0ec
1,658
advent-of-code
MIT License
src/Day01.kt
StrixG
572,554,618
false
{"Kotlin": 2622}
fun main() { fun part1(input: List<String>): Int { var calories = 0 var maxCalories = 0 for (line: String in input) { if (line.isBlank()) { if (calories > maxCalories) { maxCalories = calories } calories = 0 ...
0
Kotlin
0
0
85f2f28197ad54d8c4344470f0ba80307b068680
1,089
advent-of-code-2022
Apache License 2.0
src/main/aoc2021/Day18.kt
nibarius
154,152,607
false
{"Kotlin": 963896}
package aoc2021 import java.util.* /** * Uses a linked list of Tokens as a representation of snailfish numbers. Operations such as * add, explode and split modifies the linked list given as (first) argument. */ class Day18(input: List<String>) { sealed interface Token { data object Open : Token ...
0
Kotlin
0
6
f2ca41fba7f7ccf4e37a7a9f2283b74e67db9f22
5,144
aoc
MIT License
src/main/kotlin/days/Day8.kt
andilau
726,429,411
false
{"Kotlin": 37060}
package days @AdventOfCodePuzzle( name = "<NAME>", url = "https://adventofcode.com/2023/day/8", date = Date(day = 8, year = 2023) ) class Day8(input: List<String>) : Puzzle { private val instructions: String = input.first() private val routeFromTo: Map<String, Pair<String, String>> = input.drop(2)...
3
Kotlin
0
0
9a1f13a9815ab42d7fd1d9e6048085038d26da90
1,184
advent-of-code-2023
Creative Commons Zero v1.0 Universal
utility/src/main/java/org/oppia/android/util/math/PolynomialExtensions.kt
oppia
148,093,817
false
{"Kotlin": 12174721, "Starlark": 666467, "Java": 33231, "Shell": 12716}
package org.oppia.android.util.math import org.oppia.android.app.model.Fraction import org.oppia.android.app.model.Polynomial import org.oppia.android.app.model.Polynomial.Term import org.oppia.android.app.model.Polynomial.Term.Variable import org.oppia.android.app.model.Real /** Represents a single-term constant pol...
508
Kotlin
491
285
4a07d8db69e395c9e076c342c0d1dc3521ff3051
20,936
oppia-android
Apache License 2.0
src/Day04.kt
er453r
572,440,270
false
{"Kotlin": 69456}
fun main() { val inputLineRegex = """\d""".toRegex() fun lineToSets(line: String): Pair<Set<Int>, Set<Int>> { val (start1, end1, start2, end2) = inputLineRegex.findAll(line).map { it.value.toInt() }.toList() return Pair((start1..end1).toSet(), (start2..end2).toSet()) } fun part1(input...
0
Kotlin
0
0
9f98e24485cd7afda383c273ff2479ec4fa9c6dd
711
aoc2022
Apache License 2.0
2023/src/day09/Day09.kt
scrubskip
160,313,272
false
{"Kotlin": 198319, "Python": 114888, "Dart": 86314}
package day09 import java.io.File fun main() { val input = File("src/day09/day09.txt").readLines() println(getSumOfSequence(input)) println(getSumOfSequence(input, false)) } fun getSumOfSequence(input: List<String>, next: Boolean = true) = input.map { it.split(" ").map { value -> value.toLong() } } ...
0
Kotlin
0
0
a5b7f69b43ad02b9356d19c15ce478866e6c38a1
1,512
adventofcode
Apache License 2.0
src/Day07.kt
mhuerster
572,728,068
false
{"Kotlin": 24302}
fun main() { val cdRegex = "\\\$\\scd\\s(.*)".toRegex() // Captures directory to cd into, or `..` val directoryRegex = "dir\\s(\\w+)".toRegex() val fileNameRegex = "(\\d+)\\s(\\w+\\.?\\w*)".toRegex() val totalSpace = 70000000 val freeSpaceNeeded = 30000000 open class FakeFile(var name: String,...
0
Kotlin
0
0
5f333beaafb8fe17ff7b9d69bac87d368fe6c7b6
5,946
2022-advent-of-code
Apache License 2.0
src/main/kotlin/io/github/clechasseur/adventofcode2021/Day10.kt
clechasseur
435,726,930
false
{"Kotlin": 315943}
package io.github.clechasseur.adventofcode2021 import io.github.clechasseur.adventofcode2021.data.Day10Data object Day10 { private val data = Day10Data.data fun part1(): Int = data.lines().map { Line(it).corruptionScore }.filter { it != 0 }.sum() fun part2(): Long { val autocompletedLines = data...
0
Kotlin
0
0
4b893c001efec7d11a326888a9a98ec03241d331
2,375
adventofcode2021
MIT License
kotlin/1129-shortest-path-with-alternating-colors.kt
neetcode-gh
331,360,188
false
{"JavaScript": 473974, "Kotlin": 418778, "Java": 372274, "C++": 353616, "C": 254169, "Python": 207536, "C#": 188620, "Rust": 155910, "TypeScript": 144641, "Go": 131749, "Swift": 111061, "Ruby": 44099, "Scala": 26287, "Dart": 9750}
class Solution { fun shortestAlternatingPaths(n: Int, redEdges: Array<IntArray>, blueEdges: Array<IntArray>): IntArray { val redAdj = Array(n) { ArrayList<Int>() } val blueAdj = Array(n) { ArrayList<Int>() } val redVisit = HashSet<Int>() val blueVisit = HashSet<Int>() for...
337
JavaScript
2,004
4,367
0cf38f0d05cd76f9e96f08da22e063353af86224
1,460
leetcode
MIT License
src/main/kotlin/co/csadev/advent2022/Day15.kt
gtcompscientist
577,439,489
false
{"Kotlin": 252918}
/** * Copyright (c) 2022 by <NAME> * Advent of Code 2022, Day 15 * Problem Description: http://adventofcode.com/2021/day/15 */ package co.csadev.advent2022 import co.csadev.adventOfCode.BaseDay import co.csadev.adventOfCode.Point2D import co.csadev.adventOfCode.Resources.resourceAsList import kotlin.math.max impor...
0
Kotlin
0
1
43cbaac4e8b0a53e8aaae0f67dfc4395080e1383
2,326
advent-of-kotlin
Apache License 2.0
src/hongwei/leetcode/playground/leetcodecba/M56MergeIntervals.kt
hongwei-bai
201,601,468
false
{"Java": 143669, "Kotlin": 38875}
package hongwei.leetcode.playground.leetcodecba import hongwei.leetcode.playground.common.print import kotlin.experimental.or class M56MergeIntervals { fun test() { // val input = arrayOf(intArrayOf(1, 3), intArrayOf(2, 6), intArrayOf(8, 10), intArrayOf(15, 18)) // val input = arrayOf(intArrayOf(5, ...
0
Java
0
1
9d871de96e6b19292582b0df2d60bbba0c9a895c
3,949
leetcode-exercise-playground
Apache License 2.0
src/main/kotlin/advent/day2/Dive.kt
hofiisek
434,171,205
false
{"Kotlin": 51627}
package advent.day2 import advent.loadInput import java.io.File /** * @author <NAME> */ data class Position(val horizontalPos: Int = 0, val depth: Int = 0) data class PositionWithAim(val horizontalPos: Int = 0, val depth: Int = 0, val aim: Int = 0) sealed class Move(open val step: Int) data class Up(override val ...
0
Kotlin
0
2
3bd543ea98646ddb689dcd52ec5ffd8ed926cbbb
1,981
Advent-of-code-2021
MIT License
kotlinLeetCode/src/main/kotlin/leetcode/editor/cn/[96]不同的二叉搜索树.kt
maoqitian
175,940,000
false
{"Kotlin": 354268, "Java": 297740, "C++": 634}
import javax.swing.tree.TreeNode //给你一个整数 n ,求恰由 n 个节点组成且节点值从 1 到 n 互不相同的 二叉搜索树 有多少种?返回满足题意的二叉搜索树的种数。 // // // // 示例 1: // // //输入:n = 3 //输出:5 // // // 示例 2: // // //输入:n = 1 //输出:1 // // // // // 提示: // // // 1 <= n <= 19 // // Related Topics 树 二叉搜索树 数学 动态规划 二叉树 // 👍 1384 👎 0 //leetcode submit regio...
0
Kotlin
0
1
8a85996352a88bb9a8a6a2712dce3eac2e1c3463
1,027
MyLeetCode
Apache License 2.0
src/Day02.kt
AlaricLightin
572,897,551
false
{"Kotlin": 87366}
fun main() { fun part1(inputFilename: String): Int { var result = 0 getInputFile(inputFilename).forEachLine { if (it.isBlank()) return@forEachLine val first = it[0] val second = it[2] result += (when (second) { 'X' -> 1 ...
0
Kotlin
0
0
ee991f6932b038ce5e96739855df7807c6e06258
1,621
AdventOfCode2022
Apache License 2.0
src/main/kotlin/g0501_0600/s0508_most_frequent_subtree_sum/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g0501_0600.s0508_most_frequent_subtree_sum // #Medium #Hash_Table #Depth_First_Search #Tree #Binary_Tree // #2023_01_10_Time_246_ms_(80.00%)_Space_38.4_MB_(93.33%) import com_github_leetcode.TreeNode /* * Example: * var ti = TreeNode(5) * var v = ti.`val` * Definition for a binary tree node. * class Tre...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,052
LeetCode-in-Kotlin
MIT License
src/main/kotlin/org/n52/spare/kicker/rankings/MatchpointsAlgorithmImpl.kt
matthesrieke
240,745,271
false
null
package org.n52.spare.kicker.rankings import org.n52.spare.kicker.model.Match import org.n52.spare.kicker.model.Player import org.n52.spare.kicker.model.Rank class MatchpointsAlgorithmImpl : RankingsAlgorithm { private val ranks: MutableMap<Player, Rank> = mutableMapOf() override fun calculateForMatches(matches...
3
Kotlin
0
0
efe974a4865f8395d6d8fc901050c0e4aafede95
1,926
kicker-league-rest
Apache License 2.0
year2020/day02/part1/src/main/kotlin/com/curtislb/adventofcode/year2020/day02/part1/Year2020Day02Part1.kt
curtislb
226,797,689
false
{"Kotlin": 2146738}
/* --- Day 2: Password Philosophy --- Your flight departs in a few days from the coastal airport; the easiest way down to the coast from here is via toboggan. The shopkeeper at the North Pole Toboggan Rental Shop is having a bad day. "Something's wrong with our computers; we can't log in!" You ask if you can take a l...
0
Kotlin
1
1
6b64c9eb181fab97bc518ac78e14cd586d64499e
1,925
AdventOfCode
MIT License
src/main/kotlin/days/Day16.kt
butnotstupid
433,717,137
false
{"Kotlin": 55124}
package days class Day16 : Day(16) { private val toValueOne = { packet: Packet -> packet.version.toLong() + packet.subPackets.sumOf { it.value!! } } private val toOperatorOne = { _: Int -> Iterable<Long>::sum } override fun partOne(): Any { val reader = inputList.first().flatMap { toBinary(it) }....
0
Kotlin
0
0
a06eaaff7e7c33df58157d8f29236675f9aa7b64
4,028
aoc-2021
Creative Commons Zero v1.0 Universal
classifying-usecase/src/main/java/com/github/kamil1338/classifying_usecase/classifying/ResultCalculator.kt
kamilpierudzki
227,631,855
false
{"Kotlin": 135174}
package com.github.kamil1338.classifying_usecase.classifying import com.github.kamil1338.classifying_usecase.classifying.ClassifyingUseCase.Companion.RESULTS_TO_SHOW import java.util.* import kotlin.Comparator typealias MapEntry = Map.Entry<Int, Float> class ResultCalculator { fun getMostProbableIndexAndItsValu...
0
Kotlin
0
0
710ad15cd83504ae6383c6121ef76b8f0f83f1e0
3,101
ml-androidplatform
Apache License 2.0
src/main/kotlin/engineer/thomas_werner/euler/Problem18.kt
huddeldaddel
183,355,188
true
{"Kotlin": 116039, "Java": 34495}
package engineer.thomas_werner.euler fun main(args: Array<String>) { var problem18 = Problem18("""75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 1...
0
Kotlin
1
0
df514adde8c62481d59e78a44060dc80703b8f9f
1,229
euler
MIT License
src/main/kotlin/day04/Day04.kt
vitalir2
572,865,549
false
{"Kotlin": 89962}
package day04 import Challenge import toIntRange object Day04 : Challenge(4) { override fun part1(input: List<String>): Int { return countNumberOfElvesPairs(input) { firstInterval, secondInterval -> firstInterval.containsAll(secondInterval) || secondInterval.containsAll(firstInterval) ...
0
Kotlin
0
0
ceffb6d4488d3a0e82a45cab3cbc559a2060d8e6
1,017
AdventOfCode2022
Apache License 2.0
src/Day02.kt
Schneider-David
573,092,941
false
{"Kotlin": 2695}
import java.io.File //Nice straightforward way from blog by <NAME> private val part1Scores: Map<String, Int> = 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, ...
0
Kotlin
0
1
af9c5991056eccd3d96cdfb09bdbcf853e12a4ef
953
kotlin-avent-of-code-template
Apache License 2.0
src/main/kotlin/g2401_2500/s2488_count_subarrays_with_median_k/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g2401_2500.s2488_count_subarrays_with_median_k // #Hard #Array #Hash_Table #Prefix_Sum #2023_07_05_Time_464_ms_(100.00%)_Space_51.1_MB_(100.00%) class Solution { fun countSubarrays(nums: IntArray, k: Int): Int { var idx: Int val n = nums.size var ans = 0 idx = 0 whi...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,345
LeetCode-in-Kotlin
MIT License
src/main/kotlin/com/ginsberg/advent2017/Day15.kt
tginsberg
112,672,087
false
null
/* * Copyright (c) 2017 by <NAME> */ package com.ginsberg.advent2017 /** * AoC 2017, Day 15 * * Problem Description: http://adventofcode.com/2017/day/15 * Blog Post/Commentary: https://todd.ginsberg.com/post/advent-of-code/2017/day15/ */ class Day15(input: List<String>) { private val notNumbers = """[^\d]...
0
Kotlin
0
15
a57219e75ff9412292319b71827b35023f709036
1,140
advent-2017-kotlin
MIT License
4/b.kt
DarkoKukovec
159,875,185
false
{"JavaScript": 38238, "Kotlin": 9620}
import java.io.File; data class MostAsleep(val time: Int, val min: Int, val id: String) fun main4B() { var lastGuard: String = ""; var guards: MutableMap<String, MutableMap<Int, Int>> = mutableMapOf(); File("input.txt") .readText(Charsets.UTF_8) .split("\n") .sorted() .map({ line: String -> run ...
0
JavaScript
0
0
58a46dcb9c3e493f91d773ccc0440db9bd3b24b5
1,490
adventofcode2018
MIT License
src/main/kotlin/year2022/day-13.kt
ppichler94
653,105,004
false
{"Kotlin": 182859}
package year2022 import lib.aoc.Day import lib.aoc.Part import kotlin.math.sign fun main() { Day(13, 2022, PartA13(), PartB13()).run() } open class PartA13 : Part() { internal lateinit var packetPairs: List<Pair<List<Any>, List<Any>>> override fun parse(text: String) { val pairs = text.split("\n...
0
Kotlin
0
0
49dc6eb7aa2a68c45c716587427353567d7ea313
4,076
Advent-Of-Code-Kotlin
MIT License
src/main/kotlin/me/giacomozama/adventofcode2022/days/Day15.kt
giacomozama
572,965,253
false
{"Kotlin": 75671}
package me.giacomozama.adventofcode2022.days import java.io.File import java.util.PriorityQueue import kotlin.math.abs class Day15 : Day() { private lateinit var input: List<IntArray> override fun parseInput(inputFile: File) { val regex = """Sensor at x=(-?\d+), y=(-?\d+): closest beacon is at x=(-?...
0
Kotlin
0
0
c30f4a37dc9911f3e42bbf5088fe246aabbee239
2,713
aoc2022
MIT License
leetcode2/src/leetcode/queue-reconstruction-by-height.kt
hewking
68,515,222
false
null
package leetcode /** * 406. 根据身高重建队列 * https://leetcode-cn.com/problems/queue-reconstruction-by-height/ * Created by test * Date 2019/11/23 12:12 * Description * 假设有打乱顺序的一群人站成一个队列。 每个人由一个整数对(h, k)表示,其中h是这个人的身高,k是排在这个人前面且身高大于或等于h的人数。 编写一个算法来重建这个队列。 注意: 总人数少于1100人。 示例 输入: [[7,0], [4,4], [7,1], [5,0], [6,1], [5,...
0
Kotlin
0
0
a00a7aeff74e6beb67483d9a8ece9c1deae0267d
1,855
leetcode
MIT License
src/main/kotlin/day3/Day3.kt
Wicked7000
573,552,409
false
{"Kotlin": 106288}
package day3 import Day import checkWithMessage import readInput import runTimedPart @Suppress("unused") class Day3(): Day() { private fun getItemPriority(item: Char): Int { var score = item.code if(score >= 97){ //Lowercase score -= 96 } else if(score >= 65){ ...
0
Kotlin
0
0
7919a8ad105f3b9b3a9fed048915b662d3cf482d
2,626
aoc-2022
Apache License 2.0
src/Day01.kt
haraldsperre
572,671,018
false
{"Kotlin": 17302}
fun main() { fun getCollections(input: List<String>): List<Int> { return input .chunkedBy { it.isEmpty() } .map { elf -> elf.sumOf { it.toInt() } } } fun part1(input: List<String>): Int = getCollections(input).maxOrNull() ?: 0 fun par...
0
Kotlin
0
0
c4224fd73a52a2c9b218556c169c129cf21ea415
696
advent-of-code-2022
Apache License 2.0
src/Day12.kt
GarrettShorr
571,769,671
false
{"Kotlin": 82669}
import java.util.LinkedList import java.util.PriorityQueue fun main() { // class Point(var row: Int, var col: Int, var height: Int, var parent: Point? = null) { // fun getPos() : Pair<Int, Int> { return Pair(row, col) } // override fun toString(): String { // return "Point(row=$row, col=$col, height=$heigh...
0
Kotlin
0
0
391336623968f210a19797b44d027b05f31484b5
10,400
AdventOfCode2022
Apache License 2.0
2019/day10/asteroids.kt
sergeknystautas
226,467,020
false
null
package aoc2019.day10; import java.io.File; import kotlin.system.exitProcess; import kotlin.math.hypot; import kotlin.math.atan; import kotlin.math.PI; // import kotlin.Double.NaN; fun Loadcodes(filename: String) : List<String> { return File(filename).readLines(); } fun Splitcodes(opcodes: String, delim: String)...
0
Kotlin
0
0
38966bc742f70122681a8885e986ed69dd505243
7,078
adventofkotlin2019
Apache License 2.0
kotlin/837.Most Common Word(最常见的单词).kt
learningtheory
141,790,045
false
{"Python": 4025652, "C++": 1999023, "Java": 1995266, "JavaScript": 1990554, "C": 1979022, "Ruby": 1970980, "Scala": 1925110, "Kotlin": 1917691, "Go": 1898079, "Swift": 1827809, "HTML": 124958, "Shell": 7944}
/** <p>Given a paragraph&nbsp;and a list of banned words, return the most frequent word that is not in the list of banned words.&nbsp; It is guaranteed there is at least one word that isn&#39;t banned, and that the answer is unique.</p> <p>Words in the list of banned words are given in lowercase, and free of punctuati...
0
Python
1
3
6731e128be0fd3c0bdfe885c1a409ac54b929597
5,583
leetcode
MIT License
src/main/kotlin/com.supesuba.smoothing/Vector.kt
23alot
245,768,268
false
null
package com.supesuba.smoothing import kotlin.math.sqrt data class Vector( val x: Float, val y: Float, val z: Float ) { operator fun div(value: Float): Vector = Vector( x = this.x / value, y = this.y / value, z = this.z / value ) operator fun ti...
0
Kotlin
0
0
2b8283f79d89aff92604e6007b26e11dbd1f888a
3,373
smoothing-algorithm
Apache License 2.0
src/main/kotlin/dynamicprogramming/SplitArrayLargestSum.kt
e-freiman
471,473,372
false
{"Kotlin": 78010}
package dynamicprogramming private var memo = arrayOf<IntArray>() fun dp(nums: IntArray, m: Int, index: Int): Int { if (memo[m][index] != -1) { return memo[m][index] } if (m == 1) { var sum = 0 for (i in index .. nums.lastIndex) { sum += nums[i] } memo[m...
0
Kotlin
0
0
fab7f275fbbafeeb79c520622995216f6c7d8642
847
LeetcodeGoogleInterview
Apache License 2.0
src/test/kotlin/aoc/Day7.kt
Lea369
728,236,141
false
{"Kotlin": 36118}
package aoc_2023 import org.junit.jupiter.api.Nested import java.nio.file.Files import java.nio.file.Paths import java.util.stream.Collectors import kotlin.test.Test import kotlin.test.assertEquals class Day7 { data class Hand(val cards: String, val bet: Int) private val possibleCards: List<Char> = listOf('...
0
Kotlin
0
0
1874184df87d7e494c0ff787ea187ea3566fbfbb
2,366
AoC
Apache License 2.0
src/Day06_withWindowed.kt
arisaksen
573,116,584
false
{"Kotlin": 42887}
import org.assertj.core.api.Assertions.assertThat // https://adventofcode.com/2022/day/6 fun main() { val moreThanTwoEqual = """^.*(.).*\1.*${'$'}""".toRegex() val part1WindowSize = 4 val part2WindowSize = 14 fun part1(input: String): Int = input.asSequence() .windowed(part1WindowS...
0
Kotlin
0
0
85da7e06b3355f2aa92847280c6cb334578c2463
1,339
aoc-2022-kotlin
Apache License 2.0
src/2022/Day25.kt
nagyjani
572,361,168
false
{"Kotlin": 369497}
package `2022` import java.io.File import java.math.BigInteger import java.util.* fun main() { Day25().solve() } class Day25 { val input1 = """ 1=-0-2 12111 2=0= 21 2=01 111 20012 112 1=-1= 1-12 12 1= 12...
0
Kotlin
0
0
f0c61c787e4f0b83b69ed0cde3117aed3ae918a5
1,737
advent-of-code
Apache License 2.0
aoc-2023/src/main/kotlin/aoc/aoc23.kts
triathematician
576,590,518
false
{"Kotlin": 615974}
import aoc.AocParser.Companion.parselines import aoc.* import aoc.util.* val testInput = """ #.##################### #.......#########...### #######.#########.#.### ###.....#.>.>.###.#.### ###v#####.#v#.###.#.### ###.>...#.#.#.....#...# ###v###.#.#.#########.# ###...#.#.#.......#...# #####.#.#.#######.#.### #.....#.#....
0
Kotlin
0
0
7b1b1542c4bdcd4329289c06763ce50db7a75a2d
7,502
advent-of-code
Apache License 2.0