path
stringlengths
5
169
owner
stringlengths
2
34
repo_id
int64
1.49M
755M
is_fork
bool
2 classes
languages_distribution
stringlengths
16
1.68k
content
stringlengths
446
72k
issues
float64
0
1.84k
main_language
stringclasses
37 values
forks
int64
0
5.77k
stars
int64
0
46.8k
commit_sha
stringlengths
40
40
size
int64
446
72.6k
name
stringlengths
2
64
license
stringclasses
15 values
src/main/kotlin/com/appdecay/kotlin/libenigma/utils/Alphanumeric.kt
appdecay
58,949,336
false
null
package com.appdecay.kotlin.libenigma.utils import java.util.* fun Collection<Pair<Char, Char>>.clean(): Collection<Pair<Char, Char>> = this.map { p -> if ((p.second).toInt() < (p.first).toInt()) Pair(p.second, p.first) else p }.sortedBy { it.first }.groupBy { it.first }.map { it.value.last() } fun Collectio...
0
Kotlin
0
0
e84d487ec0b7f9c04613f09e5f336b5837372fac
3,403
kotlin-geheim
Apache License 2.0
year2023/day08/wasteland/src/main/kotlin/com/curtislb/adventofcode/year2023/day08/wasteland/WastelandNetwork.kt
curtislb
226,797,689
false
{"Kotlin": 2146738}
package com.curtislb.adventofcode.year2023.day08.wasteland import com.curtislb.adventofcode.common.io.forEachSection import java.io.File /** * A network of nodes and a list of instructions for navigating through the haunted wasteland. * * @property instructions A list of instructions that must be followed in order...
0
Kotlin
1
1
6b64c9eb181fab97bc518ac78e14cd586d64499e
3,949
AdventOfCode
MIT License
lib/src/main/kotlin/utils/Vec2l.kt
madisp
434,510,913
false
{"Kotlin": 388138}
package utils import kotlin.math.abs data class Vec2l(val x: Long, val y: Long) { val adjacent get() = listOf( copy(x = x - 1), copy(x = x + 1), copy(y = y - 1), copy(y = y + 1) ) val surrounding get() = grow().filter { (x, y) -> x != this.x || y != this.y } fun grow(amount: Long = 1) = (x -...
0
Kotlin
0
1
3f106415eeded3abd0fb60bed64fb77b4ab87d76
2,448
aoc_kotlin
MIT License
app/src/main/kotlin/advent_of_code/year_2022/day4/CampCleanup.kt
mavomo
574,441,138
false
{"Kotlin": 56468}
package advent_of_code.year_2022.day4 class CampCleanup { fun countTotalFullyOverlapingSections(puzzle: List<String>): Int { var totalOverlappingSectors = 0 puzzle.forEach { val commonSector = getCommonAssignedSections(it) if (commonSector.second) { totalOve...
0
Kotlin
0
0
b7fec100ea3ac63f48046852617f7f65e9136112
2,315
advent-of-code
MIT License
src/main/kotlin/year2022/day22/CubeWalker3D.kt
Ddxcv98
573,823,241
false
{"Kotlin": 154634}
package year2022.day22 import util.intSqrt import util.rotatedCounterClockwise class CubeWalker3D( private val transitions: Array<Array<Pair<Int, Int>>>, matrix: Array<Array<Char>> ) : CubeWalker<Pos3D> { private val n: Int = intSqrt(matrix.sumOf { chars -> chars.count { c -> c != ' ' } } / 6) private...
0
Kotlin
0
0
455bc8a69527c6c2f20362945b73bdee496ace41
1,963
advent-of-code
The Unlicense
src/questions/BinaryStringWithSubstringsRep1ToN.kt
realpacific
234,499,820
false
null
package questions import _utils.UseCommentAsDocumentation import utils.shouldBe /** * Given a binary string s and a positive integer n, return true if the binary representation of all the integers * in the range [1, n] are substrings of s, or false otherwise. * A substring is a contiguous sequence of characters wi...
4
Kotlin
5
93
22eef528ef1bea9b9831178b64ff2f5b1f61a51f
1,625
algorithms
MIT License
src/test/kotlin/com/xy/algorithm/Complexity.kt
monkey1992
413,857,863
false
null
package com.xy.algorithm import org.junit.Test import kotlin.math.pow import kotlin.math.sqrt /** * 算法复杂度 */ class Complexity { /** * 算法复杂度示例-O(n²) */ @Test fun complexityNSquare() { val n = 10 val array = arrayOfNulls<IntArray>(n) for (i in 0 until n) { va...
0
Kotlin
0
0
5d955911ecba67d7f38d87692505d77e7e894929
4,450
XyAlgorithm
Apache License 2.0
src/main/kotlin/days/Day12.kt
hughjdavey
317,575,435
false
null
package days import Coord2 import Direction class Day12 : Day(12) { private val instructions = inputList.map { Instruction(it.first(), it.drop(1).toInt()) } // 1007 override fun partOne(): Any { return Ship(false).followInstructions(instructions).position.manhattan() } // 41212 over...
0
Kotlin
0
1
63c677854083fcce2d7cb30ed012d6acf38f3169
2,596
aoc-2020
Creative Commons Zero v1.0 Universal
src/Main.kt
mhdanas97
157,410,315
false
null
import java.util.* import kotlin.Comparator fun main(args: Array<String>) { val operatorComparator: Comparator<Operator> = kotlin.Comparator { o1: Operator, o2: Operator -> (if (o1.visited) o1.cost else o1.cost + o1.andNodes.sumBy { it.heuristic }) -(if (o2.visited) o2.cost else o2.cost + o2.andNod...
0
Kotlin
0
0
2de961e04e1c247a1f549099af3b218d6c5ddeb1
2,722
AOStar
The Unlicense
src/main/kotlin/dev/shtanko/algorithms/leetcode/TargetSum.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
4,439
the-algorithms
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/HammingWeight.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,126
kotlab
Apache License 2.0
src/main/kotlin/g1301_1400/s1307_verbal_arithmetic_puzzle/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g1301_1400.s1307_verbal_arithmetic_puzzle // #Hard #Array #String #Math #Backtracking // #2023_06_05_Time_164_ms_(100.00%)_Space_37.8_MB_(100.00%) class Solution { private lateinit var map: IntArray private lateinit var grid: Array<CharArray> private var solved = false private lateinit var use...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
3,666
LeetCode-in-Kotlin
MIT License
src/main/java/org/chalup/parser/Parser.kt
chalup
226,190,276
false
null
package org.chalup.parser import org.chalup.parser.Json.JsonBool import org.chalup.parser.Json.JsonInt import org.chalup.parser.Json.JsonNull import org.chalup.parser.LeBoolean.LeFalse import org.chalup.parser.LeBoolean.LeOr import org.chalup.parser.LeBoolean.LeTrue import org.chalup.parser.LoopStep.Done import org.ch...
0
Kotlin
0
0
ab208872827fa9de3f4f734c93a4ba37ccae7936
22,081
elmish-kt-parser
Apache License 2.0
pulsar-skeleton/src/test/kotlin/ai/platon/pulsar/crawl/common/TestPrefixStringMatcher.kt
platonai
124,882,400
false
null
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may...
1
HTML
32
110
f93bccf5075009dc7766442d3a23b5268c721f54
3,806
pulsar
GNU Affero General Public License v3.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/ReverseParentheses.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,581
kotlab
Apache License 2.0
src/main/kotlin/problems/MaxProdSubArray.kt
amartya-maveriq
510,824,460
false
{"Kotlin": 42296}
package problems import java.lang.Integer.max /** * Leetcode : Medium * https://leetcode.com/problems/maximum-product-subarray/ * Given an integer array nums, find a contiguous non-empty subarray within the array that has the largest product, and return the product. The test cases are generated so that the answer...
0
Kotlin
0
0
2f12e7d7510516de9fbab866a59f7d00e603188b
1,255
data-structures
MIT License
src/main/kotlin/com/ginsberg/advent2017/Day21.kt
tginsberg
112,672,087
false
null
/* * Copyright (c) 2017 by <NAME> */ package com.ginsberg.advent2017 import com.ginsberg.advent2017.grid.FractalGrid import com.ginsberg.advent2017.grid.join /** * AoC 2017, Day 21 * * Problem Description: http://adventofcode.com/2017/day/21 * Blog Post/Commentary: https://todd.ginsberg.com/post/advent-of-code...
0
Kotlin
0
15
a57219e75ff9412292319b71827b35023f709036
1,311
advent-2017-kotlin
MIT License
src/Day14.kt
acrab
573,191,416
false
{"Kotlin": 52968}
import com.google.common.truth.Truth.assertThat import java.lang.Integer.max import java.lang.Integer.min enum class GridSpace { Rock, Air, Sand } fun rangeBetween(start: Int, end: Int) = min(start, end)..max(start, end) fun main() { fun List<MutableList<GridSpace>>.printMap(width: Int) { println(joinTo...
0
Kotlin
0
0
0be1409ceea72963f596e702327c5a875aca305c
5,652
aoc-2022
Apache License 2.0
src/org/aoc2021/Day10.kt
jsgroth
439,763,933
false
{"Kotlin": 86732}
package org.aoc2021 import java.nio.file.Files import java.nio.file.Path object Day10 { private val values = mapOf( ')' to 3, ']' to 57, '}' to 1197, '>' to 25137, ) private fun solvePart1(lines: List<String>): Int { return lines.sumOf { line -> doLine(...
0
Kotlin
0
0
ba81fadf2a8106fae3e16ed825cc25bbb7a95409
2,137
advent-of-code-2021
The Unlicense
src/main/kotlin/year2022/day22/Problem.kt
Ddxcv98
573,823,241
false
{"Kotlin": 154634}
package year2022.day22 import IProblem import java.io.BufferedReader class Problem(transitions: Array<Array<Pair<Int, Int>>>) : IProblem { private val matrix: Array<Array<Char>> private val moves = mutableListOf<(Pair<Int, Char>)>() private val cw2D: CubeWalker2D private val cw3D: CubeWalker3D in...
0
Kotlin
0
0
455bc8a69527c6c2f20362945b73bdee496ace41
2,263
advent-of-code
The Unlicense
src/Day06.kt
kerchen
573,125,453
false
{"Kotlin": 137233}
import java.util.* import kotlin.collections.ArrayDeque fun main() { fun findUniqueWindow(input: String, windowSize: Int): Int { var window: ArrayDeque<Char> = ArrayDeque(windowSize) var index = 0 for (c in input) { index += 1 window.addFirst(c) if (windo...
0
Kotlin
0
0
dc15640ff29ec5f9dceb4046adaf860af892c1a9
1,266
AdventOfCode2022
Apache License 2.0
src/main/kotlin/exercises/findpivotindex/FindPivotIndex.kt
amykv
538,632,477
false
{"Kotlin": 169929}
package exercises.findpivotindex /* Given an array of integers nums, calculate the pivot index of this array. The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum of all the numbers strictly to the index's right. If the index is on the left edge of the a...
0
Kotlin
0
2
93365cddc95a2f5c8f2c136e5c18b438b38d915f
1,302
dsa-kotlin
MIT License
src/main/kotlin/g0501_0600/s0572_subtree_of_another_tree/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g0501_0600.s0572_subtree_of_another_tree // #Easy #Depth_First_Search #Tree #Binary_Tree #Hash_Function #String_Matching // #Algorithm_II_Day_7_Breadth_First_Search_Depth_First_Search // #2023_01_23_Time_214_ms_(92.39%)_Space_38.4_MB_(45.65%) import com_github_leetcode.TreeNode /* * Example: * var ti = Tre...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,317
LeetCode-in-Kotlin
MIT License
src/main/kotlin/biz/koziolek/adventofcode/coords2d.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 enum class Direction(val char: Char) { NORTH('^'), SOUTH('v'), WEST('<'), EAST('>'), } data class Coord(val x: Int, val y: Int) { operator fun plus(other: Coord) = Coord(x + other.x, y + other....
0
Kotlin
0
0
1b1c6971bf45b89fd76bbcc503444d0d86617e95
9,140
advent-of-code
MIT License
src/Day03.kt
ezeferex
575,216,631
false
{"Kotlin": 6838}
object Constants { const val UPPER_CASE_PRIORITY = 38 const val LOWER_CASE_PRIORITY = 96 } fun Char.getPriority() = code - if (isLowerCase()) Constants.LOWER_CASE_PRIORITY else Constants.UPPER_CASE_PRIORITY fun main() { fun part1() = "Part 1: " + readInput("03").split("\n") .sumOf { ...
0
Kotlin
0
0
f06f8441ad0d7d4efb9ae449c9f7848a50f3f57c
934
advent-of-code-2022
Apache License 2.0
src/test/kotlin/ch/ranil/aoc/aoc2022/Day19.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 java.time.Duration import kotlin.test.Ignore import kotlin.test.assertEquals import kotlin.test.fail class Day19 : AbstractDay() { @Test fun part1Test() { assertEquals(33, compute1(testInput)) } ...
0
Kotlin
1
0
dbd25877071cbb015f8da161afb30cf1968249a8
11,766
aoc
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/NumberOfUniqueGoodSubsequences.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2022 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
4
Kotlin
0
19
776159de0b80f0bdc92a9d057c852b8b80147c11
1,203
kotlab
Apache License 2.0
src/main/kotlin/aoc01/solution.kt
dnene
317,653,484
false
null
package aoc01 import java.io.File fun <T> List<T>.combinations(r: Int, start: Int = 0): List<List<T>> = if (r <= size - start) { (start..size-start-r).flatMap { combinations(r-1, start+1) } } else listOf<List<T>>() fun <T> List<T>.combinationsOfTwo(): List<Pair<T, T>> = (0..s...
0
Kotlin
0
0
db0a2f8b484575fc3f02dc9617a433b1d3e900f1
1,184
aoc2020
MIT License
kotlin/src/main/kotlin/dev/mikeburgess/euler/problems/Problem033.kt
mddburgess
261,028,925
false
null
package dev.mikeburgess.euler.problems import dev.mikeburgess.euler.common.gcd /** * Problem 33 * * The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to * simplify it may incorrectly believe that 49/98 = 4/8, which is correct, is obtained by * cancelling the 9s. * * We s...
0
Kotlin
0
0
86518be1ac8bde25afcaf82ba5984b81589b7bc9
1,178
project-euler
MIT License
src/main/kotlin/com/zachjones/languageclassifier/core/Adaboost.kt
zachtjones
184,465,284
false
{"Kotlin": 73431}
package com.zachjones.languageclassifier.core import com.zachjones.languageclassifier.attribute.Attribute import com.zachjones.languageclassifier.entities.InputRow import com.zachjones.languageclassifier.entities.LanguageDecision import com.zachjones.languageclassifier.entities.MultiLanguageDecision import com.zachjon...
0
Kotlin
0
1
dfe8710fcf8daa1bc57ad90f7fa3c07a228b819f
5,246
Multi-Language-Classifier
Apache License 2.0
src/commonMain/kotlin/ai/hypergraph/kaliningraph/parsing/BarHillel.kt
breandan
245,074,037
false
{"Kotlin": 1482924, "Haskell": 744, "OCaml": 200}
package ai.hypergraph.kaliningraph.parsing import ai.hypergraph.kaliningraph.automata.* import ai.hypergraph.kaliningraph.types.* import ai.hypergraph.kaliningraph.types.times import kotlin.time.TimeSource /** * Specialized Bar-Hillel construction for Levenshtein automata. See also * [FSA.intersect] for the generic...
0
Kotlin
8
100
c755dc4858ed2c202c71e12b083ab0518d113714
8,732
galoisenne
Apache License 2.0
src/main/kotlin/com/kishor/kotlin/algo/algorithms/graph/MinKnightMoves.kt
kishorsutar
276,212,164
false
null
package com.kishor.kotlin.algo.algorithms.graph import java.util.HashSet import java.util.LinkedList import java.util.Queue import java.util.Deque import java.util.HashMap internal class MinKnightMoves { fun minKnightMoves(x: Int, y: Int): Int { var x = x var y = y x = Math.abs(x) ...
0
Kotlin
0
0
6672d7738b035202ece6f148fde05867f6d4d94c
3,848
DS_Algo_Kotlin
MIT License
lib/src/main/kotlin/aoc/day10/Day10.kt
Denaun
636,769,784
false
null
package aoc.day10 fun part1(input: String): Int = execute(parse(input)) .withIndex() .drop(20) .windowed(1, 40) .sumOf { (x) -> x.value * x.index } fun part2(input: String): String = execute(parse(input)).draw() fun execute(instructions: List<Instruction>): Sequence<Int> = sequence { var x = 1 ...
0
Kotlin
0
0
560f6e33f8ca46e631879297fadc0bc884ac5620
1,064
aoc-2022
Apache License 2.0
kotlin/0673-number-of-longest-increasing-subsequence.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}
/* * DFS + memoization solution */ class Solution { fun findNumberOfLIS(nums: IntArray): Int { val memo = HashMap<Int, Pair<Int, Int>>() var lisLen = 0 var lisCount = 0 fun dfs(i: Int): Pair<Int, Int> { if (i in memo) return memo[i]!! var m...
337
JavaScript
2,004
4,367
0cf38f0d05cd76f9e96f08da22e063353af86224
2,244
leetcode
MIT License
day17/Kotlin/day17.kt
Ad0lphus
353,610,043
false
{"C++": 195638, "Python": 139359, "Kotlin": 80248}
import java.io.* fun print_day_17() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 17" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Trick Shot -c -f small") val r...
0
C++
0
0
02f219ea278d85c7799d739294c664aa5a47719a
2,039
AOC2021
Apache License 2.0
src/main/kotlin/tr/emreone/adventofcode/days/Day5.kt
EmRe-One
434,793,519
false
{"Kotlin": 44202}
package tr.emreone.adventofcode.days object Day5 { fun part1(input: List<String>): Int { return input.count { line -> val condition1 = line.count { arrayOf('a', 'e', 'i', 'o', 'u').contains(it) } >= 3 val condition2 = line.windowed(2).count { ...
0
Kotlin
0
0
57f6dea222f4f3e97b697b3b0c7af58f01fc4f53
1,014
advent-of-code-2015
Apache License 2.0
src/main/kotlin/year2023/day14/Problem.kt
Ddxcv98
573,823,241
false
{"Kotlin": 154634}
package year2023.day14 import IProblem class Problem : IProblem { private val lines = javaClass .getResourceAsStream("/2023/14.txt")!! .bufferedReader() .lines() .toList() private fun north(matrix: Array<CharArray>) { for (j in matrix[0].indices) { var idx ...
0
Kotlin
0
0
455bc8a69527c6c2f20362945b73bdee496ace41
2,968
advent-of-code
The Unlicense
src/main/kotlin/algorithms/NumberGuessingGame.kt
AgentKnopf
240,955,745
false
null
package algorithms /** * I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wrong, I'll tell you whether the number is higher or lower. * You call a pre-defined API guess(int num) which returns 3 possible results (-1, 1, or 0): */ internal data class NumberGuessingGame(val lu...
0
Kotlin
1
0
5367ce67e54633e53b2b951c2534bf7b2315c2d8
1,595
technical-interview
MIT License
kotlin/src/com/daily/algothrim/leetcode/MoveZeroes.kt
idisfkj
291,855,545
false
null
package com.daily.algothrim.leetcode /** * 283. 移动零 * * 给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。 * * 示例: * * 输入: [0,1,0,3,12] * 输出: [1,3,12,0,0] * 说明: * * 必须在原数组上操作,不能拷贝额外的数组。 * 尽量减少操作次数。 * */ class MoveZeroes { companion object { @JvmStatic fun main(args: Array<String>) { ...
0
Kotlin
9
59
9de2b21d3bcd41cd03f0f7dd19136db93824a0fa
1,720
daily_algorithm
Apache License 2.0
src/main/kotlin/co/csadev/hannukah5783/Day01.kt
gtcompscientist
577,439,489
false
{"Kotlin": 252918}
/** * Copyright (c) 2022 by <NAME> * Advent of Code 2022, Day 20 * Problem Description: http://adventofcode.com/2021/day/20 */ package co.csadev.hannukah5783 import co.csadev.adventOfCode.BaseDay import co.csadev.adventOfCode.Resources import co.csadev.hannukah5783.Day01.PhoneChars.Companion.toDigit class Day01(o...
0
Kotlin
0
1
43cbaac4e8b0a53e8aaae0f67dfc4395080e1383
1,510
advent-of-kotlin
Apache License 2.0
src/main/kotlin/endredeak/aoc2022/Day13.kt
edeak
571,891,076
false
{"Kotlin": 44975}
package endredeak.aoc2022 import com.google.gson.Gson fun main() { solve("Distress Signal") { fun String.toList(): List<*> = Gson().fromJson(this, List::class.java) fun List<*>.compareTo(other: List<*>): Int { if (this.isEmpty() && other.isNotEmpty()) return -1 else if (th...
0
Kotlin
0
0
e0b95e35c98b15d2b479b28f8548d8c8ac457e3a
1,523
AdventOfCode2022
Do What The F*ck You Want To Public License
src/main/kotlin/day25.kt
gautemo
572,204,209
false
{"Kotlin": 78294}
import shared.getText import kotlin.math.pow fun main() { val input = getText("day25.txt") println(day25A(input)) } fun day25A(input: String): String { val decimalSum = input.lines().map { line -> line.snafuToLong() }.reduce { acc, number -> acc + number } var fiveNumeral = decimalSum.toSt...
0
Kotlin
0
0
bce9feec3923a1bac1843a6e34598c7b81679726
1,430
AdventOfCode2022
MIT License
aoc-2017/src/main/kotlin/nl/jstege/adventofcode/aoc2017/days/Day16.kt
JStege1206
92,714,900
false
null
package nl.jstege.adventofcode.aoc2017.days import nl.jstege.adventofcode.aoccommon.days.Day import nl.jstege.adventofcode.aoccommon.utils.extensions.head import nl.jstege.adventofcode.aoccommon.utils.extensions.swap /** * * @author <NAME> */ class Day16 : Day(title = "Permutation Promenade") { private compani...
0
Kotlin
0
0
d48f7f98c4c5c59e2a2dfff42a68ac2a78b1e025
2,686
AdventOfCode
MIT License
src/main/kotlin/g2201_2300/s2258_escape_the_spreading_fire/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g2201_2300.s2258_escape_the_spreading_fire // #Hard #Array #Breadth_First_Search #Binary_Search #Matrix // #2023_06_28_Time_304_ms_(100.00%)_Space_38.5_MB_(100.00%) @Suppress("NAME_SHADOWING") class Solution { private fun setFire(grid: Array<IntArray>, dir: Array<IntArray>): Array<IntArray> { val ...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
3,265
LeetCode-in-Kotlin
MIT License
src/org/aoc2021/Day3.kt
jsgroth
439,763,933
false
{"Kotlin": 86732}
package org.aoc2021 import java.nio.file.Files import java.nio.file.Path object Day3 { private fun solvePart1(filename: String): Int { val lines = Files.readAllLines(Path.of(filename), Charsets.UTF_8) val numBits = lines[0].length val oneCounts = Array(numBits) { 0 } lines.forEach...
0
Kotlin
0
0
ba81fadf2a8106fae3e16ed825cc25bbb7a95409
2,008
advent-of-code-2021
The Unlicense
src/main/kotlin/github/walkmansit/aoc2020/Day08.kt
walkmansit
317,479,715
false
null
package github.walkmansit.aoc2020 class Day08(val input: List<String>) : DayAoc<Int, Int> { private class SequenceOfAction(val lines: List<String>) { sealed class Action { abstract fun apply(acc: Int, position: Int): Pair<Int, Int> abstract fun hasAlternative(): Boolean ...
0
Kotlin
0
0
9c005ac4513119ebb6527c01b8f56ec8fd01c9ae
4,390
AdventOfCode2020
MIT License
src/Day01.kt
devLeitner
572,272,654
false
{"Kotlin": 6301}
fun main() { fun part1(input: List<String>): Int { return input.size } fun part2(input: List<String>): Int { return input.size } val elves = arrayListOf<Elf>() val input = readInput("resources/day1source") var elf: Elf = Elf(0) input.forEach{ if(it.isBlank())...
0
Kotlin
0
0
72b9d184fc58f790b393260fc6b1a0ed24028059
772
AOC_2022
Apache License 2.0
src/main/kotlin/utils/Model.kt
Kebaan
573,069,009
false
null
package utils import kotlin.math.abs import kotlin.math.max sealed interface GameResult { object Win : GameResult object Lose : GameResult object Draw : GameResult } data class Point(val x: Int, val y: Int) { operator fun plus(other: Point) = Point(x + other.x, y + other.y) operator fun minus(oth...
0
Kotlin
0
0
ef8bba36fedbcc93698f3335fbb5a69074b40da2
1,738
Advent-of-Code-2022
Apache License 2.0
app/src/main/java/com/themobilecoder/adventofcode/day7/DaySevenUtils.kt
themobilecoder
726,690,255
false
{"Kotlin": 323477}
package com.themobilecoder.adventofcode.day7 import com.themobilecoder.adventofcode.splitByNewLine fun String.convertToHandBids(): List<HandBid> { return splitByNewLine().map { val line = it.split(" ") val hand = line[0] val bid = line[1].toInt() HandBid( hand = hand, ...
0
Kotlin
0
0
b7770e1f912f52d7a6b0d13871f934096cf8e1aa
2,992
Advent-of-Code-2023
MIT License
src/main/kotlin/g1801_1900/s1862_sum_of_floored_pairs/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g1801_1900.s1862_sum_of_floored_pairs // #Hard #Array #Math #Binary_Search #Prefix_Sum // #2023_06_22_Time_710_ms_(100.00%)_Space_54.1_MB_(100.00%) class Solution { fun sumOfFlooredPairs(nums: IntArray): Int { val mod: Long = 1000000007 nums.sort() val max = nums[nums.size - 1] ...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
949
LeetCode-in-Kotlin
MIT License
bench/algorithm/pidigits/1n.kt
yonillasky
509,064,681
true
{"C#": 202607, "Rust": 189880, "Common Lisp": 142537, "C": 54246, "Java": 48247, "Go": 47792, "Python": 43609, "Zig": 43144, "Kotlin": 42064, "Julia": 36071, "Dart": 35399, "TypeScript": 35277, "Crystal": 33440, "C++": 33006, "OCaml": 31954, "Chapel": 30434, "JavaScript": 26877, "Nim": 26351, "Vue": 24386, "V": 22794, ...
/* The Computer Language Benchmarks Game https://salsa.debian.org/benchmarksgame-team/benchmarksgame/ Based on Java version (1) by <NAME> Contributed by <NAME> Modified by hanabi1224 */ import com.ionspin.kotlin.bignum.integer.* fun main(args: Array<String>) { val L = 10 var n = args[0].toI...
0
C#
0
0
f72b031708c92f9814b8427b0dd08cb058aa6234
2,978
Programming-Language-Benchmarks-bp
MIT License
src/main/kotlin/moe/kadosawa/aoc/day3/Main.kt
httpolar
435,526,631
false
null
package moe.kadosawa.aoc.day3 import moe.kadosawa.aoc.Solution import moe.kadosawa.aoc.input class Main : Solution { private val input = input("input3.txt")!!.readLines() private val normalInput = MutableList(input.first().length) { MutableList<Char?>(input.size) { null } } init { input.forEachIn...
0
Kotlin
0
1
540ced34eb89a7bf5bb5535c7507e51eaac3f72e
2,753
Advent-of-Code
The Unlicense
src/questions/AddBinary.kt
realpacific
234,499,820
false
null
package questions import _utils.UseCommentAsDocumentation import utils.shouldBe /** * Given two binary strings a and b, return their sum as a binary string. * [Source](https://leetcode.com/problems/add-binary/) */ @UseCommentAsDocumentation private fun addBinary(a: String, b: String): String { val size = maxOf...
4
Kotlin
5
93
22eef528ef1bea9b9831178b64ff2f5b1f61a51f
1,726
algorithms
MIT License
year2018/src/main/kotlin/net/olegg/aoc/year2018/day13/Day13.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2018.day13 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.D import net.olegg.aoc.utils.Directions.L import net.olegg.aoc.uti...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
4,464
adventofcode
MIT License
advent-of-code-2021/src/code/day12/Main.kt
Conor-Moran
288,265,415
false
{"Kotlin": 53347, "Java": 14161, "JavaScript": 10111, "Python": 6625, "HTML": 733}
package code.day12 import code.common.isLowercase import java.io.File fun main() { doIt("Day 12 Part 1: Test Input", "src/code/day12/test.input", part1) doIt("Day 12 Part 1: Real Input", "src/code/day12/part1.input", part1) doIt("Day 12 Part 2: Test Input", "src/code/day12/test.input", part2); doIt("D...
0
Kotlin
0
0
ec8bcc6257a171afb2ff3a732704b3e7768483be
3,743
misc-dev
MIT License
src/main/kotlin/Intersection.kt
ishmeister
195,967,617
false
null
package com.kotrt import java.util.* import kotlin.math.pow import kotlin.math.sqrt data class Intersection(val t: Double, val shape: Shape) : Comparable<Intersection> { override fun compareTo(other: Intersection) = when { t < other.t -> -1 t > other.t -> 1 else -> 0 } private fun...
0
Kotlin
0
0
e6fdc23aad7fce73712030864c438a51961fab3e
3,192
raytracer-kotlin
MIT License
src/Day01.kt
annagergaly
572,917,403
false
{"Kotlin": 6388}
fun main() { fun part1(input: List<String>): Int { val sums = mutableListOf<Int>() var sum = 0 for (line in input) { if (line.isBlank()) { sums.add(sum) sum = 0 } else { sum += line.toInt() } } ...
0
Kotlin
0
0
89b71c93e341ca29ddac40e83f522e5449865b2d
797
advent-of-code22
Apache License 2.0
src/main/kotlin/org/sjoblomj/adventofcode/day4/Shift.kt
sjoblomj
161,537,410
false
null
package org.sjoblomj.adventofcode.day4 import java.time.LocalDate private val idRegex = ".* Guard #(?<num>[0-9]+) begins shift".toRegex() private val fallAsleepRegex = "\\[.* 00:(?<num>[0-9]{2})] falls asleep".toRegex() private val wakeUpRegex = "\\[.* 00:(?<num>[0-9]{2})] wakes up".toRegex() private val ...
0
Kotlin
0
0
80db7e7029dace244a05f7e6327accb212d369cc
2,924
adventofcode2018
MIT License
src/main/kotlin/com/hj/leetcode/kotlin/problem645/Solution.kt
hj-core
534,054,064
false
{"Kotlin": 619841}
package com.hj.leetcode.kotlin.problem645 /** * LeetCode page: [645. Set Mismatch](https://leetcode.com/problems/set-mismatch/); */ class Solution { /* Complexity: * Time O(N) and Space O(1) where N is the size of nums; */ fun findErrorNums(nums: IntArray): IntArray { val (a, b) = errorsUno...
1
Kotlin
0
1
14c033f2bf43d1c4148633a222c133d76986029c
1,120
hj-leetcode-kotlin
Apache License 2.0
src/iii_conventions/MyDate.kt
shivan42
58,006,522
false
null
package iii_conventions import java.time.temporal.TemporalAmount data class MyDate(val year: Int, val month: Int, val dayOfMonth: Int) : Comparable<MyDate> { override fun compareTo(other: MyDate) = when { year != other.year -> year - other.year month != other.month -> month - other.month e...
0
Kotlin
1
1
f833f96bad3fba07f74e29ea0ed85f7d53fbf7eb
1,891
kotlin-koans-solution
MIT License
app/src/main/kotlin/io/github/andrewfitzy/day01/Task01.kt
andrewfitzy
747,793,365
false
{"Kotlin": 60159, "Shell": 1211}
package io.github.andrewfitzy.day01 import io.github.andrewfitzy.util.Point class Task01(puzzleInput: List<String>) { private val input: List<String> = puzzleInput private val rotationMapping: Map<Pair<String, String>, String> = mapOf( Pair("N", "R") to "E", Pair("N", "L") to ...
0
Kotlin
0
0
15ac072a14b83666da095b9ed66da2fd912f5e65
1,409
2016-advent-of-code
Creative Commons Zero v1.0 Universal
src/main/java/me/olegthelilfix/leetcoding/old/LongestPalindrome.kt
olegthelilfix
300,408,727
false
null
package me.olegthelilfix.leetcoding.old //Given a string s, return the longest palindromic substring in s. fun isPalindrome(s: String): Boolean { if (s.isEmpty()) { return false } for (i in 0 .. s.length/2) { if(s[i] != s[s.length-i-1]) { return false } } retur...
0
Kotlin
0
0
bf17d2f6915b7a491d93f57f8e7461adda7029c0
1,999
MyKata
MIT License
src/main/kotlin/kt/kotlinalgs/app/kickstart/RecordBreaker.ws.kts
sjaindl
384,471,324
false
null
/* https://codingcompetitions.withgoogle.com/kickstart/round/00000000008f49d7/0000000000bcf2ed Isyana is given the number of visitors at her local theme park on N consecutive days. The number of visitors on the i-th day is Vi. A day is record breaking if it satisfies both of the following conditions: Either it is the...
0
Java
0
0
e7ae2fcd1ce8dffabecfedb893cb04ccd9bf8ba0
3,077
KotlinAlgs
MIT License
src/day14/Code.kt
ldickmanns
572,675,185
false
{"Kotlin": 48227}
package day14 import day09.Coordinates import readInput // x -> distance to right // y -> distance down // Sand falls (at each step) // - down, if not possible // - down-left, if not possible // - down-right, if not possible // - comes to a rest typealias RockStroke = List<Coordinates> val startingPoint = C...
0
Kotlin
0
0
2654ca36ee6e5442a4235868db8174a2b0ac2523
5,359
aoc-kotlin-2022
Apache License 2.0
src/main/java/com/booknara/problem/search/binary/MaximumAverageSubarrayIIKt.kt
booknara
226,968,158
false
{"Java": 1128390, "Kotlin": 177761}
package com.booknara.problem.search.binary /** * 644. Maximum Average Subarray II (Hard) * https://leetcode.com/problems/maximum-average-subarray-ii/ */ class MaximumAverageSubarrayIIKt { // T:O(n*log((max - min) / 0.00001), S:O(n) fun findMaxAverage(nums: IntArray, k: Int): Double { var l = -10001.0 va...
0
Java
1
1
04dcf500ee9789cf10c488a25647f25359b37a53
997
playground
MIT License
src/main/kotlin/com/hj/leetcode/kotlin/problem452/Solution.kt
hj-core
534,054,064
false
{"Kotlin": 619841}
package com.hj.leetcode.kotlin.problem452 /** * LeetCode page: [452. Minimum Number of Arrows to Burst Balloons](https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/); */ class Solution { /* Complexity: * Time O(NLogN) and Space O(N) where N is the size of points; */ fun findMi...
1
Kotlin
0
1
14c033f2bf43d1c4148633a222c133d76986029c
867
hj-leetcode-kotlin
Apache License 2.0
src/main/kotlin/me/peckb/aoc/_2021/calendar/day15/Day15.kt
peckb1
433,943,215
false
{"Kotlin": 956135}
package me.peckb.aoc._2021.calendar.day15 import me.peckb.aoc.generators.InputGenerator.InputGeneratorFactory import java.util.PriorityQueue import javax.inject.Inject import kotlin.Float.Companion.POSITIVE_INFINITY class Day15 @Inject constructor(private val generatorFactory: InputGeneratorFactory) { fun smallPath...
0
Kotlin
1
3
2625719b657eb22c83af95abfb25eb275dbfee6a
2,894
advent-of-code
MIT License
src/aoc2022/Day17_2_.kt
RobertMaged
573,140,924
false
{"Kotlin": 225650}
package aoc2022 import utils.Vertex import utils.checkEquals import utils.sendAnswer /* #### the - shape falls first, sixth, 11th, 16th, etc. .#. ### .#. ..# ..# ### # # # # ## ## */ private const val ROCK = 1 private const val AIR = 0 private const val REST = -1 private const val LEFT = -1 private const val...
0
Kotlin
0
0
e2e012d6760a37cb90d2435e8059789941e038a5
1,989
Kotlin-AOC-2023
Apache License 2.0
The_Skyline_Problem.kt
xiekch
166,329,519
false
{"C++": 165148, "Java": 103273, "Kotlin": 97031, "Go": 40017, "Python": 22302, "TypeScript": 17514, "Swift": 6748, "Rust": 6579, "JavaScript": 4244, "Makefile": 349}
import java.util.* import kotlin.collections.ArrayList //https://leetcode.com/problems/the-skyline-problem/discuss/61193/Short-Java-solution class Solution { fun getSkyline(buildings: Array<IntArray>): List<List<Int>> { val res = ArrayList<ArrayList<Int>>() val height = ArrayList<ArrayList<Int>>() ...
0
C++
0
0
eb5b6814e8ba0847f0b36aec9ab63bcf1bbbc134
1,636
leetcode
MIT License
day12/Part1.kt
anthaas
317,622,929
false
null
import java.io.File import kotlin.math.abs fun main(args: Array<String>) { val input = File("input.txt").readLines().map { Pair(it[0], it.substring(1).toInt()) } var faceOfTheShip = 'E' var northDistanceFromStart = 0 var eastDistanceFromStart = 0 for (entry in input) { val (instruction, va...
0
Kotlin
0
0
aba452e0f6dd207e34d17b29e2c91ee21c1f3e41
2,074
Advent-of-Code-2020
MIT License
src/main/kotlin/com/frankandrobot/rapier/nlp/RuleMetric.kt
frankandrobot
62,833,944
false
null
/* * Copyright 2016 <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 ...
1
Kotlin
1
1
ddbc0dab60ca595e63a701e2f8cd6694ff009adc
2,745
rapier
Apache License 2.0
dsalgo/src/commonTest/kotlin/com/nalin/datastructurealgorithm/problem/FB_problem_test.kt
nalinchhajer1
534,780,196
false
{"Kotlin": 86359, "Ruby": 1605}
package com.nalin.datastructurealgorithm.problem import com.nalin.datastructurealgorithm.ds.toArray import com.nalin.datastructurealgorithm.problems.* import kotlin.test.Test import kotlin.test.assertEquals class FB_problem_test { @Test fun check_findMinimum_shiftedSortedArray() { assertEquals(findMi...
0
Kotlin
0
0
eca60301dab981d0139788f61149d091c2c557fd
4,323
kotlin-ds-algo
MIT License
src/day12/Point.kt
g0dzill3r
576,012,003
false
{"Kotlin": 172121}
package day12 data class Point (val x: Int = 0, val y: Int = 0) { fun distance (other: Point): Int = Math.abs (x - other.x) + Math.abs (y - other.y) fun move (direction: Direction) = Point (x + direction.dx, y + direction.dy) fun delta (other: Point): Pair<Int, Int> = Pair (other.x - x, other.y - y) ...
0
Kotlin
0
0
6ec11a5120e4eb180ab6aff3463a2563400cc0c3
1,347
advent_of_code_2022
Apache License 2.0
src/main/kotlin/ctci/chapterfour/MinimalTree.kt
amykv
538,632,477
false
{"Kotlin": 169929}
package ctci.chapterfour // 4.2 - page 109 // Given a sorted (increasing order) array with unique integer elements, write an algorithm in Kotlin to create a binary // search tree with minimal height. fun main() { val arr = intArrayOf(1, 2, 3, 4, 5, 6, 7, 8, 9) val root = createMinimalBST(arr, 0, arr.size - 1...
0
Kotlin
0
2
93365cddc95a2f5c8f2c136e5c18b438b38d915f
2,032
dsa-kotlin
MIT License
src/main/kotlin/com/hopkins/aoc/day16/main.kt
edenrox
726,934,488
false
{"Kotlin": 88215}
package com.hopkins.aoc.day16 import java.io.File import java.lang.IllegalStateException const val debug = false const val part = 2 // A history of the Beam's we've seen in the past. We use this to avoid following // cycles val history = mutableSetOf<Beam>() /** Advent of Code 2023: Day 16 */ fun main() { // R...
0
Kotlin
0
0
45dce3d76bf3bf140d7336c4767e74971e827c35
5,545
aoc2023
MIT License
src/main/kotlin/g2101_2200/s2172_maximum_and_sum_of_array/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g2101_2200.s2172_maximum_and_sum_of_array // #Hard #Array #Dynamic_Programming #Bit_Manipulation #Bitmask // #2023_06_26_Time_165_ms_(100.00%)_Space_34.8_MB_(100.00%) class Solution { fun maximumANDSum(nums: IntArray, numSlots: Int): Int { val mask = Math.pow(3.0, numSlots.toDouble()).toInt() - 1 ...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,026
LeetCode-in-Kotlin
MIT License
03-DataClassAndCollection/08-CollectionOperations.kt
ivantendou
739,307,014
false
{"Kotlin": 43124}
// 08 - Collections Operations // filter() and filterNot() val numberList = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) val evenList = numberList.filter { it % 2 == 0 } // evenList: [2, 4, 6, 8, 10] val numberList = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) val notEvenList = numberList.filterNot { it % 2 == 0 } // notEvenList: ...
0
Kotlin
0
0
3e189aab80fe598223fa17c41f23ac79948f8fe9
1,656
Kotlin-Dicoding
MIT License
colleges/fsu/src/main/kotlin/io/github/opletter/courseevals/fsu/DataProcessing.kt
opLetter
597,896,755
false
{"Kotlin": 390300}
package io.github.opletter.courseevals.fsu import io.github.opletter.courseevals.common.* import io.github.opletter.courseevals.common.data.* import java.nio.file.Path val campusMap = mapOf( "Tallahassee Main Campus" to "Main", "Florida State University" to "Main", "Sarasota Campus" to "Main", "Panama...
0
Kotlin
0
3
44077ad89388cead3944975e975840580d2c9d0b
6,044
course-evals
MIT License
src/main/kotlin/nl/tulipsolutions/mnemonic/wordlist/WordListMaps.kt
TulipSolutions
279,126,945
false
null
// Copyright 2020 Tulip Solutions B.V. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agr...
1
Kotlin
0
0
1a78849d243d2e2834eb2c80276863ed5746f6c8
2,574
bitcoin-tools
Apache License 2.0
cpg-core/src/main/java/de/fraunhofer/aisec/cpg/helpers/Benchmark.kt
yogical
425,824,120
true
{"Java": 1228692, "Kotlin": 897750, "LLVM": 170600, "Go": 83086, "Python": 53525, "C++": 43784, "C": 30139, "TypeScript": 4873, "JavaScript": 527, "CMake": 204}
/* * Copyright (c) 2019, Fraunhofer AISEC. 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 require...
0
Java
0
0
c4d136eef727cd4d1cf1e3691e83aa7b4623f6a8
5,239
cpg
Apache License 2.0
src/main/kotlin/09.kts
reitzig
318,492,753
false
null
import _09.Result.* import java.io.File sealed class Result { data class Wrong(val firstBadNumber: Long) : Result() object Okay : Result() } fun canSum(summands: List<Long>, number: Long): Boolean { for (i in summands.indices) { for (j in summands.indices) { if (i == j) continue ...
0
Kotlin
0
0
f17184fe55dfe06ac8897c2ecfe329a1efbf6a09
1,737
advent-of-code-2020
The Unlicense
compiler/testData/codegen/box/closures/closureCapturingGenericParam.kt
JetBrains
3,432,266
false
{"Kotlin": 74444760, "Java": 6669398, "Swift": 4261253, "C": 2620837, "C++": 1953730, "Objective-C": 640870, "Objective-C++": 170766, "JavaScript": 135724, "Python": 48402, "Shell": 30960, "TypeScript": 22754, "Lex": 18369, "Groovy": 17273, "Batchfile": 11693, "CSS": 11368, "Ruby": 10470, "EJS": 5241, "Dockerfile": 513...
interface IntConvertible { fun toInt(): Int } fun <FooTP> foo(init: Int, v: FooTP, l: Int.(FooTP) -> Int) = init.l(v) fun <BarTP : IntConvertible> computeSum(array: Array<BarTP>) = foo(0, array) { var res = this for (element in it) res += element.toInt() res } class N(val v: Int) : IntConvertible { ...
166
Kotlin
5,771
46,772
bef0946ab7e5acd5b24b971eca532c43c8eba750
1,104
kotlin
Apache License 2.0
src/main/kotlin/com/github/solairerove/algs4/leprosorium/linked_list/InsertIntoASortedCircularLinkedList.kt
solairerove
282,922,172
false
{"Kotlin": 251919}
package com.github.solairerove.algs4.leprosorium.linked_list /** * Given a Circular Linked List node, which is sorted in non-descending order, * write a function to insert a value insertVal into the list such that it remains a sorted circular list. * The given node can be a reference to any single node in the list ...
1
Kotlin
0
3
64c1acb0c0d54b031e4b2e539b3bc70710137578
1,977
algs4-leprosorium
MIT License
src/main/kotlin/d12/d12.kt
LaurentJeanpierre1
573,454,829
false
{"Kotlin": 118105}
package d12 import readInput import java.util.PriorityQueue data class Pos(val x: Int, val y: Int) { var prev: Pos? = null var length: Int = -1 constructor(x: Int, y: Int, prev: Pos?, length: Int) : this(x,y){ this.prev = prev this.length = length } } fun part1(input: List<String>): I...
0
Kotlin
0
0
5cf6b2142df6082ddd7d94f2dbde037f1fe0508f
3,799
aoc2022
Creative Commons Zero v1.0 Universal
hoon/HoonAlgorithm/src/main/kotlin/boj/week02/recursive_function/FibonacciSequence5.kt
boris920308
618,428,844
false
{"Kotlin": 137657, "Swift": 35553, "Java": 1947, "Rich Text Format": 407}
package boj.week02.recursive_function import java.util.* /** * * no.10870 * https://www.acmicpc.net/problem/10870 * * 피보나치 수는 0과 1로 시작한다. 0번째 피보나치 수는 0이고, 1번째 피보나치 수는 1이다. 그 다음 2번째 부터는 바로 앞 두 피보나치 수의 합이 된다. * 이를 식으로 써보면 Fn = Fn-1 + Fn-2 (n ≥ 2)가 된다. * n=17일때 까지 피보나치 수를 써보면 다음과 같다. * 0, 1, 1, 2, 3, 5, 8, 13, ...
1
Kotlin
1
2
88814681f7ded76e8aa0fa7b85fe472769e760b4
1,042
HoOne
Apache License 2.0
src/test/kotlin/com/igorwojda/integer/digitfrequency/Solution.kt
igorwojda
159,511,104
false
{"Kotlin": 254856}
package com.igorwojda.integer.digitfrequency // Time complexity: O(n) // Generate digit frequency map for each integer and compare them private object Solution1 { private fun equalDigitFrequency(i1: Int, i2: Int): Boolean { val i1Str = i1.toString() val i2Str = i2.toString() if (i1Str.leng...
9
Kotlin
225
895
b09b738846e9f30ad2e9716e4e1401e2724aeaec
1,370
kotlin-coding-challenges
MIT License
gcj/y2022/round2/a.kt
mikhail-dvorkin
93,438,157
false
{"Java": 2219540, "Kotlin": 615766, "Haskell": 393104, "Python": 103162, "Shell": 4295, "Batchfile": 408}
package gcj.y2022.round2 private fun solve(): String { val (n, k) = readInts() var x = 1 var w = n - 1 val ans = mutableListOf<String>() var toCut = n * n - 1 - k var where = 1 while (w > 0) { val y = x + 4 * w repeat(4) { i -> val from = x + i * w + 1 val to = y + i * (w - 2) val cut = to - from -...
0
Java
1
9
30953122834fcaee817fe21fb108a374946f8c7c
804
competitions
The Unlicense
app/src/test/java/com/terencepeh/leetcodepractice/GroupAnagrams.kt
tieren1
560,012,707
false
{"Kotlin": 26346}
package com.terencepeh.leetcodepractice // O(NKlogK) // O(NK) fun groupAnagrams(strs: Array<String>): List<List<String>> { if (strs.isEmpty()) { return emptyList() } val hashMap = hashMapOf<String, MutableList<String>>() for (s in strs) { val ca = s.toCharArray() ca.sort() ...
0
Kotlin
0
0
427fa2855c01fbc1e85a840d0be381cbb4eec858
1,302
LeetCodePractice
MIT License
kotlin/src/katas/kotlin/leetcode/longest_substring/LongestSubstring.kt
dkandalov
2,517,870
false
{"Roff": 9263219, "JavaScript": 1513061, "Kotlin": 836347, "Scala": 475843, "Java": 475579, "Groovy": 414833, "Haskell": 148306, "HTML": 112989, "Ruby": 87169, "Python": 35433, "Rust": 32693, "C": 31069, "Clojure": 23648, "Lua": 19599, "C#": 12576, "q": 11524, "Scheme": 10734, "CSS": 8639, "R": 7235, "Racket": 6875, "C...
package katas.kotlin.leetcode.longest_substring import datsok.shouldEqual import org.junit.Test /** * https://leetcode.com/problems/longest-substring-without-repeating-characters/ */ class LongestSubstring { @Test fun `find the length of the longest substring without repeating characters`() { "".longest...
7
Roff
3
5
0f169804fae2984b1a78fc25da2d7157a8c7a7be
1,159
katas
The Unlicense
src/main/kotlin/org/ojacquemart/eurobets/firebase/management/table/TableCalculator.kt
ojacquemart
58,000,277
false
{"Kotlin": 119977, "Shell": 7058, "Java": 6830, "Batchfile": 5006}
package org.ojacquemart.eurobets.firebase.management.table import kotlin.comparisons.compareBy import kotlin.comparisons.thenBy class TableCalculator(val bets: List<BetData>, val recentsSize: Int = TableCalculator.RECENTS_SIZE) { fun getRows(): List<TableRow> { val tableRows = getTableRows() val ...
0
Kotlin
1
1
1b5a2bc9568cac6921680369862c04b9617a9438
3,246
spring-kotlin-euro-bets
The Unlicense
src/main/kotlin/com/wabradshaw/claptrap/generation/SetupConstraints.kt
wabradshaw
154,681,482
false
null
package com.wabradshaw.claptrap.generation import com.wabradshaw.claptrap.structure.Form import com.wabradshaw.claptrap.structure.JokeSpec import com.wabradshaw.claptrap.structure.PartOfSpeech import com.wabradshaw.claptrap.structure.Relationship /** * A template constraint type defines a type of constraint that can...
0
Kotlin
0
0
7886787603e477d47ea858a8d9c76e11c4c25fe3
2,862
claptrap
Apache License 2.0
src/main/kotlin/com/ab/advent/day02/Puzzle.kt
battagliandrea
574,137,910
false
{"Kotlin": 27923}
package com.ab.advent.day02 import com.ab.advent.utils.readLines /* PART 01 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 ...
0
Kotlin
0
0
cb66735eea19a5f37dcd4a31ae64f5b450975005
4,135
Advent-of-Kotlin
Apache License 2.0
src/main/java/com/booknara/problem/tree/traverse/VerticalOrderTraversalofBinaryTreeKt.kt
booknara
226,968,158
false
{"Java": 1128390, "Kotlin": 177761}
package com.booknara.problem.tree.traverse import java.util.* import kotlin.collections.ArrayList /** * 987. Vertical Order Traversal of a Binary Tree (Medium) * https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree/ */ class VerticalOrderTraversalofBinaryTreeKt { // T:O(n*logn), S:O(n) fun v...
0
Java
1
1
04dcf500ee9789cf10c488a25647f25359b37a53
1,750
playground
MIT License
src/main/kotlin/Day18.kt
Yeah69
317,335,309
false
{"Kotlin": 73241}
class Day18 : Day() { override val label: String get() = "18" private interface Token private data class Number (val value: Long) : Token private enum class OpType { ADD, MUL } private data class Operator (val type: OpType) : Token private enum class ParType { OPENING, CLOSING } privat...
0
Kotlin
0
0
23121ede8e3e8fc7aa1e8619b9ce425b9b2397ec
3,329
AdventOfCodeKotlin
The Unlicense
src/chapter1/problem4/solution1.kts
neelkamath
395,940,983
false
null
/* Question: Palindrome Permutation: Given a string, write a function to check if it is a permutation of a palindrome. A palindrome is a word or phrase that is the same forwards and backwards. A permutation is a rearrangement of letters. The palindrome does not need to be limited to just dictionary words. EXAMPLE Input...
0
Kotlin
0
0
4421a061e5bf032368b3f7a4cee924e65b43f690
762
ctci-practice
MIT License
src/commonMain/kotlin/io/github/alexandrepiveteau/graphs/algorithms/Dijkstra.kt
alexandrepiveteau
630,931,403
false
{"Kotlin": 132267}
@file:JvmName("Algorithms") @file:JvmMultifileClass package io.github.alexandrepiveteau.graphs.algorithms import io.github.alexandrepiveteau.graphs.* import io.github.alexandrepiveteau.graphs.internal.collections.IntMinPriorityQueue import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName /** * Returns the lis...
9
Kotlin
0
6
a4fd159f094aed5b6b8920d0ceaa6a9c5fc7679f
3,634
kotlin-graphs
MIT License
src/days/Day03.kt
EnergyFusion
572,490,067
false
{"Kotlin": 48323}
import java.io.BufferedReader fun main() { val day = 3 fun calculatePriority(char: Char):Int { return if (char.isUpperCase()) { char.code - 38 } else { char.code - 96 } } fun part1(inputReader: BufferedReader): Int { var totalPriority = 0 ...
0
Kotlin
0
0
06fb8085a8b1838289a4e1599e2135cb5e28c1bf
1,732
advent-of-code-kotlin
Apache License 2.0
leetcode/src/dp/OneZeroPackage.kt
zhangweizhe
387,808,774
false
null
package dp /** * 01背包问题 */ fun main() { val packageSize = 6 val objSize = 4 val weightArray = intArrayOf(2,3,1,5) val valueArray = intArrayOf(1,4,2,3) val dp = Array<Array<Int>>(objSize + 1) { Array<Int>(packageSize + 1) { 0 } } for (i in 1..objSize) { ...
0
Kotlin
0
0
1d213b6162dd8b065d6ca06ac961c7873c65bcdc
2,043
kotlin-study
MIT License
src/main/kotlin/g0601_0700/s0673_number_of_longest_increasing_subsequence/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g0601_0700.s0673_number_of_longest_increasing_subsequence // #Medium #Array #Dynamic_Programming #Segment_Tree #Binary_Indexed_Tree // #Algorithm_II_Day_16_Dynamic_Programming #2023_02_15_Time_226_ms_(91.67%)_Space_36.3_MB_(83.33%) class Solution { fun findNumberOfLIS(nums: IntArray): Int { val dp...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,192
LeetCode-in-Kotlin
MIT License
src/main/kotlin/dev/claudio/adventofcode2021/Day15Part2.kt
ClaudioConsolmagno
434,559,159
false
{"Kotlin": 78336}
package dev.claudio.adventofcode2021 import dev.claudio.adventofcode2021.Support.Companion.printGrid import dev.claudio.adventofcode2021.Support.Companion.surroundingPoints4 import org.jgrapht.Graph import org.jgrapht.alg.shortestpath.DijkstraShortestPath import org.jgrapht.graph.DefaultWeightedEdge import org.jgrapht...
0
Kotlin
0
0
5f1aff1887ad0a7e5a3af9aca7793f1c719e7f1c
2,284
adventofcode-2021
Apache License 2.0