path
stringlengths
5
169
owner
stringlengths
2
34
repo_id
int64
1.49M
755M
is_fork
bool
2 classes
languages_distribution
stringlengths
16
1.68k
content
stringlengths
446
72k
issues
float64
0
1.84k
main_language
stringclasses
37 values
forks
int64
0
5.77k
stars
int64
0
46.8k
commit_sha
stringlengths
40
40
size
int64
446
72.6k
name
stringlengths
2
64
license
stringclasses
15 values
app/src/main/java/dev/patrickgold/florisboard/ime/nlp/FlorisLanguageModel.kt
stefan-misik
357,279,068
true
{"Kotlin": 793069, "HTML": 58856, "Python": 429}
/* * Copyright (C) 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 wr...
0
Kotlin
0
0
e9fc3246d834d626b073563c175a4a1445b739f1
11,118
florisboard
Apache License 2.0
src/main/kotlin/com/leetcode/P720.kt
antop-dev
229,558,170
false
{"Kotlin": 695315, "Java": 213000}
package com.leetcode // https://github.com/antop-dev/algorithm/issues/267 class P720 { fun longestWord(words: Array<String>): String { val root = TrieNode() var answer = "" words.sortWith( Comparator<String> { o1, o2 -> o1.length - o2.length } .then(Comparator ...
1
Kotlin
0
0
9a3e762af93b078a2abd0d97543123a06e327164
1,136
algorithm
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/AdvantageCount.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,590
kotlab
Apache License 2.0
deprecated/fn-mmg-validator/src/main/kotlin/gov/cdc/dex/hl7/model/ValidationIssue.kt
CDCgov
510,836,864
false
{"Kotlin": 746627, "Scala": 208820, "Python": 44391, "Java": 18075, "Batchfile": 11894, "Go": 8661, "JavaScript": 7609, "Groovy": 4230, "HTML": 2177, "Shell": 1362, "CSS": 979}
package gov.cdc.dex.hl7.model enum class ValidationIssueCategoryType(val message: String) { ERROR("Error"), WARNING("Warning"); } enum class ValidationIssueType(val message: String) { DATA_TYPE("data_type"), CARDINALITY("cardinality"), VOCAB("vocabulary"), SEGMENT_NOT_IN_MMG("segment_not_in...
118
Kotlin
14
9
e859ed7c4d5feb3a97acd6e3faef1382487a689f
2,055
data-exchange-hl7
Apache License 2.0
src/main/kotlin/se/saidaspen/aoc/aoc2015/Day23.kt
saidaspen
354,930,478
false
{"Kotlin": 301372, "CSS": 530}
package se.saidaspen.aoc.aoc2015 import se.saidaspen.aoc.util.Day import se.saidaspen.aoc.util.words fun main() { Day23.run() } object Day23 : Day(2015, 23) { class Computer { var registers = mutableMapOf<String, Int>() private var pc = 0 fun run(program: List<Op>) { whi...
0
Kotlin
0
1
be120257fbce5eda9b51d3d7b63b121824c6e877
2,585
adventofkotlin
MIT License
src/2020/Day16_1.kts
Ozsie
318,802,874
false
{"Kotlin": 99344, "Python": 1723, "Shell": 975}
/** * As you're walking to yet another connecting flight, you realize that one of the legs of your * re-routed trip coming up is on a high-speed train. However, the train ticket you were given is * in a language you don't understand. You should probably figure out what it says before you get * to the train station ...
0
Kotlin
0
0
d938da57785d35fdaba62269cffc7487de67ac0a
4,715
adventofcode
MIT License
src/main/kotlin/ru/nrcki/biokotlin/tetra.kt
laxeye
164,879,760
false
null
package ru.nrcki.biokotlin import ru.nrcki.biokotlin.io.Fasta class Tetra(){ fun makeTetraList(redundant: Boolean = false): List<String>{ val dinucs = mutableListOf<String>() val tetranucs = mutableListOf<String>() val nucs = listOf("A","C","G","T") for(n in nucs){ nucs.map{dinucs.add(n + it)} } i...
7
Kotlin
0
0
fb86e738ee31a082bb71e2c8a73d34e65197f2eb
2,149
BioKotlin
MIT License
src/main/kotlin/day16/Day16.kt
alxgarcia
435,549,527
false
{"Kotlin": 91398}
package day16 import java.io.File import java.util.Optional sealed interface Packet { val version: Int val value: Long } data class Literal(override val version: Int, override val value: Long) : Packet data class Op(override val version: Int, private val type: Int, val packets: List<Packet>) : Packet { overri...
0
Kotlin
0
0
d6b10093dc6f4a5fc21254f42146af04709f6e30
3,715
advent-of-code-2021
MIT License
src/main/kotlin/com/tradeshift/suggest/Model.kt
liufuyang
140,750,099
false
{"Kotlin": 21637, "Python": 1174}
package com.tradeshift.suggest import com.tradeshift.suggest.features.Inputs import com.tradeshift.suggest.features.Update import com.tradeshift.suggest.features.WordCounter import com.tradeshift.suggest.storage.ModelTableStorage import com.tradeshift.suggest.storage.Storage import kotlin.math.ln class Model( ...
0
Kotlin
0
0
dce2136e35abeb7729f3ce9639d5ac1163116dbb
4,961
pblayze
MIT License
rtron-math/src/main/kotlin/io/rtron/math/range/RangeExtensions.kt
tum-gis
258,142,903
false
{"Kotlin": 1425220, "C": 12590, "Dockerfile": 511, "CMake": 399, "Shell": 99}
package io.rtron.math.range /** * Returns the intersecting [Range] of a provided set of ranges. * * @receiver provided set of ranges for which the intersecting range shall be found * @return maximum range that intersects all ranges within the set */ fun <T : Comparable<*>> Set<Range<T>>.intersectingRange(): Range...
4
Kotlin
12
38
27969aee5a0c8115cb5eaf085ca7d4c964e1f033
1,121
rtron
Apache License 2.0
src/main/kotlin/days/Day16.kt
hughjdavey
725,972,063
false
{"Kotlin": 76988}
package days import days.Day14.Direction.EAST import days.Day14.Direction.NORTH import days.Day14.Direction.SOUTH import days.Day14.Direction.WEST import xyz.hughjd.aocutils.Coords.Coord class Day16 : Day(16) { private val grid = BeamGrid(inputList) override fun partOne(): Any { return grid.getEnerg...
0
Kotlin
0
0
330f13d57ef8108f5c605f54b23d04621ed2b3de
4,232
aoc-2023
Creative Commons Zero v1.0 Universal
src/main/kotlin/Problem20.kt
jimmymorales
496,703,114
false
{"Kotlin": 67323}
import java.math.BigInteger /** * Factorial digit sum * * n! means n × (n − 1) × ... × 3 × 2 × 1 * * For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800, * and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. * * Find the sum of the digits in the number 100! * * https://projecteul...
0
Kotlin
0
0
e881cadf85377374e544af0a75cb073c6b496998
988
project-euler
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/GetWinner.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2023 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
4
Kotlin
0
19
776159de0b80f0bdc92a9d057c852b8b80147c11
2,667
kotlab
Apache License 2.0
demo-plural-sight-gradle/src/main/kotlin/demo/objects/House.kt
antoniolazaro
257,624,848
false
null
package demo.objects /* Given a program that reads two numbers from input each in a new line: The first one represents a number of rooms of a house. It helps define and create an instance of a class depending on that number according to the following rules: 1 – Cabin, 2-3 – Bungalow, 4 – Cottage, 5-7 – Mansion, 8...
0
Kotlin
0
0
9e673057c3255be66fd67479b8198fa129463d95
2,807
kotlin-lab
Apache License 2.0
src/main/kotlin/day20/part1/Part1.kt
bagguley
329,976,670
false
null
package day20.part1 import day20.data fun main() { val tiles = load(data) val corners = findCorners(tiles) corners.forEach { println(it.number) } println(corners.map { it.number }.fold(1L, {a,i -> a * i} )) } fun load(data: List<String>): List<Tile> { return data.map { loadTile(it) } } fun loa...
0
Kotlin
0
0
6afa1b890924e9459f37c604b4b67a8f2e95c6f2
1,030
adventofcode2020
MIT License
2016/src/main/kotlin/day2.kt
madisp
434,510,913
false
{"Kotlin": 388138}
import utils.Grid import utils.Parser import utils.Solution import utils.Vec2i import utils.mapItems fun main() { Day2.run() } object Day2 : Solution<List<String>>() { override val name = "day2" override val parser = Parser.lines val pad = Parser.charGrid("123\n456\n789") val pad2 = Parser.charGrid("00100\...
0
Kotlin
0
1
3f106415eeded3abd0fb60bed64fb77b4ab87d76
965
aoc_kotlin
MIT License
src/day5/Day5.kt
davidcurrie
579,636,994
false
{"Kotlin": 52697}
package day5 import java.io.File fun main() { val parts = File("src/day5/input.txt").readText(Charsets.UTF_8).split("\n\n") val lines = parts[0].split("\n") val length = (lines.last().length + 1) / 4 val columns = List(length) { mutableListOf<Char>() } lines.dropLast(1).forEach { line -> f...
0
Kotlin
0
0
0e0cae3b9a97c6019c219563621b43b0eb0fc9db
1,407
advent-of-code-2022
MIT License
classroom/src/main/kotlin/com/radix2/algorithms/week3/TraditionalMergeSort.kt
rupeshsasne
190,130,318
false
{"Java": 66279, "Kotlin": 50290}
package com.radix2.algorithms.week3 object TraditionalMergeSort { fun sort(array: IntArray) { val aux = IntArray(array.size) sort(array, aux, 0, array.size - 1) } fun sort(array: IntArray, aux: IntArray, lo: Int, hi: Int) { if (lo >= hi) return val mid = lo + (hi - lo) / 2...
0
Java
0
1
341634c0da22e578d36f6b5c5f87443ba6e6b7bc
1,099
coursera-algorithms-part1
Apache License 2.0
src/commonMain/kotlin/eu/yeger/cyk/parser/ProductionRuleParser.kt
DerYeger
302,742,119
false
null
package eu.yeger.cyk.parser import eu.yeger.cyk.* import eu.yeger.cyk.model.* public fun parseProductionRules( startSymbol: String, includeEmptyProductionRule: Boolean = false, productionRules: String, ): Result<ProductionRuleSet> { return startSymbol .parseStartSymbol() .andThen { val...
0
Kotlin
0
2
76b895e3e8ea6b696b3ad6595493fda9ee3da067
2,812
cyk-algorithm
MIT License
src/Day06.kt
dmstocking
575,012,721
false
{"Kotlin": 40350}
fun main() { fun part1(input: List<String>): Int { var i = 0 input.first() .asSequence() .windowed(4) { it.toSet().size } .onEach { i += 1 } .dropWhile { it != 4 } .take(1) .first() return i + 3 } fun part2(inpu...
0
Kotlin
0
0
e49d9247340037e4e70f55b0c201b3a39edd0a0f
834
advent-of-code-kotlin-2022
Apache License 2.0
src/main/kotlin/g1101_1200/s1162_as_far_from_land_as_possible/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g1101_1200.s1162_as_far_from_land_as_possible // #Medium #Array #Dynamic_Programming #Breadth_First_Search #Matrix // #Graph_Theory_I_Day_4_Matrix_Related_Problems // #2023_05_25_Time_362_ms_(81.25%)_Space_86_MB_(31.25%) import java.util.LinkedList import java.util.Objects import java.util.Queue class Soluti...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,648
LeetCode-in-Kotlin
MIT License
src/main/kotlin/day02/Round.kt
jankase
573,187,696
false
{"Kotlin": 70242}
package day02 internal data class Round(val opponentPlay: Play, val yourPlay: Play, val result: RoundResult) { companion object { fun fromOpponentAndYourPlay(input: String): Round { val playInputs = inputStrings(input).map { Play.valueOf(it) } val opponentPlay = playInputs[0] ...
0
Kotlin
0
0
0dac4ec92c82a5ebb2179988fb91fccaed8f800a
2,141
adventofcode2022
Apache License 2.0
libraries/core-converter/src/main/kotlin/dev/marlonlom/apps/glucoreo/converter/measurement.kt
marlonlom
690,744,248
false
{"Kotlin": 77324}
/* * Copyright 2023 Marlonlom * SPDX-License-Identifier: Apache-2.0 */ package dev.marlonlom.apps.glucoreo.converter /** * Measurement units enum class. * * @author marlonlom * * @property unitText text for measurement unit. */ enum class MeasurementUnits( private val unitText: String ) { MGDL("mg/dl"), ...
0
Kotlin
0
0
25dcb40a4f84251b01538309189a73ed7f1b63b0
2,245
glucoreo
Apache License 2.0
buildSrc/src/main/kotlin/utils/CommonUtils.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
5,026
gradle-kotlin-sample
Apache License 2.0
atcoder.jp/abc264/abc264_c/Main.kt
akkinoc
520,873,415
false
{"Kotlin": 24773}
fun main() { val (h1, w1) = readLine()!!.split(" ").map { it.toInt() } val a = List(h1) { readLine()!!.split(" ") } val (h2, w2) = readLine()!!.split(" ").map { it.toInt() } val b = List(h2) { readLine()!!.split(" ") } for (r in (0 until h1).combinations(h1 - h2)) { val w = a.filterIndexed {...
1
Kotlin
0
1
e650a9c2e73d26a8f037b4f9f0dfe960171a604a
718
atcoder-workspace
MIT License
src/Day02.kt
ElenaRgC
572,898,962
false
null
fun main() { fun part1(input: List<String>): Int { var valorJugada = 0 var valorRonda = 0 var valorTotal = 0 for (i in input) { valorRonda = 3 when (i[0]) { 'A' -> when (i[2]) { 'Y' -> valorRonda = 6 '...
0
Kotlin
0
0
b7505e891429970c377f7b45bfa8b5157f85c457
2,643
advent-of-code-2022
Apache License 2.0
src/Day04.kt
mdtausifahmad
573,116,146
false
{"Kotlin": 5783}
import java.io.File fun main(){ val numberOfCommonPairs = File("src/Day04.txt") .readText() .split("\n") .flatMap { it.lines() } .sumOf { val split = it.split(",") overLappingAssignmentPair(split[0].split("-"), split[1].split("-")) } println(num...
0
Kotlin
0
0
13295fd5f5391028822243bb6880a98c70475ee2
1,322
adventofcode2022
Apache License 2.0
src/commonMain/kotlin/edu/unito/probability/ConditionalProbabilityDistribution.kt
lamba92
150,039,952
false
null
package edu.unito.probability import edu.unito.probability.bayes.AssignmentProposition interface ConditionalProbabilityDistribution { /** * @return the Random Variable this conditional probability distribution is * on. */ fun getOn(): RandomVariable /** * @return a consistent ordered ...
0
Kotlin
0
0
acbae0d12d9501ca531b8e619b49ce38793a7697
3,287
bayes-net-project-multiplatform
MIT License
src/main/kotlin/xyz/prpht/distributeamountbetweenslots/Distributor.kt
ilyawaisman
203,545,826
false
null
package xyz.prpht.distributeamountbetweenslots import kotlin.math.floor import kotlin.random.Random fun main() { repeat(0x10) { println(distribute(100, 5, 1, Random).joinToString(" ") { "%2d".format(it) }) } } fun distribute(amount: Int, slots: Int, rollsNum: Int, random: Random): List<Int> { va...
0
Kotlin
0
0
aa5c75ba801ad4c3a0e370913bbecce661dee98a
1,728
distribute-amount-between-slots
MIT License
leetcode/src/main/kotlin/com/artemkaxboy/leetcode/p00/Leet14.kt
artemkaxboy
513,636,701
false
{"Kotlin": 547181, "Java": 13948}
package com.artemkaxboy.leetcode.p00 /** * Optimizations * Runtime 140ms Beats 97.72% * Memory 35.5MB Beats 78.27% */ class Leet14 { class Solution { fun longestCommonPrefix(strs: Array<String>): String { val lastElement = strs.size - 1 val commonPrefixLength = i...
0
Kotlin
0
0
516a8a05112e57eb922b9a272f8fd5209b7d0727
1,495
playground
MIT License
src/main/kotlin/biz/koziolek/adventofcode/year2021/day01/day1.kt
pkoziol
434,913,366
false
{"Kotlin": 715025, "Shell": 1892}
package biz.koziolek.adventofcode.year2021.day01 import biz.koziolek.adventofcode.findInput fun main() { val inputFile = findInput(object {}) println("Simple increases: ${countIncreases(inputFile.bufferedReader().lineSequence())}") println("Windowed increases: ${countIncreasesSlidingWindow(inputFile.buffe...
0
Kotlin
0
0
1b1c6971bf45b89fd76bbcc503444d0d86617e95
1,185
advent-of-code
MIT License
src/main/kotlin/com/hj/leetcode/kotlin/problem907/Solution.kt
hj-core
534,054,064
false
{"Kotlin": 619841}
package com.hj.leetcode.kotlin.problem907 /** * LeetCode page: [907. Sum of Subarray Minimums](https://leetcode.com/problems/sum-of-subarray-minimums/); */ class Solution { /* Complexity: * Time O(|arr|) and Space O(|arr|); */ fun sumSubarrayMins(arr: IntArray): Int { val module = 1_000_000...
1
Kotlin
0
1
14c033f2bf43d1c4148633a222c133d76986029c
1,075
hj-leetcode-kotlin
Apache License 2.0
untitled/src/main/kotlin/Day2tginsberg.kt
jlacar
572,845,298
false
{"Kotlin": 41161}
/* Exercise to go through the thought process for coming up with solution shared by tginsberg */ class Day2tginsberg(private val fileName: String) : AocSolution { override val description: String get() = "Day 2 - RPS tginsberg approach ($fileName)" private val rounds = InputReader(fileName).lines override...
0
Kotlin
0
2
dbdefda9a354589de31bc27e0690f7c61c1dc7c9
1,659
adventofcode2022-kotlin
The Unlicense
2019/src/test/kotlin/Day10.kt
jp7677
318,523,414
false
{"Kotlin": 171284, "C++": 87930, "Rust": 59366, "C#": 1731, "Shell": 354, "CMake": 338}
import kotlin.math.atan2 import kotlin.math.hypot import kotlin.test.Test import kotlin.test.assertEquals class Day10 { data class Coord(val x: Int, val y: Int) @Test fun runPart01() { val coords = getInputAsCoords() val detected = coords.maxOf { coords .filter...
0
Kotlin
1
2
8bc5e92ce961440e011688319e07ca9a4a86d9c9
2,122
adventofcode
MIT License
src/main/kotlin/biz/koziolek/adventofcode/coords2dLong.kt
pkoziol
434,913,366
false
{"Kotlin": 715025, "Shell": 1892}
package biz.koziolek.adventofcode import kotlin.math.abs import kotlin.math.pow import kotlin.math.sqrt data class LongCoord(val x: Long, val y: Long) { constructor(x: Int, y: Int) : this(x.toLong(), y.toLong()) operator fun plus(other: LongCoord) = LongCoord(x + other.x, y + other.y) operator fun minus(o...
0
Kotlin
0
0
1b1c6971bf45b89fd76bbcc503444d0d86617e95
4,746
advent-of-code
MIT License
src/main/kotlin/org/example/adventofcode/puzzle/Day05.kt
nikos-ds
573,046,617
false
null
package org.example.adventofcode.puzzle import org.apache.commons.lang3.StringUtils import org.apache.commons.lang3.StringUtils.isBlank import org.example.adventofcode.util.FileLoader object Day05 { private const val FILE_PATH = "/day-05-input.txt" fun printSolution() { println("- part 1: ${getTopOfE...
0
Kotlin
0
0
3f97096ebcd19f971653762fe29ddec1e379d09a
2,758
advent-of-code-2022-kotlin
MIT License
src/cn/leetcode/codes/simple155/Simple155.kt
shishoufengwise1234
258,793,407
false
{"Java": 771296, "Kotlin": 68641}
package cn.leetcode.codes.simple155 import cn.leetcode.codes.out import java.util.* import kotlin.math.min fun main() { val minStack = MinStack() minStack.push(-2) minStack.push(0) minStack.push(-3) out(minStack.getMin())// --> 返回 -3. minStack.pop() out(minStack.top()) // --> 返...
0
Java
0
0
f917a262bcfae8cd973be83c427944deb5352575
1,582
LeetCodeSimple
Apache License 2.0
src/main/kotlin/problems/S05c05p10DPchangeDynamicProgramming.kt
jimandreas
377,843,697
false
null
@file:Suppress("SameParameterValue", "UnnecessaryVariable", "UNUSED_VARIABLE", "ReplaceManualRangeWithIndicesCalls") package problems /** * stepik: @link: https://stepik.org/lesson/240300/step/10?unit=212646 * rosalind: @link: http://rosalind.info/problems/ba5a/ * Code Challenge: Solve the Change Problem. Inpu...
0
Kotlin
0
0
fa92b10ceca125dbe47e8961fa50242d33b2bb34
1,476
stepikBioinformaticsCourse
Apache License 2.0
src/main/kotlin/dayfourteen/DayFourteen.kt
pauliancu97
619,525,509
false
null
package dayfourteen import getLines import kotlin.math.max import kotlin.math.min private typealias Matrix = List<MutableList<Boolean>> private val Matrix.rows: Int get() = this.size private val Matrix.cols: Int get() = this.first().size private operator fun Matrix.get(row: Int, col: Int): Boolean = this[r...
0
Kotlin
0
0
78af929252f094a34fe7989984a30724fdb81498
8,546
advent-of-code-2022
MIT License
src/main/kotlin/com/sk/set29/2981. Find Longest Special Substring That Occurs Thrice I.kt
sandeep549
262,513,267
false
{"Kotlin": 530613}
package com.sk.set29 import java.util.PriorityQueue class Solution2981 { fun maximumLength(s: String): Int { val map = mutableMapOf<Char, MutableList<Int>>() for (i in s.indices) { val ch = s[i] val list = map.getOrDefault(ch, mutableListOf<Int>()) list.add(i) ...
1
Kotlin
0
0
cf357cdaaab2609de64a0e8ee9d9b5168c69ac12
1,258
leetcode-kotlin
Apache License 2.0
src/main/kotlin/g2301_2400/s2397_maximum_rows_covered_by_columns/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g2301_2400.s2397_maximum_rows_covered_by_columns // #Medium #Array #Matrix #Bit_Manipulation #Backtracking #Enumeration // #2023_07_02_Time_154_ms_(100.00%)_Space_32.3_MB_(100.00%) class Solution { private var ans = 0 fun maximumRows(matrix: Array<IntArray>, numSelect: Int): Int { dfs(matrix, ...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,350
LeetCode-in-Kotlin
MIT License
src/pl/shockah/aoc/y2017/Day24.kt
Shockah
159,919,224
false
null
package pl.shockah.aoc.y2017 import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import pl.shockah.aoc.AdventTask import pl.shockah.aoc.UnorderedPair class Day24: AdventTask<List<UnorderedPair<Int>>, Int, Int>(2017, 24) { override fun parseInput(rawInput: String): List<UnorderedPair<Int>> { r...
0
Kotlin
0
0
9abb1e3db1cad329cfe1e3d6deae2d6b7456c785
2,429
Advent-of-Code
Apache License 2.0
src/Day01.kt
rxptr
572,717,765
false
{"Kotlin": 9737}
fun main() { val emptyLine = "\n\n" fun sliceInputToListOfInts(input: String): List<List<Int>> = input.split(emptyLine) .map { lines -> lines.lines().filter { it.isNotBlank() }.map { it.toInt() } } fun sumOfCalories(input: String): List<Int> = sliceInputToListOfInts(input).map { it.su...
0
Kotlin
0
0
989ae08dd20e1018ef7fe5bf121008fa1c708f09
690
aoc2022
Apache License 2.0
Collections/Associate/src/TaskExtensionAssociate.kt
Rosietesting
373,564,502
false
{"HTML": 178715, "JavaScript": 147056, "Kotlin": 113135, "CSS": 105840}
fun main () { /* associateWith() creates a Map in which the elements of the original collection are keys, and values are produced from them by the given transformation function. */ val number1 = listOf("one", "two", "three", "four") println(number1.associateWith { it.length }) /* ass...
0
HTML
0
0
b0aa518d220bb43c9398dacc8a6d9b6c602912d5
2,816
KotlinKoans
MIT License
solutions/src/trainings/2017/day 07.kt
Kroppeb
225,582,260
false
null
package trainings.`2017` import helpers.* private fun part1(data: List<List<Any?>>){ val ps = data.map{it[0]}.toSet() val pps = data.flatMap { it.drop(2) }.toSet() println(ps - pps) } private fun part2(data:List<List<Any?>>){ val w = data.map { it[0].toString() to it[1] as Int }.toMap() val c = data.map { it[0...
0
Kotlin
0
1
744b02b4acd5c6799654be998a98c9baeaa25a79
984
AdventOfCodeSolutions
MIT License
kotlinLeetCode/src/main/kotlin/leetcode/editor/cn/[31]下一个排列.kt
maoqitian
175,940,000
false
{"Kotlin": 354268, "Java": 297740, "C++": 634}
//实现获取 下一个排列 的函数,算法需要将给定数字序列重新排列成字典序中下一个更大的排列。 // // 如果不存在下一个更大的排列,则将数字重新排列成最小的排列(即升序排列)。 // // 必须 原地 修改,只允许使用额外常数空间。 // // // // 示例 1: // // //输入:nums = [1,2,3] //输出:[1,3,2] // // // 示例 2: // // //输入:nums = [3,2,1] //输出:[1,2,3] // // // 示例 3: // // //输入:nums = [1,1,5] //输出:[1,5,1] // // // 示例 4: // // /...
0
Kotlin
0
1
8a85996352a88bb9a8a6a2712dce3eac2e1c3463
1,927
MyLeetCode
Apache License 2.0
src/main/kotlin/com/staricka/adventofcode2023/days/Day11.kt
mathstar
719,656,133
false
{"Kotlin": 107115}
package com.staricka.adventofcode2023.days import com.staricka.adventofcode2023.framework.Day import com.staricka.adventofcode2023.util.GridCell import com.staricka.adventofcode2023.util.StandardGrid import kotlin.math.abs class Day11(val oldMultiplier: Long = 1000000): Day { enum class Galaxy: GridCell { ...
0
Kotlin
0
0
8c1e3424bb5d58f6f590bf96335e4d8d89ae9ffa
1,666
adventOfCode2023
MIT License
src/Day01.kt
nmrsmn
574,578,675
false
{"Kotlin": 1364}
fun main() { fun part1(input: String): Int { return input.split("\n\n").maxOf { elf -> elf.lines().sumOf { it.toInt() } } } fun part2(input: String): Int { return input.split("\n\n") .map { elf -> elf.lines().sumOf { it.toInt() } } .sortedDescendi...
0
Kotlin
0
0
5455d1fcc567bf63a16534b3d82ae2f407b1d41c
623
advent-of-code-2022
Apache License 2.0
src/iii_conventions/MyDate.kt
LeeReindeer
99,133,549
false
null
package iii_conventions data class MyDate(val year: Int, val month: Int, val dayOfMonth: Int):Comparable<MyDate> { override fun compareTo(other: MyDate): Int { /* val diffYear=this.year-other.year val diffMonth=this.month-other.month val diffDay=this.dayOfMonth-other.dayOfMonth ...
0
Kotlin
0
0
6633226ec2264bc8725ea69267bbeea3b04b8e90
1,948
kotlin-koans-solved
MIT License
src/main/kotlin/divine/brothers/pizza/Setup.kt
AarjavP
450,892,849
false
{"Kotlin": 28300}
package divine.brothers.pizza import com.google.common.collect.BiMap import com.google.common.collect.HashBiMap import java.util.* import java.util.stream.Collectors @JvmInline value class Ingredient(val id: Int) { override fun toString(): String = id.toString() } @JvmInline value class CustomerId(val id: Int) ...
0
Kotlin
0
0
3aaaefc04d55b1e286dde0895fa32f9c34f5c945
1,974
google-hash-code-2022
MIT License
src/day03/Day03.kt
Sardorbekcyber
573,890,266
false
{"Kotlin": 6613}
package day03 import java.io.File fun main() { val letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" fun part1(input: String) : Int { val data = input.split("\n") var sum = 0 for (line in data) { val secondHalf = line.substring(line.length/2) for ...
0
Kotlin
0
2
56f29c8322663720bc83e7b1c6b0a362de292b12
1,801
aoc-2022-in-kotlin
Apache License 2.0
src/main/kotlin/nl/jackploeg/aoc/utilities/utilities.kt
jackploeg
736,755,380
false
{"Kotlin": 318734}
package nl.jackploeg.aoc.utilities import java.io.File import java.math.BigInteger fun readNumbersFile(fileName: String): List<Int> { return File(fileName) .readLines() .map { it.toInt() } } fun readStringFile(fileName: String): List<String> { return File(fileName) .readLines() } fun...
0
Kotlin
0
0
f2b873b6cf24bf95a4ba3d0e4f6e007b96423b76
1,249
advent-of-code
MIT License
Circular_primes/Kotlin/src/CircularPrimes.kt
ncoe
108,064,933
false
{"D": 425100, "Java": 399306, "Visual Basic .NET": 343987, "C++": 328611, "C#": 289790, "C": 216950, "Kotlin": 162468, "Modula-2": 148295, "Groovy": 146721, "Lua": 139015, "Ruby": 84703, "LLVM": 58530, "Python": 46744, "Scala": 43213, "F#": 21133, "Perl": 13407, "JavaScript": 6729, "CSS": 453, "HTML": 409}
import java.math.BigInteger val SMALL_PRIMES = listOf( 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 2...
0
D
0
4
c2a9f154a5ae77eea2b34bbe5e0cc2248333e421
3,138
rosetta
MIT License
kotlin/src/katas/kotlin/hackerrank/NewYearChaos.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.hackerrank import datsok.shouldEqual import org.junit.Test import java.util.* /** * https://www.hackerrank.com/challenges/new-year-chaos */ fun main() { val scanner = Scanner(System.`in`) main(generateSequence { scanner.nextLine() }) } private fun main(input: Sequence<String>, output: ...
7
Roff
3
5
0f169804fae2984b1a78fc25da2d7157a8c7a7be
2,241
katas
The Unlicense
src/main/kotlin/org/hildan/minecraft/mining/optimizer/geometry/Range3D.kt
joffrey-bion
48,772,914
false
null
package org.hildan.minecraft.mining.optimizer.geometry /** * Represents a 3D range. * * The min and max methods give the interval of variation of each variable. These intervals of variation are just bounds * for enumeration. They are not sufficient to tell if a point in space is in this range. For that purpose, us...
1
Kotlin
0
0
065ea1c3068d88d6b5abe39150f7866b100b0384
3,187
mc-mining-optimizer
MIT License
distributed-systems/consistent-hashing/src/Storage.kt
Lascor22
331,294,681
false
{"Java": 1706475, "HTML": 436528, "CSS": 371563, "C++": 342426, "Jupyter Notebook": 274491, "Kotlin": 248153, "Haskell": 189045, "Shell": 186916, "JavaScript": 159132, "Vue": 45665, "Python": 25957, "PLpgSQL": 23402, "Clojure": 11410, "Batchfile": 9677, "FreeMarker": 7201, "Yacc": 7148, "ANTLR": 6303, "Scala": 3020, "L...
class Storage { private val arr = ArrayList<Entry>(0) fun addToStorage(hash: Int, shard: Shard) { arr.add(Entry(hash, shard)) arr.sortBy { entry -> entry.hash } } fun isEmpty(): Boolean { return arr.isEmpty() } fun findAllHashes(shard: Shard): List<Int> { retur...
0
Java
0
0
c41dfeb404ce995abdeb18fc93502027e54239ee
2,101
ITMO-university
MIT License
src/main/kotlin/dev/bogwalk/batch9/Problem91.kt
bog-walk
381,459,475
false
null
package dev.bogwalk.batch9 import dev.bogwalk.util.maths.gcd /** * Problem 91: Right Triangles with Integer Coordinates * * https://projecteuler.net/problem=91 * * Goal: Given that 0 <= x_1, y_1, x_2, y_2 <= N, count how many right triangles can be formed that * fulfill the requirements detailed below. * * Co...
0
Kotlin
0
0
62b33367e3d1e15f7ea872d151c3512f8c606ce7
2,796
project-euler-kotlin
MIT License
Kotlin/problems/0064_coin_change.kt
oxone-999
243,366,951
true
{"C++": 961697, "Kotlin": 99948, "Java": 17927, "Python": 9476, "Shell": 999, "Makefile": 187}
//Problem statement // You are given coins of different denominations and a total amount of money amount. // Write a function to compute the fewest number of coins that you need to make up that amount. // If that amount of money cannot be made up by any combination of the coins, return -1. class Solution constructor (...
0
null
0
0
52dc527111e7422923a0e25684d8f4837e81a09b
1,205
algorithms
MIT License
src/iii_conventions/MyDate.kt
hotdrop
96,165,435
false
null
package iii_conventions class MyDate(val year: Int, val month: Int, val dayOfMonth: Int): Comparable<MyDate> { override fun compareTo(other: MyDate): Int = if(this.toInt() > other.toInt()) 1 else -1 override fun equals(other: Any?): Boolean = sameDate(other as MyDate) || super.equals(other) ...
0
Kotlin
0
0
a6959d5758284b48e1135860933912e0bbb5dbe2
1,608
kotlin-koans
MIT License
kotlin/0116-populating-next-right-pointers-in-each-node.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}
// Time complexity O(n) and space complexity O(1) with Follow-up constraints, without using recursion class Solution { fun connect(root: Node?): Node? { var cur = root var next = cur?.left while (cur != null && next != null) { cur?.left?.next = cur?.right if (cur?.ne...
337
JavaScript
2,004
4,367
0cf38f0d05cd76f9e96f08da22e063353af86224
1,711
leetcode
MIT License
src/main/kotlin/com/kishor/kotlin/algo/search/ClimbingLeaderBoard.kt
kishorsutar
276,212,164
false
null
package com.kishor.kotlin.algo.search fun climbingLeaderboard(scores: IntArray, player: IntArray): IntArray? { val scoreSize = scores.size val playerScoresSize = player.size val ranking = IntArray(playerScoresSize) val rank = IntArray(scoreSize) rank[0] = 1 for (i in 1 until scoreSize) { ...
0
Kotlin
0
0
6672d7738b035202ece6f148fde05867f6d4d94c
1,376
DS_Algo_Kotlin
MIT License
kotlin/src/com/daily/algothrim/leetcode/OddEvenList.kt
idisfkj
291,855,545
false
null
package com.daily.algothrim.leetcode /** * 328. 奇偶链表 * * 给定一个单链表,把所有的奇数节点和偶数节点分别排在一起。请注意,这里的奇数节点和偶数节点指的是节点编号的奇偶性,而不是节点的值的奇偶性。 * * 请尝试使用原地算法完成。你的算法的空间复杂度应为 O(1),时间复杂度应为 O(nodes),nodes 为节点总数。 * * 示例 1: * * 输入: 1->2->3->4->5->NULL * 输出: 1->3->5->2->4->NULL * 示例 2: * * 输入: 2->1->3->5->6->4->7->NULL * 输出: 2->...
0
Kotlin
9
59
9de2b21d3bcd41cd03f0f7dd19136db93824a0fa
2,084
daily_algorithm
Apache License 2.0
2021/src/main/kotlin/de/skyrising/aoc2021/day7/solution.kt
skyrising
317,830,992
false
{"Kotlin": 411565}
package de.skyrising.aoc2021.day7 import de.skyrising.aoc.* import kotlin.math.abs val test = TestInput("16,1,2,0,4,2,7,1,2,14") @PuzzleName("The Treachery of Whales") fun PuzzleInput.part1(): Any { val crabs = chars.trim().split(',').map(String::toInt).sorted() var minFuel = Int.MAX_VALUE for (pos in cr...
0
Kotlin
0
0
19599c1204f6994226d31bce27d8f01440322f39
917
aoc
MIT License
core-kotlin-modules/core-kotlin-datastructures/src/test/kotlin/com/baeldung/lexicographicalsort/LexicographicalSortUnitTest.kt
Baeldung
260,481,121
false
{"Kotlin": 1476024, "Java": 43013, "HTML": 4883}
package com.baeldung.lexicographicalsort import org.junit.Test import kotlin.test.assertContentEquals class LexicographicalSortUnitTest { @Test fun `sort using sortedWith() method`(){ val words = arrayOf("banana", "apple", "cherry", "date", "A", "Result", "Union") val sortedWords = words.sort...
10
Kotlin
273
410
2b718f002ce5ea1cb09217937dc630ff31757693
2,271
kotlin-tutorials
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/MinOpToMakeArrayEmpty.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2024 <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,349
kotlab
Apache License 2.0
src/iii_conventions/MyDate.kt
RawToast
98,023,160
false
null
package iii_conventions data class MyDate(val year: Int, val month: Int, val dayOfMonth: Int): Comparable<MyDate> { override fun compareTo(other: MyDate): Int { return if (year < other.year) -1 else if(year > other.year) 1 else if(year >= other.year && month > other.month) 1 else if...
0
Kotlin
0
0
d8dd239d294545fedfeab8d6bb89d4b261966c0e
1,586
kotlin-koans
MIT License
src/main/kotlin/be/twofold/aoc2021/Day02.kt
jandk
433,510,612
false
{"Kotlin": 10227}
package be.twofold.aoc2021 object Day02 { fun part1(input: List<Pair<String, Int>>): Int { var depth = 0 var position = 0 input.forEach { when (it.first) { "forward" -> position += it.second "down" -> depth += it.second "up" -> de...
0
Kotlin
0
0
2408fb594d6ce7eeb2098bc2e38d8fa2b90f39c3
1,078
aoc2021
MIT License
src/Java/LeetcodeSolutions/src/main/java/leetcode/solutions/concrete/kotlin/Solution_21_Merge_Two_Sorted_Lists.kt
v43d3rm4k4r
515,553,024
false
{"Kotlin": 40113, "Java": 25728}
package leetcode.solutions.concrete.kotlin import leetcode.solutions.LeetcodeSolution import leetcode.solutions.ProblemDifficulty.* import leetcode.solutions.annotations.ProblemInputData import leetcode.solutions.annotations.ProblemSolution import leetcode.solutions.utils.ListNode import leetcode.solutions.utils.creat...
0
Kotlin
0
1
c5a7e389c943c85a90594315ff99e4aef87bff65
2,577
LeetcodeSolutions
Apache License 2.0
src/main/kotlin/year2023/Day10.kt
forketyfork
572,832,465
false
{"Kotlin": 142196}
package year2023 import utils.Direction class Day10 { val stepMap = buildMap { put(Direction.DOWN to '|', Direction.DOWN) put(Direction.UP to '|', Direction.UP) put(Direction.LEFT to '-', Direction.LEFT) put(Direction.RIGHT to '-', Direction.RIGHT) put(Direction.DOWN to 'L...
0
Kotlin
0
0
5c5e6304b1758e04a119716b8de50a7525668112
1,786
aoc-2022
Apache License 2.0
app/src/main/java/com/klamerek/fantasyrealms/game/Game.kt
NicolaiRuckel
439,810,244
true
{"Kotlin": 203429}
package com.klamerek.fantasyrealms.game import android.content.Context import com.klamerek.fantasyrealms.toInt import com.klamerek.fantasyrealms.util.Constants import com.klamerek.fantasyrealms.util.Preferences import java.lang.Integer.max /** * List of cards (player hand) wth scoring calculation * */ class Game {...
0
Kotlin
0
0
345578a6d4be9eb50788be9550ff28b3fd395db9
10,968
fantasy-realm-scoring
MIT License
src/main/kotlin/18/18.kt
Wrent
225,133,563
false
null
fun main() { val underground = mutableMapOf<Coord, Underground>() INPUT18.split("\n") .forEachIndexed { i, row -> row.split("").filter { it != "" }.forEachIndexed { j, cell -> val coord = Coord(i, j) underground[coord] = Underground(coord, unde...
0
Kotlin
0
0
0a783ed8b137c31cd0ce2e56e451c6777465af5d
18,997
advent-of-code-2019
MIT License
Kotlinlang/src/examples/longerExamples/Maze.kt
why168
118,225,102
false
null
package examples.longerExamples import java.util.* /** * Let's Walk Through a Maze. * * Imagine there is a maze whose walls are the big 'O' letters. * Now, I stand where a big 'I' stands and some cool prize lies * somewhere marked with a '$' sign. Like this: * * OOOOOOOOOOOOOOOOO * O O * ...
0
Kotlin
1
4
c642d97a605ef09355b86c39c1c522e3181d65e2
5,167
JavaProjects
Apache License 2.0
src/test/kotlin/amb/aoc2020/day2.kt
andreasmuellerbluemlein
318,221,589
false
null
package amb.aoc2020 import org.junit.jupiter.api.Test class Day2 : TestBase() { class Tree( val branches: String ) class Panda( val name: Char, val favouriteBranch1: Int, val favouriteBranch2: Int, ) class Input( val tree: Tree, val panda: Panda ...
1
Kotlin
0
0
dad1fa57c2b11bf05a51e5fa183775206cf055cf
1,814
aoc2020
MIT License
src/exercises/Day01.kt
Njko
572,917,534
false
{"Kotlin": 53729}
// ktlint-disable filename package exercises import readInput import kotlin.math.max fun main() { fun part1(input: List<String>, excluding: List<Int> = emptyList()): Int { var weight = 0 var maxWeight = 0 input.forEach { line -> if (line.isNotEmpty()) { // last empty line in ori...
0
Kotlin
0
2
68d0c8d0bcfb81c183786dfd7e02e6745024e396
1,338
advent-of-code-2022
Apache License 2.0
src/main/kotlin/Models.kt
akunowski
166,451,736
false
{"Kotlin": 6214}
import kotlin.math.roundToInt data class Gene(val x: Int, val y: Int) { companion object { fun fitnessScore(g1: Gene, g2: Gene): Int { val xSq = Math.pow((g1.x - g2.x).toDouble(), 2.0) val ySq = Math.pow((g1.y - g2.y).toDouble(), 2.0) return Math.sqrt(Math.abs(xSq + ySq)...
0
Kotlin
0
0
2aaecdf83840dba48ab11b5c0245e81d29d6c0c4
1,268
tsp_genetic
MIT License
src/main/kotlin/day16.kt
Gitvert
725,292,325
false
{"Kotlin": 97000}
import kotlin.math.max fun day16 (lines: List<String>) { val beams = if (lines[0][0] == '\\') { mutableListOf(Beam(0, 0, 0, 1)) } else { mutableListOf(Beam(0, 0, 1, 0)) } val part1 = findVisitedPositions(lines, beams, Pos(0, 0)) println("Day 16 part 1: $part1") val par...
0
Kotlin
0
0
f204f09c94528f5cd83ce0149a254c4b0ca3bc91
6,619
advent_of_code_2023
MIT License
src/cn/ancono/math/discrete/Graphs.kt
140378476
105,762,795
false
{"Java": 1912158, "Kotlin": 1243514}
package cn.ancono.math.discrete import java.lang.Double.min import java.util.* //Created by lyc at 2021-03-15 interface GraphBuilder<G> { infix fun Int.to(y: Int): Int fun build(): G } /** * Builds an undirected graph. */ fun buildGraph(n: Int, builderAction: GraphBuilder<UndirectedGraph>.() -> Unit): Un...
0
Java
0
6
02c2984c10a95fcf60adcb510b4bf111c3a773bc
12,046
Ancono
MIT License
kotlin/674.Longest Continuous Increasing 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> Given an unsorted array of integers, find the length of longest <code>continuous</code> increasing subsequence (subarray). </p> <p><b>Example 1:</b><br /> <pre> <b>Input:</b> [1,3,5,4,7] <b>Output:</b> 3 <b>Explanation:</b> The longest continuous increasing subsequence is [1,3,5], its length is 3. Even though...
0
Python
1
3
6731e128be0fd3c0bdfe885c1a409ac54b929597
2,088
leetcode
MIT License
14.kts
pin2t
725,922,444
false
{"Kotlin": 48856, "Go": 48364, "Shell": 54}
val platform = System.`in`.bufferedReader().lines().map { it.toCharArray() }.toList() fun north() { for (c in 0..<platform[0].size) { for (r in 0..<platform.size) { if (platform[r][c] == 'O') { platform[r][c] = '.' var i = r - 1; while (i >= 0 && platform[i][c] ==...
0
Kotlin
1
0
7575ab03cdadcd581acabd0b603a6f999119bbb6
2,025
aoc2023
MIT License
src/net/sheltem/aoc/y2022/Day09.kt
jtheegarten
572,901,679
false
{"Kotlin": 178521}
package net.sheltem.aoc.y2022 import kotlin.math.absoluteValue suspend fun main() { Day09().run() } class Day09 : Day<Int>(88, 36) { override suspend fun part1(input: List<String>): Int = input.toInstructions().moveMatrix(2).flatMap { it.toList() }.filter { it != 0 }.size override suspend fun part2(inp...
0
Kotlin
0
0
ac280f156c284c23565fba5810483dd1cd8a931f
2,189
aoc
Apache License 2.0
src/main/kotlin/g0001_0100/s0098_validate_binary_search_tree/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g0001_0100.s0098_validate_binary_search_tree // #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Depth_First_Search #Tree #Binary_Tree // #Binary_Search_Tree #Data_Structure_I_Day_14_Tree #Level_1_Day_8_Binary_Search_Tree // #Udemy_Tree_Stack_Queue #Big_O_Time_O(N)_Space_O(log(N)) // #2023_07_10_Time...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,198
LeetCode-in-Kotlin
MIT License
core-bandit/src/main/kotlin/org/rsultan/bandit/algorithms/BanditAlgorithm.kt
remisultan
241,215,006
false
{"Jupyter Notebook": 26270, "Kotlin": 9773}
package org.rsultan.bandit.algorithms import java.security.SecureRandom interface BanditAlgorithm { fun selectArm(): Int fun update(chosenArm: Int, reward: Float) } abstract class AbstractBanditAlgorithm(nbArms: Int) : BanditAlgorithm { protected val random = SecureRandom() protected val counts = ...
2
Jupyter Notebook
0
0
ead934d89e552d2daa1b8dc63e63d68fcc2610c4
1,158
multiarm-bandit-algorithm-kotlin
Do What The F*ck You Want To Public License
src/Day01.kt
kprow
573,685,824
false
{"Kotlin": 23005}
fun main() { var maxCalories = 0 var currentCalories = 0 var caloriesPerElf = arrayOf<Int>() fun part1(input: List<String>): Int { for (cal in input) { if (cal == "") { if (currentCalories > maxCalories) { maxCalories = currentCalories ...
0
Kotlin
0
0
9a1f48d2a49aeac71fa948656ae8c0a32862334c
880
AdventOfCode2022
Apache License 2.0
kotlin-math/src/main/kotlin/com/baeldung/math/checkfibonacci/Fibonacci.kt
Baeldung
260,481,121
false
{"Kotlin": 1476024, "Java": 43013, "HTML": 4883}
package com.baeldung.math.checkfibonacci var currentLimit = 0 var currentFibonacciHashSet: HashSet<Int> = hashSetOf(0, 1) fun checkIfFibonacciUsingIteration(n: Int): Boolean { var first = 0 var second = 1 while (first < n) { val temp = first first = second second = temp + second ...
10
Kotlin
273
410
2b718f002ce5ea1cb09217937dc630ff31757693
1,711
kotlin-tutorials
MIT License
leetcode-75-kotlin/src/main/kotlin/ReverseVowelsOfAString.kt
Codextor
751,507,040
false
{"Kotlin": 49566}
/** * Given a string s, reverse only all the vowels in the string and return it. * * The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than once. * * * * Example 1: * * Input: s = "hello" * Output: "holle" * Example 2: * * Input: s = "leetcode" * Output: "...
0
Kotlin
0
0
0511a831aeee96e1bed3b18550be87a9110c36cb
1,385
leetcode-75
Apache License 2.0
year2021/day06/lanternfish/src/main/kotlin/com/curtislb/adventofcode/year2021/day06/lanternfish/School.kt
curtislb
226,797,689
false
{"Kotlin": 2146738}
package com.curtislb.adventofcode.year2021.day06.lanternfish import com.curtislb.adventofcode.common.collection.Counter /** * A school of lanternfish, which create more fish over time according to a population growth model. * * @param initialTimers The internal reproduction timer (in days) of each lanternfish. * ...
0
Kotlin
1
1
6b64c9eb181fab97bc518ac78e14cd586d64499e
2,857
AdventOfCode
MIT License
src/main/kotlin/easy/merge-sorted-array.kt
shevtsiv
286,838,200
false
null
package easy class MergeSortedArraySolution { /** * Time Complexity: O(n) * Space Complexity: O(1) */ fun mergeUsingThreePointers(nums1: IntArray, m: Int, nums2: IntArray, n: Int) { var i = m - 1 var j = n - 1 var endPointer = m + n - 1 while (i >= 0 && j >= 0) {...
0
Kotlin
0
0
95d5f74069098beddf2aee14465f069302a51b77
1,803
leet
MIT License
src/main/kotlin/com/leetcode/P539.kt
antop-dev
229,558,170
false
{"Kotlin": 695315, "Java": 213000}
package com.leetcode // https://github.com/antop-dev/algorithm/issues/514 class P539 { fun findMinDifference(timePoints: List<String>): Int { // 문자열을 분으로 변경 val times = mutableListOf<Int>() for (s in timePoints) { val time = time(s) times += time // 다음날 시...
1
Kotlin
0
0
9a3e762af93b078a2abd0d97543123a06e327164
953
algorithm
MIT License
src/Day08.kt
IvanChadin
576,061,081
false
{"Kotlin": 26282}
import kotlin.math.max fun main() { val inputName = "Day08" val a = readInput(inputName).map { s -> s.map { it.digitToInt() } } fun calc1(i: Int, j: Int): Int { var res = 1 for (ii in i + 1 until a.size) { if (a[ii][j] >= a[i][j]) { res = 0 break...
0
Kotlin
0
0
2241437e6c3a20de70306a0cb37b6fe2ed8f9e3a
2,251
aoc-2022
Apache License 2.0
plugins/evaluation-plugin/core/src/com/intellij/cce/metric/LatencyMetrics.kt
jbakermalone
267,440,120
true
null
package com.intellij.cce.metric import com.intellij.cce.core.Lookup import com.intellij.cce.core.Session import com.intellij.cce.metric.util.Bootstrap abstract class LatencyMetric(override val name: String) : Metric { private val sample = mutableListOf<Double>() override val value: Double get() = compute(samp...
0
null
0
0
08c3a7658b320448efdbdfa75692c8449ee975bd
1,816
intellij-community
Apache License 2.0
src/main/kotlin/com/sk/leetcode/kotlin/122. Best Time to Buy and Sell Stock II.kt
sandeep549
262,513,267
false
{"Kotlin": 530613}
package com.sk.leetcode.kotlin class Solution122 { /** * Consider each greater element compared to previous and keep accumulating delta profit. */ fun maxProfit(prices: IntArray): Int { var res = 0 for (i in 1 until prices.size) { if (prices[i] > prices[i - 1]) { ...
1
Kotlin
0
0
cf357cdaaab2609de64a0e8ee9d9b5168c69ac12
1,151
leetcode-kotlin
Apache License 2.0
src/main/java/io/github/lunarwatcher/aoc/day9/Day9.kt
LunarWatcher
160,042,659
false
null
package io.github.lunarwatcher.aoc.day9 import io.github.lunarwatcher.aoc.commons.CircleDeque import io.github.lunarwatcher.aoc.commons.readFile /* Rules: - Marbles start at 0 - Increase by 1 until all have a value > 0 - Lowest-numbered marble is replaced between 1 and 2-marbles - Exception on fir...
0
Kotlin
0
1
99f9b05521b270366c2f5ace2e28aa4d263594e4
1,755
AoC-2018
MIT License
src/main/kotlin/me/peckb/aoc/_2021/calendar/day08/Day08.kt
peckb1
433,943,215
false
{"Kotlin": 956135}
package me.peckb.aoc._2021.calendar.day08 import me.peckb.aoc.generators.InputGenerator.InputGeneratorFactory import javax.inject.Inject class Day08 @Inject constructor(private val generatorFactory: InputGeneratorFactory) { companion object { private const val ALL_LETTERS = "abcdefg" private val NUMBER_TO_S...
0
Kotlin
1
3
2625719b657eb22c83af95abfb25eb275dbfee6a
3,912
advent-of-code
MIT License
src/Day06.kt
pavlo-dh
572,882,309
false
{"Kotlin": 39999}
fun main() { fun findMarkerEnd(signal: String, markerLength: Int): Int { var markerEnd = 0 outer@ for (i in markerLength - 1 until signal.length) { val markerChars = mutableSetOf<Char>() for (j in i downTo i - (markerLength - 1)) { markerChars.add(signal[j]) ...
0
Kotlin
0
2
c10b0e1ce2c7c04fbb1ad34cbada104e3b99c992
918
aoc-2022-in-kotlin
Apache License 2.0
src/main/kotlin/com/chriswk/aoc/advent2022/Day5.kt
chriswk
317,863,220
false
{"Kotlin": 481061}
package com.chriswk.aoc.advent2022 import com.chriswk.aoc.AdventDay import com.chriswk.aoc.util.reportableString import java.util.* class Day5: AdventDay(2022, 5) { companion object { @JvmStatic fun main(args: Array<String>) { val day = Day5() reportableString { ...
116
Kotlin
0
0
69fa3dfed62d5cb7d961fe16924066cb7f9f5985
2,993
adventofcode
MIT License
src/main/kotlin/g2101_2200/s2196_create_binary_tree_from_descriptions/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g2101_2200.s2196_create_binary_tree_from_descriptions // #Medium #Array #Hash_Table #Depth_First_Search #Breadth_First_Search #Tree #Binary_Tree // #2023_06_26_Time_933_ms_(100.00%)_Space_58.3_MB_(100.00%) import com_github_leetcode.TreeNode /* * Example: * var ti = TreeNode(5) * var v = ti.`val` * Defin...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,611
LeetCode-in-Kotlin
MIT License
problems/2861/kotlin/Solution.kt
misut
678,196,869
false
{"Kotlin": 32683}
class Solution { fun maxNumberOfAlloys( n: Int, k: Int, budget: Int, composition: List<List<Int>>, stock: List<Int>, cost: List<Int> ): Int = composition.maxOf { it.findCount(budget, stock, cost) } } fun List<Int>.isAvailable(count: Int, budget: Int, stoc...
0
Kotlin
0
0
52fac3038dd29cb8eefebbf4df04ccf1dda1e332
796
ps-leetcode
MIT License
AdventOfCodeDay07/src/nativeMain/kotlin/Day07.kt
bdlepla
451,523,596
false
{"Kotlin": 153773}
class Day07(lines:List<String>) { private val bags = parseLines(lines) fun solvePart1() = findParents().count() - 1 fun solvePart2() = baggageCost() - 1 private fun parseLines(lines: List<String>): Set<Rule> = lines.filterNot { it.contains("no other") } .flatMap { row -> ...
0
Kotlin
0
0
043d0cfe3971c83921a489ded3bd45048f02ce83
1,345
AdventOfCode2020
The Unlicense
src/day8/fr/Day08_1.fr.kt
BrunoKrantzy
433,844,189
false
{"Kotlin": 63580}
package day8.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,982
Advent-of-Code-2021
Apache License 2.0
cx-test/src/main/kotlin/io/nuvalence/cx/tools/cxtest/orchestrator/TestOrchestrator.kt
Nuvalence
641,553,939
false
{"Kotlin": 237698, "FreeMarker": 11464}
package io.nuvalence.cx.tools.cxtest.orchestrator import io.nuvalence.cx.tools.cxtest.model.test.TestScenario import io.nuvalence.cx.tools.cxtest.util.Properties data class ExecutionPath(val path: List<Int>) { operator fun get(index: Int): Int { return path[index] } } enum class TestOrchestrationMode...
2
Kotlin
0
0
52ceacb32a2f64d9f23f995904ab5822cb7456c7
3,502
dialogflow-cx-tools
MIT License