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
core/matchers/src/main/kotlin/au/com/dius/pact/core/matchers/RequestMatching.kt
weofferservice
276,198,559
true
{"Groovy": 813668, "Java": 664815, "Kotlin": 602899, "Scala": 96238, "Clojure": 7523, "ANTLR": 7005, "Dockerfile": 582}
package au.com.dius.pact.core.matchers import au.com.dius.pact.core.model.Interaction import au.com.dius.pact.core.model.Request import au.com.dius.pact.core.model.RequestResponseInteraction import au.com.dius.pact.core.model.Response import mu.KLogging sealed class RequestMatch { /** * Take the first total matc...
0
Groovy
0
0
f3318bc87561b104b4fdb85dfe17b02a13481493
3,245
pact-jvm
Apache License 2.0
src/Day06.kt
Narmo
573,031,777
false
{"Kotlin": 34749}
fun main() { fun process(input: String, packetSize: Int): Int { var counter = 0 val deque = ArrayDeque<Char>() for (i in input) { deque.addLast(i) counter += 1 if (deque.size == packetSize) { if (deque.toSet().size == packetSize) { break } else { deque.removeFirst() } } ...
0
Kotlin
0
0
335641aa0a964692c31b15a0bedeb1cc5b2318e0
1,141
advent-of-code-2022
Apache License 2.0
src/Day25.kt
kuangbin
575,873,763
false
{"Kotlin": 8252}
fun main() { fun part1(input: List<String>): String { var sum = 0L for (s in input) { sum += getValue(s) } return getSNAFU(sum) } fun part2(input: List<String>): Int { return input.size } // test if implementation meets criteria from the description, like: val testInput = readInp...
0
Kotlin
0
0
ea0d89065b4d3cb4f6f78f768882d5b5473624d1
1,137
advent-of-code-2022
Apache License 2.0
src/Day10.kt
jwalter
573,111,342
false
{"Kotlin": 19975}
fun main() { fun part1(input: List<String>): Int { var x = 1 val result = input.flatMap { if (it == "noop") { listOf(x) } else { val curr = x x += it.drop(5).toInt() listOf(curr, x) } } ...
0
Kotlin
0
0
576aeabd297a7d7ee77eca9bb405ec5d2641b441
1,452
adventofcode2022
Apache License 2.0
src/main/kotlin/aoc07/aoc07.kt
dnene
317,653,484
false
null
package aoc07 import java.io.File import java.util.regex.Pattern data class Bag(val name: String, val contained: List<Pair<Int, String>>) { fun has(map: Map<String, Bag>, otherName: String): Boolean = contained.any { it.second == otherName || map[it.second]!!.has(map, otherName)} fun contains(map: Map...
0
Kotlin
0
0
db0a2f8b484575fc3f02dc9617a433b1d3e900f1
1,867
aoc2020
MIT License
src/nativeMain/kotlin/com.qiaoyuang.algorithm/special/Questions2.kt
qiaoyuang
100,944,213
false
{"Kotlin": 338134}
package com.qiaoyuang.algorithm.special fun test2() { printlnResult("1011", "10001") printlnResult("1010101001", "1001110111") } /** * Input two strings to present two unsigned binary integers, write a function to implement binary addition */ private infix fun String.addBinary(str: String): String { req...
0
Kotlin
3
6
66d94b4a8fa307020d515d4d5d54a77c0bab6c4f
3,363
Algorithm
Apache License 2.0
src/test/kotlin/Problem10Test.kt
gmpalmer
319,038,590
false
null
import org.junit.jupiter.api.Test import kotlin.test.assertEquals class Problem10Test { @Test fun test_Example() { val nums = AdventUtils.getResourceAsText("/day10/example.txt").lines().map{it.toInt()} val magic = solve(nums) println("magic = ${magic}") } private fun solve(nu...
0
Kotlin
0
0
ec8eba4c247973ac6f1d1fce2bae76c5a938cda2
3,908
advent2020
Apache License 2.0
src/y2022/Day03.kt
gaetjen
572,857,330
false
{"Kotlin": 325874, "Mermaid": 571}
package y2022 import util.readInput object Day03 { fun part1(input: List<String>): Int { return input.sumOf { wrongItem(it) } } private fun wrongItem(input: String): Int { val (c1, c2) = input.chunked(input.length / 2) { it.toSet() } val wrongItem = c1.intersec...
0
Kotlin
0
0
d0b9b5e16cf50025bd9c1ea1df02a308ac1cb66a
985
advent-of-code
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/SteppingNumbers.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2021 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
4
Kotlin
0
19
776159de0b80f0bdc92a9d057c852b8b80147c11
1,679
kotlab
Apache License 2.0
src/main/kotlin/days/aoc2022/Day14.kt
bjdupuis
435,570,912
false
{"Kotlin": 537037}
package days.aoc2022 import days.Day import util.Array2d import util.Point2d import java.lang.Integer.max import java.lang.Integer.min class Day14 : Day(2022, 14) { override fun partOne(): Any { return calculateAmountOfSandSettled(inputList) } override fun partTwo(): Any { return calculat...
0
Kotlin
0
1
c692fb71811055c79d53f9b510fe58a6153a1397
3,278
Advent-Of-Code
Creative Commons Zero v1.0 Universal
app/src/main/java/me/grey/picquery/common/Algorithm.kt
greyovo
676,960,803
false
{"Kotlin": 153138, "Python": 17259, "PureBasic": 181}
package me.grey.picquery.common import kotlin.math.acos import kotlin.math.asin import kotlin.math.pow import kotlin.math.sqrt fun calculateSimilarity(vectorA: FloatArray, vectorB: FloatArray): Double { var dotProduct = 0.0 var normA = 0.0 var normB = 0.0 for (i in vectorA.indices) { dotProdu...
7
Kotlin
13
111
4c95be235837885d31961b2f4f5018c0f9c48676
2,190
PicQuery
MIT License
LeetCode/Medium/longest-palindromic-substring/Solution.kt
GregoryHo
254,657,102
false
null
class Solution { fun longestPalindrome(s: String): String { if (s.isEmpty()) { return s } val length = s.length val dp = Array(length) { BooleanArray(length) } var startIndex = 0 var endIndex = 0 val chars = s.toCharArray() for (i in length - 1 downTo 0) { for (j in i unt...
0
Kotlin
0
0
8f126ffdf75aa83a6d60689e0b6fcc966a173c70
1,202
coding-fun
MIT License
src/Day02.kt
sabercon
648,989,596
false
null
fun main() { fun isValid1(range: IntRange, letter: Char, password: String): Boolean { return password.count { it == letter } in range } fun isValid2(range: IntRange, letter: Char, password: String): Boolean { return (password[range.first - 1] == letter) xor (password[range.last - 1] == lett...
0
Kotlin
0
0
81b51f3779940dde46f3811b4d8a32a5bb4534c8
773
advent-of-code-2020
MIT License
leetcode2/src/leetcode/edit-distance.kt
hewking
68,515,222
false
null
package leetcode /** * 72. 编辑距离 * https://leetcode-cn.com/problems/edit-distance/ * Created by test * Date 2020/1/29 20:39 * Description * 给定两个单词 word1 和 word2,计算出将 word1 转换成 word2 所使用的最少操作数 。 你可以对一个单词进行如下三种操作: 插入一个字符 删除一个字符 替换一个字符 示例 1: 输入: word1 = "horse", word2 = "ros" 输出: 3 解释: horse -> rorse (将 'h' 替换为 '...
0
Kotlin
0
0
a00a7aeff74e6beb67483d9a8ece9c1deae0267d
1,156
leetcode
MIT License
topsis-normalization-weighting/src/main/kotlin/pl/poznan/put/topsis/NormalizationWeightingCalculator.kt
sbigaret
164,424,298
true
{"Kotlin": 93061, "R": 67629, "Shell": 24899, "Groovy": 24559}
package pl.poznan.put.topsis import kotlin.math.pow import kotlin.math.sqrt class NormalizationWeightingCalculator( alternatives: List<TopsisAlternative>, criteria: List<Criterion> ) : AlternativesCalculator<WeightedNormalizedAlternatives>(alternatives, criteria) { private val weights = criteria.m...
0
Kotlin
0
0
96c182d7e37b41207dc2da6eac9f9b82bd62d6d7
2,046
DecisionDeck
MIT License
src/jvmMain/kotlin/day03/refined/Day03.kt
liusbl
726,218,737
false
{"Kotlin": 109684}
package day03.refined import java.io.File fun main() { solvePart1() // Solution: 532428, solved at 07:34 // solvePart2() // Solution: 84051670, soved at 07:59 } fun solvePart1() { // val input = File("src/jvmMain/kotlin/day03/input/input_part1_test.txt") val input = File("src/jvmMain/kotlin/day03/inpu...
0
Kotlin
0
0
1a89bcc77ddf9bc503cf2f25fbf9da59494a61e1
4,874
advent-of-code
MIT License
src/main/kotlin/24/24.kt
Wrent
225,133,563
false
null
fun main() { val map = mutableMapOf<Coord, Eris>() val history = mutableSetOf<String>() INPUT24.split("\n") .forEachIndexed { i, row -> row.split("").filter { it != "" }.forEachIndexed { j, cell -> val coord = Coord(j, i) map[coord] = eris(cell[0]) ...
0
Kotlin
0
0
0a783ed8b137c31cd0ce2e56e451c6777465af5d
6,274
advent-of-code-2019
MIT License
src/com/kingsleyadio/adventofcode/y2021/day06/Solution.kt
kingsleyadio
435,430,807
false
{"Kotlin": 134666, "JavaScript": 5423}
package com.kingsleyadio.adventofcode.y2021.day06 import com.kingsleyadio.adventofcode.util.readInput fun solution(input: List<Int>, timeLeft: Int): Long { val cache = hashMapOf<String, Long>() fun memo(life: Int, timeLeft: Int, func: (Int, Int) -> Long): Long { val key = "$life-$timeLeft" ret...
0
Kotlin
0
1
9abda490a7b4e3d9e6113a0d99d4695fcfb36422
885
adventofcode
Apache License 2.0
src/Day02.kt
sjgoebel
573,578,579
false
{"Kotlin": 21782}
fun main() { fun scissors(move: Char): Int { return when (move) { 'X' -> 1 + 6 'Y' -> 2 + 0 'Z' -> 3 + 3 else -> 0 } } fun rock(move: Char): Int { return when (move) { 'X' -> 1 + 3 'Y' -> 2 + 6 'Z' -...
0
Kotlin
0
0
ae1588dbbb923dbcd4d19fd1495ec4ebe8f2593e
1,939
advent-of-code-2022-kotlin
Apache License 2.0
src/year2018/dec/level6/ktSolutions.kt
hasanhaja
161,559,069
true
{"Java": 17892, "Kotlin": 2291}
package year2018.dec.level6 fun ktchallenge1(s: String): Int { val expression: List<String> = s.trim().split(" ") return evaluate(expression) } private enum class Ops(val symbol: String) { ADD("+"), MINUS("-"), MULTIPLY("*"), DIVIDE("/"), } private fun evaluate(expression: List<String>): Int ...
0
Java
0
0
c4c84dbfaa2bb4ca38e626a9d63cbabf81016809
2,291
UoB-Codefest
MIT License
src/chapter5/section1/ex14_ArraySort.kt
w1374720640
265,536,015
false
{"Kotlin": 1373556}
package chapter5.section1 import chapter2.swap import extensions.shuffle /** * 数组排序 * 编写一个方法,使用三向字符串快速排序处理以整型数组作为键的情况。 * * 解:字符串可以理解为字符型数组,将字符替换成整数即可 */ fun ex14_ArraySort(array: Array<IntArray>) { array.shuffle() ex14_ArraySort(array, 0, array.size - 1, 0) } private fun ex14_ArraySort(array: Array<IntA...
0
Kotlin
1
6
879885b82ef51d58efe578c9391f04bc54c2531d
1,833
Algorithms-4th-Edition-in-Kotlin
MIT License
kotlinLeetCode/src/main/kotlin/leetcode/editor/cn/[978]最长湍流子数组.kt
maoqitian
175,940,000
false
{"Kotlin": 354268, "Java": 297740, "C++": 634}
//当 A 的子数组 A[i], A[i+1], ..., A[j] 满足下列条件时,我们称其为湍流子数组: // // // 若 i <= k < j,当 k 为奇数时, A[k] > A[k+1],且当 k 为偶数时,A[k] < A[k+1]; // 或 若 i <= k < j,当 k 为偶数时,A[k] > A[k+1] ,且当 k 为奇数时, A[k] < A[k+1]。 // // // 也就是说,如果比较符号在子数组中的每个相邻元素对之间翻转,则该子数组是湍流子数组。 // // 返回 A 的最大湍流子数组的长度。 // // // // 示例 1: // // 输入:[9,4,2,10,7,8,8...
0
Kotlin
0
1
8a85996352a88bb9a8a6a2712dce3eac2e1c3463
1,666
MyLeetCode
Apache License 2.0
src/Day07.kt
joshpierce
573,265,121
false
{"Kotlin": 46425}
import java.io.File // I'm not proud of this, but it works. fun main() { var lines: List<String> = File("Day07.txt").readLines() var fileSystem: MutableList<Obj> = mutableListOf() fileSystem.add(Obj("/", ObjectType.Directory, 0)) var currentObj: Obj = fileSystem[0] for (i in 0..line...
0
Kotlin
0
1
fd5414c3ab919913ed0cd961348c8644db0330f4
6,344
advent-of-code-22
Apache License 2.0
src/main/kotlin/com/github/davio/aoc/y2020/Day19.kt
Davio
317,510,947
false
{"Kotlin": 405939}
package com.github.davio.aoc.y2020 import com.github.davio.aoc.general.Day import com.github.davio.aoc.general.call import com.github.davio.aoc.general.getInputAsSequence import kotlin.system.measureTimeMillis fun main() { measureTimeMillis { Day19.getResult() }.call { println("$it ms") } } object Da...
1
Kotlin
0
0
4fafd2b0a88f2f54aa478570301ed55f9649d8f3
8,968
advent-of-code
MIT License
2021/src/main/kotlin/de/skyrising/aoc2021/day8/solution.kt
skyrising
317,830,992
false
{"Kotlin": 411565}
package de.skyrising.aoc2021.day8 import de.skyrising.aoc.* val test = TestInput(""" be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc fgaebd cg bdaec gdafb agbcfd gdcbef bgcad gfac gcb ...
0
Kotlin
0
0
19599c1204f6994226d31bce27d8f01440322f39
4,471
aoc
MIT License
src/main/kotlin/g1301_1400/s1397_find_all_good_strings/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g1301_1400.s1397_find_all_good_strings // #Hard #String #Dynamic_Programming #String_Matching // #2023_06_06_Time_273_ms_(100.00%)_Space_36.3_MB_(100.00%) @Suppress("NAME_SHADOWING", "UNUSED_PARAMETER") class Solution { private val mod = 1000000007 private lateinit var next: IntArray fun findGood...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
2,805
LeetCode-in-Kotlin
MIT License
src/main/kotlin/net/maizegenetics/phgv2/pathing/MostLikelyParents.kt
maize-genetics
696,835,682
false
{"Kotlin": 766953, "Shell": 262}
package net.maizegenetics.phgv2.pathing import net.maizegenetics.phgv2.api.HaplotypeGraph import net.maizegenetics.phgv2.api.ReferenceRange import net.maizegenetics.phgv2.api.SampleGamete /** * Given a set of read mappings, finds the most likely parents in a stepwise fashion. The parent with the most reads * is sel...
1
Kotlin
0
3
4a97577424042322de5ed9f1e40b43116679f14f
3,689
phg_v2
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/DesignHashSet.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
4,924
kotlab
Apache License 2.0
kotlin/src/com/s13g/aoc/aoc2023/Day2.kt
shaeberling
50,704,971
false
{"Kotlin": 300158, "Go": 140763, "Java": 107355, "Rust": 2314, "Starlark": 245}
package com.s13g.aoc.aoc2023 import com.s13g.aoc.Result import com.s13g.aoc.Solver import kotlin.math.max import com.s13g.aoc.mul import com.s13g.aoc.resultFrom /** * --- Day 2: Cube Conundrum --- * https://adventofcode.com/2023/day/2 */ class Day2 : Solver { override fun solve(lines: List<String>): Result { ...
0
Kotlin
1
2
7e5806f288e87d26cd22eca44e5c695faf62a0d7
1,141
euler
Apache License 2.0
archive/2022/Day02.kt
mathijs81
572,837,783
false
{"Kotlin": 167658, "Python": 725, "Shell": 57}
package aoc2022 private const val EXPECTED_1 = 15 private const val EXPECTED_2 = 12 private val SCORES = listOf( 3, 0, 6, 6, 3, 0, 0, 6, 3, ) private class Day02(isTest: Boolean) : Solver(isTest) { fun part1(): Any { var sum = 0 for (line in readAsLines()) { val...
0
Kotlin
0
2
92f2e803b83c3d9303d853b6c68291ac1568a2ba
1,286
advent-of-code-2022
Apache License 2.0
src/main/kotlin/g2501_2600/s2584_split_the_array_to_make_coprime_products/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g2501_2600.s2584_split_the_array_to_make_coprime_products // #Hard #Array #Hash_Table #Math #Number_Theory // #2023_07_11_Time_341_ms_(100.00%)_Space_45.6_MB_(100.00%) class Solution { private fun fillDivideArray() { for (i in 1 until divideTo.size) { divideTo[i] = i } ...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,592
LeetCode-in-Kotlin
MIT License
src/main/kotlin/com/jaspervanmerle/aoc2021/day/Day10.kt
jmerle
434,010,865
false
{"Kotlin": 60581}
package com.jaspervanmerle.aoc2021.day class Day10 : Day("390993", "2391385187") { private val lines = input.lines() private val openCharacterByClosing = mapOf( ')' to '(', ']' to '[', '}' to '{', '>' to '<' ) private val errorScoreByCharacter = mapOf( ')' to 3...
0
Kotlin
0
0
dcac2ac9121f9bfacf07b160e8bd03a7c6732e4e
1,654
advent-of-code-2021
MIT License
src/main/kotlin/com/nibado/projects/advent/y2016/Day17.kt
nielsutrecht
47,550,570
false
null
package com.nibado.projects.advent.y2016 import com.nibado.projects.advent.Day import com.nibado.projects.advent.Direction import com.nibado.projects.advent.Hash import com.nibado.projects.advent.Point object Day17 : Day { private val dirMap = mapOf("D" to Direction.SOUTH, "U" to Direction.NORTH, "R" to Direction...
1
Kotlin
0
15
b4221cdd75e07b2860abf6cdc27c165b979aa1c7
1,415
adventofcode
MIT License
advent-of-code-2020/src/test/java/aoc/Day21AllergenAssessment.kt
yuriykulikov
159,951,728
false
{"Kotlin": 1666784, "Rust": 33275}
package aoc import org.assertj.core.api.Assertions.assertThat import org.junit.Test inline class Ingredient(val value: String) inline class Allergen(val value: String) class Day21AllergenAssessment { /** * * Each allergen is found in exactly one ingredient. * Each ingredient contains **zero** or o...
0
Kotlin
0
1
f5efe2f0b6b09b0e41045dc7fda3a7565cb21db3
18,923
advent-of-code
MIT License
advent-of-code2015/src/main/kotlin/day23/Advent23.kt
REDNBLACK
128,669,137
false
null
package day23 import day23.Operation.Type.* import parseInput import splitToLines import java.util.* /** --- Day 23: Opening the Turing Lock --- <NAME> just got her very first computer for Christmas from some unknown benefactor. It comes with instructions and an example program, but the computer itself seems to be m...
0
Kotlin
0
0
e282d1f0fd0b973e4b701c8c2af1dbf4f4a149c7
4,318
courses
MIT License
year2022/src/main/kotlin/net/olegg/aoc/year2022/day20/Day20.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2022.day20 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.year2022.DayOf2022 /** * See [Year 2022, Day 20](https://adventofcode.com/2022/day/20) */ object Day20 : DayOf2022(20) { override fun first(): Any? { val numbers = lines .mapIndexed { index, line -> line.toInt...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
1,763
adventofcode
MIT License
2016/07/Solution.kt
AdrianMiozga
588,519,359
false
{"Kotlin": 110785, "Python": 11275, "Assembly": 3369, "C": 2378, "Pawn": 1390, "Dart": 732}
import java.io.File private const val FILENAME = "2016/07/input.txt" fun main() { partOne() partTwo() } private fun partOne() { val file = File(FILENAME).readLines() var valid = 0 for (ip in file) { val inBrackets = Regex("""\[\w+]""") .findAll(ip) ...
0
Kotlin
0
0
c9cba875089d8d4fb145932c45c2d487ccc7e8e5
2,722
Advent-of-Code
MIT License
src/main/kotlin/io/queue/TagValidator.kt
jffiorillo
138,075,067
false
{"Kotlin": 434399, "Java": 14529, "Shell": 465}
package io.queue import java.util.* // https://leetcode.com/problems/tag-validator/ class TagValidator { private val tagRegex = "<[/|A-Z]+>".toRegex() private val cDataRegex = "<!\\[CDATA\\[.*]]>".toRegex() fun isValid(code: String): Boolean = execute(code) fun execute(input: String): Boolean { when { ...
0
Kotlin
0
0
f093c2c19cd76c85fab87605ae4a3ea157325d43
4,054
coding
MIT License
2015/src/main/kotlin/com/koenv/adventofcode/Day2.kt
koesie10
47,333,954
false
null
package com.koenv.adventofcode object Day2 { public fun getSquareFeetOfWrappingPaper(input: String): Int { val (l, w, h) = getDimensions(input) val areas = arrayOf(l * w, w * h, h * l) val minArea = areas.min()!! return areas.map { it * 2 }.sum() + minArea } public fun getT...
0
Kotlin
0
0
29f3d426cfceaa131371df09785fa6598405a55f
1,336
AdventOfCode-Solutions-Kotlin
MIT License
year2017/src/main/kotlin/net/olegg/aoc/year2017/day22/Day22.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2017.day22 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.utils.Directions import net.olegg.aoc.utils.Directions.Companion.CCW import net.olegg.aoc.utils.Directions.Companion.CW import net.olegg.aoc.utils.Directions.Companion.REV import net.olegg.aoc.utils.Vector2D import net.olegg...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
1,940
adventofcode
MIT License
src/main/kotlin/days/Day10.kt
tpepper0408
317,612,203
false
null
package days import java.util.* class Day10() : Day<Long>(10) { override fun partOne(): Long { var values = inputList.map { it.toInt() }.plus(0) values = values.sorted() var numberOf1Diffs = 0L var numberOf3Diffs = 0L var previousValue = -1 for...
0
Kotlin
0
0
67c65a9e93e85eeb56b57d2588844e43241d9319
4,153
aoc2020
Creative Commons Zero v1.0 Universal
2021/src/day01/Day01.kt
Bridouille
433,940,923
false
{"Kotlin": 171124, "Go": 37047}
package day01 import readInput fun part1(input: List<String>) = input.windowed(2).map { it[0] < it[1] }.count { it } const val SLIDING_WINDOW_SIZE = 3 fun part2(input: List<String>): Int { val sliding1: MutableList<Int> = mutableListOf<Int>() val sliding2: MutableList<Int> = mutableListOf<Int>() var in...
0
Kotlin
0
2
8ccdcce24cecca6e1d90c500423607d411c9fee2
1,099
advent-of-code
Apache License 2.0
src/main/kotlin/co/csadev/advent2022/Day16.kt
gtcompscientist
577,439,489
false
{"Kotlin": 252918}
/** * Copyright (c) 2022 by <NAME> * Advent of Code 2022, Day 16 * Problem Description: http://adventofcode.com/2021/day/16 */ package co.csadev.advent2022 import co.csadev.adventOfCode.BaseDay import co.csadev.adventOfCode.Resources.resourceAsList import kotlin.math.max class Day16(override val input: List<Strin...
0
Kotlin
0
1
43cbaac4e8b0a53e8aaae0f67dfc4395080e1383
3,438
advent-of-kotlin
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/LoudAndRich.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2022 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
4
Kotlin
0
19
776159de0b80f0bdc92a9d057c852b8b80147c11
2,686
kotlab
Apache License 2.0
src/Day24.kt
frungl
573,598,286
false
{"Kotlin": 86423}
data class Blizzard(val pos: Pair<Int, Int>, val move: Pair<Int, Int>) @OptIn(ExperimentalStdlibApi::class) fun main() { fun parseInput(input: List<String>): List<Blizzard> { val tiles = mapOf( '>' to Pair(0, 1), '<' to Pair(0, -1), '^' to Pair(-1, 0), 'v' to...
0
Kotlin
0
0
d4cecfd5ee13de95f143407735e00c02baac7d5c
5,563
aoc2022
Apache License 2.0
src/main/kotlin/ch/uzh/ifi/seal/bencher/prioritization/search/Greedy.kt
chrstphlbr
227,602,878
false
{"Kotlin": 918163, "Java": 29153}
package ch.uzh.ifi.seal.bencher.prioritization.search import org.uma.jmetal.algorithm.Algorithm import org.uma.jmetal.problem.permutationproblem.PermutationProblem import org.uma.jmetal.solution.permutationsolution.PermutationSolution import org.uma.jmetal.solution.permutationsolution.impl.IntegerPermutationSolution ...
0
Kotlin
2
4
06601fb4dda3b2996c2ba9b2cd612e667420006f
2,580
bencher
Apache License 2.0
src/Day01.kt
timhillgit
572,354,733
false
{"Kotlin": 69577}
fun <T> Iterable<T>.split( predicate: (T) -> Boolean ): List<List<T>> = fold(listOf(listOf())) { result, element -> if (predicate(element)) { result + listOf(listOf()) } else { result.dropLast(1) + listOf(result.last() + element) } } fun <T> Iterable<T?>.splitOnNull( predicate: (T) ...
0
Kotlin
0
1
76c6e8dc7b206fb8bc07d8b85ff18606f5232039
764
advent-of-code-2022
Apache License 2.0
hackerrank/journey-to-the-moon/Solution.kt
shengmin
5,972,157
false
null
import java.io.* import java.math.* import java.security.* import java.text.* import java.util.* import java.util.concurrent.* import java.util.function.* import java.util.regex.* import java.util.stream.* import kotlin.collections.* import kotlin.comparisons.* import kotlin.io.* import kotlin.jvm.* import kotlin.jvm.f...
0
Java
18
20
08e65546527436f4bd2a2014350b2f97ac1367e7
2,448
coding-problem
MIT License
src/main/kotlin/Solution1.kt
AndreySmirdin
170,665,827
false
null
import org.apache.commons.lang3.StringUtils import java.util.* import kotlin.collections.ArrayList object Solution1 { @JvmStatic fun main(args: Array<String>) { val reader = Scanner(System.`in`) val n = reader.nextInt() val names = ArrayList<String>() for (i in 0..n) { ...
0
Kotlin
0
0
27465d19f5413a06948fc32d789ac7c35a80682f
2,943
Task_for_Groovy_project
MIT License
src/Day03.kt
DevHexs
573,262,501
false
{"Kotlin": 11452}
fun main(){ fun getPriorityValue(): MutableMap<Char,Int> { val mapPriority = mutableMapOf<Char,Int>() for (i in 'a'..'z'){ mapPriority.put(i,26 - ('z'.code - i.code)) } for (i in 'A'..'Z'){ mapPriority.put(i,52 - ('Z'.code - i.code)) } ret...
0
Kotlin
0
0
df0ff2ed7c1ebde9327cd1a102499ac5467b73be
1,817
AdventOfCode-2022-Kotlin
Apache License 2.0
puzzles/src/main/kotlin/com/kotlinground/puzzles/arrays/meetingrooms/meetingRooms.kt
BrianLusina
113,182,832
false
{"Kotlin": 483489, "Shell": 7283, "Python": 1725}
package com.kotlinground.puzzles.arrays.meetingrooms import java.util.* /** * Uses 2 lists to find the minimum number of meeting rooms required * * Complexity: * Time Complexity: O(n*log(n)) as we sort the 2 lists * Space Complexity: O(n) we store the meetings in a list * * @param meetings: start and end times...
1
Kotlin
1
0
5e3e45b84176ea2d9eb36f4f625de89d8685e000
1,849
KotlinGround
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/SortColors.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,900
kotlab
Apache License 2.0
src/main/aoc2022/Day25.kt
nibarius
154,152,607
false
{"Kotlin": 963896}
package aoc2022 import kotlin.math.pow class Day25(input: List<String>) { val numbers = input.map { snafuToDecimal(it) } private fun Char.value(): Double = when (this) { '1' -> 1.0 '2' -> 2.0 '0' -> 0.0 '-' -> -1.0 '=' -> -2.0 else -> error("Invalid digit") ...
0
Kotlin
0
6
f2ca41fba7f7ccf4e37a7a9f2283b74e67db9f22
2,738
aoc
MIT License
src/Day05.kt
TheGreatJakester
573,222,328
false
{"Kotlin": 47612}
import utils.string.asLines import utils.string.asParts import java.lang.Exception private data class Move(val count: Int, val from: Int, val to: Int) private typealias Tower = ArrayDeque<Char> fun main() { fun readInTowers(input: List<String>, towerCount: Int): List<Tower> { val towers = List(towerCount)...
0
Kotlin
0
0
c76c213006eb8dfb44b26822a44324b66600f933
2,413
2022-AOC-Kotlin
Apache License 2.0
src/main/kotlin/days/Day13.kt
andilau
429,557,457
false
{"Kotlin": 103829}
package days @AdventOfCodePuzzle( name = "Knights of the Dinner Table", url = "https://adventofcode.com/2015/day/13", date = Date(day = 13, year = 2015) ) class Day13(happinessStatements: List<String>) : Puzzle { private val happinessMap = happinessStatements.parseStatements() override fun partOne...
0
Kotlin
0
0
55932fb63d6a13a1aa8c8df127593d38b760a34c
1,947
advent-of-code-2015
Creative Commons Zero v1.0 Universal
src/Day10.kt
Sasikuttan2163
647,296,570
false
null
fun main() { var cycleCount = 1 val keyframes = mutableListOf(20, 60, 100, 140, 180, 220) var x = 1 val instructionQueue = mutableListOf<Pair<Int, Int>>() readInput("Day10").forEach { line -> cycleCount += if (line.startsWith("addx")) { instructionQueue.add(Pair(cycleCount + 2, l...
0
Kotlin
0
0
fb2ade48707c2df7b0ace27250d5ee240b01a4d6
1,012
AoC-2022-Solutions-In-Kotlin
MIT License
year2018/src/main/kotlin/net/olegg/aoc/year2018/day10/Day10.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2018.day10 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.utils.Vector2D import net.olegg.aoc.year2018.DayOf2018 /** * See [Year 2018, Day 10](https://adventofcode.com/2018/day/10) */ object Day10 : DayOf2018(10) { private val PATTERN = "position=<\\s*(-?\\d+),\\s*(-?\\d+)> ve...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
1,876
adventofcode
MIT License
exercises/practice/binary-search/.meta/src/reference/kotlin/BinarySearch.kt
exercism
47,675,865
false
{"Kotlin": 382097, "Shell": 14600}
object BinarySearch { fun <T: Comparable<T>> search(list: List<T>, item: T) : Int { require(list.isSorted()) {"The provided list must be sorted in ascending order"} if(list.isEmpty()) { throw NoSuchElementException("value $item is not in array $list") } return searchRe...
51
Kotlin
190
199
7f1c7a11cfe84499cfef4ea2ecbc6c6bf34a6ab9
2,309
kotlin
MIT License
BayesClassifier.kt
khqnn
296,738,545
false
null
class BayesClassifier{ private var vocabSize = 0 private var positiveSum = 0 private var negativeSum = 0 private var positiveClassProbability = 0.0 private var negativeClassProbability = 0.0 private val positiveCorpus = mutableMapOf<String, Int>() private val negativeCorpus = mutableM...
0
Kotlin
0
0
1f0278d680648b0191297ec546f8db9941e53d4b
5,279
Naive-Bayes-Classifier
MIT License
src/Java/LeetcodeSolutions/src/main/java/leetcode/solutions/concrete/kotlin/Solution_12_Integer_to_Roman.kt
v43d3rm4k4r
515,553,024
false
{"Kotlin": 40113, "Java": 25728}
package leetcode.solutions.concrete.kotlin import leetcode.solutions.* import leetcode.solutions.ProblemDifficulty.* import leetcode.solutions.validation.SolutionValidator.* import leetcode.solutions.annotations.ProblemInputData import leetcode.solutions.annotations.ProblemSolution import leetcode.solutions.annotation...
0
Kotlin
0
1
c5a7e389c943c85a90594315ff99e4aef87bff65
4,191
LeetcodeSolutions
Apache License 2.0
src/Day15.kt
jrmacgill
573,065,109
false
{"Kotlin": 76362}
import utils.* import java.lang.Math.max import java.lang.Math.min class Day15 { fun go() { var lines =readInput("day15_test") //var lines =readInput("day15") val row = 2000000 //val row = 10 val data = mutableListOf<List<Int>>() val sensors = mutableMapOf<Point, ...
0
Kotlin
0
1
3dcd590f971b6e9c064b444139d6442df034355b
2,692
aoc-2022-kotlin
Apache License 2.0
src/main/kotlin/day5/Day5.kt
errob37
573,508,650
false
{"Kotlin": 18301}
package day5 import ResourceFileReader class Day5 { companion object { private val stacks = mapOf<Int, MutableList<String>>( 1 to mutableListOf(), 2 to mutableListOf(), 3 to mutableListOf(), 4 to mutableListOf(), 5 to mutableListOf(), ...
0
Kotlin
0
0
7e84babb58eabbdb636f8cca87fdcf4314fb2af0
3,019
adventofcode-2022
Apache License 2.0
tools/recipe/src/main/kotlin/top/bettercode/summer/tools/recipe/result/RecipeExt.kt
top-bettercode
387,652,015
false
{"Kotlin": 2939064, "Java": 24119, "JavaScript": 22541, "CSS": 22336, "HTML": 15833}
package top.bettercode.summer.tools.recipe.result import top.bettercode.summer.tools.recipe.criteria.DoubleRange import top.bettercode.summer.tools.recipe.criteria.RecipeRelation import top.bettercode.summer.tools.recipe.material.MaterialIDs.Companion.toMaterialIDs import top.bettercode.summer.tools.recipe.material.Re...
0
Kotlin
0
1
d07ed7250e6dcdbcce51f27f5f22602e9c222b3c
5,678
summer
Apache License 2.0
src/main/kotlin/Day06.kt
brigham
573,127,412
false
{"Kotlin": 59675}
fun main() { fun part1(input: List<String>): Int { val line = input[0] return line .windowedSequence(4, 1) .mapIndexed { index, s -> if (s.toSet().size == 4) index + 4 else null } .filterNotNull().first() } fun part2(input: List<String>): Int { va...
0
Kotlin
0
0
b87ffc772e5bd9fd721d552913cf79c575062f19
802
advent-of-code-2022
Apache License 2.0
kotlin/0212-word-search-ii.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 { private companion object{ const val IMPOSSIBLE: Char = '#' val DIRS = intArrayOf(0, -1, 0, 1, 0) } fun findWords(board: Array<CharArray>, words: Array<String>): List<String> { val nRows = board.size val nCols = board[0].size val root = buildTrie(word...
337
JavaScript
2,004
4,367
0cf38f0d05cd76f9e96f08da22e063353af86224
1,962
leetcode
MIT License
src/main/kotlin/nl/jackploeg/aoc/_2023/calendar/day13/Day13.kt
jackploeg
736,755,380
false
{"Kotlin": 318734}
package nl.jackploeg.aoc._2023.calendar.day13 import nl.jackploeg.aoc.generators.InputGenerator.InputGeneratorFactory import nl.jackploeg.aoc.utilities.readStringFile import javax.inject.Inject import kotlin.math.min typealias Pattern = MutableList<MutableList<Char>> class Day13 @Inject constructor( private val ge...
0
Kotlin
0
0
f2b873b6cf24bf95a4ba3d0e4f6e007b96423b76
2,970
advent-of-code
MIT License
src/main/kotlin/year2021/day-18.kt
ppichler94
653,105,004
false
{"Kotlin": 182859}
package year2021 import lib.aoc.Day import lib.aoc.Part import lib.math.product import kotlin.math.roundToInt fun main() { Day(18, 2021, PartA18(), PartB18()).run() } open class PartA18 : Part() { protected lateinit var numbers: MutableList<String> override fun parse(text: String) { numbers = te...
0
Kotlin
0
0
49dc6eb7aa2a68c45c716587427353567d7ea313
4,358
Advent-Of-Code-Kotlin
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/MinDistance.kt
ashtanko
515,874,521
false
{"Kotlin": 235302, "Shell": 755, "Makefile": 591}
/* * MIT License * Copyright (c) 2022 <NAME> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge...
2
Kotlin
1
9
6a2d7ed76e2d88a3446f6558109809c318780e2c
5,100
the-algorithms
MIT License
src/main/kotlin/Day17.kt
cbrentharris
712,962,396
false
{"Kotlin": 171464}
import java.util.* import kotlin.String import kotlin.collections.List import kotlin.math.min object Day17 { enum class Direction { UP, DOWN, LEFT, RIGHT } data class CurrentStepInformation( val currentCoordinate: Coordinate, val currentDirection: Direction,...
0
Kotlin
0
1
f689f8bbbf1a63fecf66e5e03b382becac5d0025
5,358
kotlin-kringle
Apache License 2.0
src/main/kotlin/day1/Day01.kt
Avataw
572,709,044
false
{"Kotlin": 99761}
package day1 fun solveA(input: List<String>): Int = input .chunkByEmptyLine() .reduceToSum() .getSumOfNHighestSums(1) fun solveB(input: List<String>): Int = input .chunkByEmptyLine() .reduceToSum() .getSumOfNHighestSums(3) fun List<String>.chunkByEmptyLine() = this .joinToString(" ") { i...
0
Kotlin
2
0
769c4bf06ee5b9ad3220e92067d617f07519d2b7
598
advent-of-code-2022
Apache License 2.0
code/numeric/LinEqSolver.kt
hakiobo
397,069,173
false
null
private class LinEqSolver(val matrix: Array<DoubleArray>) { var status: Status? = null private set private fun swap(r1: Int, r2: Int) { val tmp = matrix[r1] matrix[r1] = matrix[r2] matrix[r2] = tmp } private fun multiplyRow(row: Int, mult: Double) { for (x in m...
0
Kotlin
1
2
f862cc5e7fb6a81715d6ea8ccf7fb08833a58173
2,330
Kotlinaughts
MIT License
src/main/kotlin/de/hermes/technicalcasekotlin/models/Line.kt
Accessory
718,200,550
false
{"Kotlin": 15522, "Dockerfile": 471}
package de.hermes.technicalcasekotlin.models import kotlin.math.max import kotlin.math.min data class Line(val start: Position, val end: Position) { fun intersections(other: Line): Int { val selfIsHorizontal = this.isHorizontal() val otherIsHorizontal = other.isHorizontal() return when { ...
0
Kotlin
0
0
257552ae89688c2c3de2623769586f1a95a69b5c
2,198
technical-case-kotlin
Apache License 2.0
src/day16/Code.kt
fcolasuonno
225,219,560
false
null
package day16 import isDebug import java.io.File import kotlin.math.abs fun main() { val name = if (isDebug()) "test.txt" else "input.txt" System.err.println(name) val dir = ::main::class.java.`package`.name val input = File("src/$dir/$name").readLines() val parsed = parse(input) println("Part...
0
Kotlin
0
0
d1a5bfbbc85716d0a331792b59cdd75389cf379f
1,375
AOC2019
MIT License
src/day02/Day02.kt
JakubMosakowski
572,993,890
false
{"Kotlin": 66633}
package day02 import readInput /** * The Elves begin to set up camp on the beach. * To decide whose tent gets to be closest to the snack storage, a giant Rock Paper Scissors tournament is already in progress. * * Rock Paper Scissors is a game between two players. * Each game contains many rounds; in each round, ...
0
Kotlin
0
0
f6e9a0b6c2b66c28f052d461c79ad4f427dbdfc8
6,122
advent-of-code-2022
Apache License 2.0
src/Day02.kt
phoenixli
574,035,552
false
{"Kotlin": 29419}
fun main() { fun part1(input: List<String>): Int { var totalScore = 0 input.forEach { totalScore += score(it[0], mapXyzToAbc(it[2])) } return totalScore } fun part2(input: List<String>): Int { var totalScore = 0 input.forEach { tota...
0
Kotlin
0
0
5f993c7b3c3f518d4ea926a792767a1381349d75
2,113
Advent-of-Code-2022
Apache License 2.0
app/src/main/java/com/aesean/twentyfour/CalculateImpl.kt
aesean
63,247,450
false
{"Java": 14199, "Kotlin": 7326, "Dart": 4268, "Swift": 3770}
package com.aesean.twentyfour import java.math.BigDecimal import java.util.* interface CalculateRule { fun size(): Int fun calculate(a: String, index: Int, b: String): String fun symbol(index: Int): String fun deviation(): String } fun main(args: Array<String>) { test("8,8,3,3") test("5,5,5,...
0
Java
2
3
666ae03f418cd54819b6d4a671985a0310bc928b
5,987
TwentyFour
Apache License 2.0
Generics/Generic functions/src/Task.kt
feczkob
638,839,822
false
null
import java.util.* fun <K, C : MutableCollection<K>> Collection<K>.partitionTo( one: C, two: C, pred: Collection<K>.(K) -> Boolean, ): Pair<MutableCollection<K>, MutableCollection<K>> { // * solution 1 // this.forEach { // if (pred(it)) { // one += it // } else { // ...
0
Kotlin
0
0
b954a54b8f34bddbee3c2d116eb60b0ffa9ac855
979
Kotlin-Koans
MIT License
src/main/kotlin/d22_ReactorReboot/ReactorReboot.kt
aormsby
425,644,961
false
{"Kotlin": 68415}
package d22_ReactorReboot import util.Input import util.Output fun main() { Output.day(22, "Reactor Reboot") val startTime = Output.startTime() val instructions = Input.parseLines(filename = "/input/d22_reboot_steps.txt") .map { Cuboid.of(it) } as MutableList val initializationLimits = Cuboid...
0
Kotlin
1
1
193d7b47085c3e84a1f24b11177206e82110bfad
2,339
advent-of-code-2021
MIT License
kotlin/src/com/codeforces/round736/D_not_completed.kt
programmerr47
248,502,040
false
null
package com.codeforces.round736 import java.util.* import kotlin.math.abs import kotlin.math.max fun main() { val reader = Scanner(System.`in`) task(reader) } private fun task(input: Scanner) { repeat(input.nextInt()) { val a = LongArray(input.nextInt()) { input.nextLong() } val diffs = L...
0
Kotlin
0
0
0b5fbb3143ece02bb60d7c61fea56021fcc0f069
1,584
problemsolving
Apache License 2.0
src/main/kotlin/Day01.kt
robfletcher
724,814,488
false
{"Kotlin": 18682}
class Day01 : Puzzle { override fun test() { val testInput1 = """ 1abc2 pqr3stu8vwx a1b2c3d4e5f treb7uchet""".trimIndent() assert(part1(testInput1.lineSequence()) == 142) val testInput2 = """ two1nine eightwothree abcone2threexyz xtwone3four 4nineeightseven2 zonei...
0
Kotlin
0
0
cf10b596c00322ea004712e34e6a0793ba1029ed
1,197
aoc2023
The Unlicense
src/Day02.kt
Oktosha
573,139,677
false
{"Kotlin": 110908}
fun main() { class Game(val player: Int, val opponent: Int) fun getMovesPart1(description: String): Game { val opponent = description[0].code - 'A'.code val player = description[2].code - 'X'.code return Game(player, opponent) } fun getGameScore(game: Game): Int { val m...
0
Kotlin
0
0
e53eea61440f7de4f2284eb811d355f2f4a25f8c
1,341
aoc-2022
Apache License 2.0
src/main/kotlin/days/aoc2015/Day14.kt
bjdupuis
435,570,912
false
{"Kotlin": 537037}
package days.aoc2015 import days.Day class Day14: Day(2015, 14) { // Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds override fun partOne(): Any { val reindeer = parseReindeer(inputList) return reindeer.map { it.calculateDistanceForTime(2503) }.maxOrNull() ?: 0 }...
0
Kotlin
0
1
c692fb71811055c79d53f9b510fe58a6153a1397
1,643
Advent-Of-Code
Creative Commons Zero v1.0 Universal
2022/Day09.kt
amelentev
573,120,350
false
{"Kotlin": 87839}
import kotlin.math.abs fun main() { val input = readInput("Day09") data class Point(val x: Int, val y: Int) operator fun Point.plus(p: Point) = Point(x + p.x, y + p.y) operator fun Point.minus(p: Point) = Point(x - p.x, y - p.y) val dirs = mapOf( 'R' to Point(1, 0), 'U' to Point(0, ...
0
Kotlin
0
0
a137d895472379f0f8cdea136f62c106e28747d5
1,093
advent-of-code-kotlin
Apache License 2.0
src/main/kotlin/g2001_2100/s2019_the_score_of_students_solving_math_expression/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g2001_2100.s2019_the_score_of_students_solving_math_expression // #Hard #Array #String #Dynamic_Programming #Math #Stack #Memoization // #2023_06_23_Time_1497_ms_(100.00%)_Space_48.2_MB_(100.00%) import java.util.ArrayDeque class Solution { private lateinit var dp: Array<Array<HashSet<Int>?>> fun sc...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
2,337
LeetCode-in-Kotlin
MIT License
Retos/Reto #19 - ANÁLISIS DE TEXTO [Media]/kotlin/jaimefere.kt
mouredev
581,049,695
false
{"Python": 3866914, "JavaScript": 1514237, "Java": 1272062, "C#": 770734, "Kotlin": 533094, "TypeScript": 457043, "Rust": 356917, "PHP": 281430, "Go": 243918, "Jupyter Notebook": 221090, "Swift": 216751, "C": 210761, "C++": 164758, "Dart": 159755, "Ruby": 70259, "Perl": 52923, "VBScript": 49663, "HTML": 45912, "Raku": ...
fun analyzeText(text: String) { val symbols = arrayOf(' ', '.', ',', ':', ';', '-', '¡', '!', '¿', '?', '(', ')', '[', ']', '"', '\t', '\n') var wordLengths = arrayOf<Int>() var pointsCounter = 0 var largestWord = "" var currentWord = "" text.forEach { char -> if(symbols.contains(char))...
4
Python
2,929
4,661
adcec568ef7944fae3dcbb40c79dbfb8ef1f633c
2,215
retos-programacion-2023
Apache License 2.0
src/com/wd/algorithm/leetcode/ALGO0009.kt
WalkerDenial
327,944,547
false
null
package com.wd.algorithm.leetcode import com.wd.algorithm.test /** * 9. 回文数 * * 给你一个整数 x ,如果 x 是一个回文整数,返回 true ;否则,返回 false 。 * 回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。例如,121 是回文,而 123 不是。 * */ class ALGO0009 { fun isPalindrome1(x: Int): Boolean { if (x < 0 || x > Int.MAX_VALUE) return false if (x <...
0
Kotlin
0
0
245ab89bd8bf467625901034dc1139f0a626887b
1,604
AlgorithmAnalyze
Apache License 2.0
src/main/kotlin/com/mckernant1/leetcode/ThreeSum.kt
mckernant1
494,952,749
false
{"Kotlin": 33093}
package com.mckernant1.leetcode fun main() { // println(threeSum(intArrayOf(-1, 0, 1, 2, -1, -4))) // println(threeSum(intArrayOf(0, 1, 1))) println(threeSum(intArrayOf(-1, 0, 1, 2, -1, -4))) } private fun threeSum(nums: IntArray): List<List<Int>> { val nums = nums.sorted() var middle = nums.size / ...
0
Kotlin
0
0
5aaa96588925b1b8d77d7dd98dd54738deeab7f1
948
kotlin-random
Apache License 2.0
src/year2022/Day10.kt
Maetthu24
572,844,320
false
{"Kotlin": 41016}
package year2022 import kotlin.math.abs fun main() { fun part1(input: List<String>): Int { var register = 1 var cycle = 1 return buildList { for (op in input) { when (op) { "noop" -> cycle += 1 else -> { ...
0
Kotlin
0
1
3b3b2984ab718899fbba591c14c991d76c34f28c
2,172
adventofcode-kotlin
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/SearchInsertPosition.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,853
kotlab
Apache License 2.0
src/Day08.kt
jvmusin
572,685,421
false
{"Kotlin": 86453}
fun main() { val dx = intArrayOf(-1, 0, 1, 0) val dy = intArrayOf(0, 1, 0, -1) fun part1(input: List<String>): Int { val n = input.size val m = input[0].length val a = input.map { s -> s.map { it.digitToInt() } } fun check(x: Int, y: Int): Boolean { fun check(d: ...
1
Kotlin
0
0
4dd83724103617aa0e77eb145744bc3e8c988959
2,693
advent-of-code-2022
Apache License 2.0
src/test/kotlin/ch/ranil/aoc/aoc2022/Day23.kt
stravag
572,872,641
false
{"Kotlin": 234222}
package ch.ranil.aoc.aoc2022 import ch.ranil.aoc.AbstractDay import org.junit.jupiter.api.Test import kotlin.test.assertEquals class Day23 : AbstractDay() { @Test fun part1Test() { assertEquals(110, compute1(testInput)) } @Test fun part1Puzzle() { assertEquals(4091, compute1(puzz...
0
Kotlin
1
0
dbd25877071cbb015f8da161afb30cf1968249a8
6,234
aoc
Apache License 2.0
src/Day04.kt
AlaricLightin
572,897,551
false
{"Kotlin": 87366}
fun main() { fun getRanges(string: String): Pair<IntRange, IntRange> { val stringList = string.split(",") if (stringList.size < 2) throw IllegalArgumentException() val s0List = stringList[0].split("-") val s1List = stringList[1].split("-") return Pair(IntRange(s0...
0
Kotlin
0
0
ee991f6932b038ce5e96739855df7807c6e06258
1,282
AdventOfCode2022
Apache License 2.0
src/main/kotlin/Main.kt
BapaLruH
245,823,915
false
null
fun max(first: Int, second: Int) = if (first > second) first else second fun max(first: Int, second: Int, third: Int) = if (max(first, second) > third) max(first, second) else third fun fitness(ivan: Int, nik: Int): Int { var month = 0 var powerIvan = ivan var powerNikolay = nik while (powerIvan < pow...
0
Kotlin
0
0
d934ce3f5f282cd236f1285c7a398a55ccdb5ca6
2,633
job4j-kt
Apache License 2.0
kotlin/329.Longest Increasing Path in a Matrix(矩阵中的最长递增路径).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 integer matrix, find the length of the longest increasing path.</p> <p>From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or move outside of the boundary (i.e. wrap-around is not allowed).</p> <p><b>Example 1:</b></p> <pre> <strong>Input: </st...
0
Python
1
3
6731e128be0fd3c0bdfe885c1a409ac54b929597
2,807
leetcode
MIT License
src/leetcode/aprilChallenge2020/weekfour/MaximalSquare.kt
adnaan1703
268,060,522
false
null
package leetcode.aprilChallenge2020.weekfour import kotlin.math.max import kotlin.math.min fun main() { var matrix = arrayOf( charArrayOf('1', '0', '1', '0', '0'), charArrayOf('1', '0', '1', '1', '1'), charArrayOf('1', '1', '1', '1', '1'), charArrayOf('1', '0', '0', '1', '0') )...
0
Kotlin
0
0
e81915db469551342e78e4b3f431859157471229
1,797
KotlinCodes
The Unlicense
src/main/kotlin/dev/shtanko/algorithms/leetcode/AddTwoNumbers.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,374
kotlab
Apache License 2.0
src/Day01.kt
nguyendanv
573,066,311
false
{"Kotlin": 18026}
fun main() { fun part1(input: List<String>): Int { return input .joinToString("\n") .split("\n\n") .maxOfOrNull { it.split("\n").sumOf(String::toInt) }!! } fun part2(input: List<String>): Int { return input .joinToString("\n") .spl...
0
Kotlin
0
0
376512583af723b4035b170db1fa890eb32f2f0f
717
advent2022
Apache License 2.0
src/main/kotlin/Exercise4.kt
US-ADDA
521,923,956
false
{"Kotlin": 17265}
import java.util.stream.Stream import kotlin.math.absoluteValue import kotlin.math.pow class Exercise4 { companion object { fun functional(n: Double, e: Double): Double { val pair = Stream.iterate( Pair(0.0, n) // Definimos el comienzo como 0 (nos dicen que se calcula la raíz c...
0
Kotlin
0
0
b83e4fd0e457bda0b026df3a94f538d4dab715cf
2,505
PI1_kotlin
Apache License 2.0
src/Day23.kt
greg-burgoon
573,074,283
false
{"Kotlin": 120556}
enum class Direction { NORTH, SOUTH, EAST, WEST } fun main() { data class Coord(val y: Int, val x: Int) { fun N(): Coord{ return Coord(y-1, x) } fun S(): Coord{ return Coord(y+1, x) } fun E(): Coord{ return Coord(y, x+1) } ...
0
Kotlin
0
1
74f10b93d3bad72fa0fc276b503bfa9f01ac0e35
10,647
aoc-kotlin
Apache License 2.0
src/deselby/std/extensions/collections.kt
deselby-research
166,023,166
false
null
package deselby.std.extensions import kotlin.math.pow import kotlin.math.sqrt data class Statistics(val mean: Double, val variance: Double, val SD: Double) fun Iterable<Number>.statistics() = this.asSequence().statistics() fun Sequence<Number>.statistics() : Statistics { var sum = 0.0 var sumOfSquares = 0.0 ...
0
Kotlin
1
8
6c76a9a18e2caafc1ff00ab970d0df4d703f0119
1,353
ProbabilisticABM
MIT License