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/kylecorry/sol/math/optimization/IterativeSimpleExtremaFinder.kt
kylecorry31
294,668,785
false
{"Kotlin": 714099, "Java": 18119, "Python": 298}
package com.kylecorry.sol.math.optimization import com.kylecorry.sol.math.Range import com.kylecorry.sol.math.Vector2 import kotlin.math.sqrt class IterativeSimpleExtremaFinder( initialStep: Double, finalStep: Double, levels: Int = 2 ) : IExtremaFinder { private val stepSizes = (1..levels).map { ...
11
Kotlin
4
8
ac1e4f9b3635e7b50a9668f74c9303c0152c94ce
2,578
sol
MIT License
src/test/kotlin/io/github/aarjavp/aoc/day04/Day04Test.kt
AarjavP
433,672,017
false
{"Kotlin": 73104}
package io.github.aarjavp.aoc.day04 import io.kotest.assertions.withClue import io.kotest.matchers.collections.shouldContain import io.kotest.matchers.ints.shouldBeExactly import io.kotest.matchers.maps.shouldContainExactly import io.kotest.matchers.shouldBe import org.junit.jupiter.api.Test internal class Day04Test ...
0
Kotlin
0
0
3f5908fa4991f9b21bb7e3428a359b218fad2a35
3,676
advent-of-code-2021
MIT License
app/src/main/java/com/github/oheger/locationteller/map/TimeDeltaAlphaCalculator.kt
oheger
192,119,380
false
null
/* * Copyright 2019-2022 The Developers. * * 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 ag...
0
Kotlin
1
1
b5ab4bc3a65a48d4fff7dbb9c72d7ff8f79db424
3,350
LocationTeller
Apache License 2.0
Fraction_reduction/Kotlin/src/Fraction.kt
ncoe
108,064,933
false
{"D": 425100, "Java": 399306, "Visual Basic .NET": 343987, "C++": 328611, "C#": 289790, "C": 216950, "Kotlin": 162468, "Modula-2": 148295, "Groovy": 146721, "Lua": 139015, "Ruby": 84703, "LLVM": 58530, "Python": 46744, "Scala": 43213, "F#": 21133, "Perl": 13407, "JavaScript": 6729, "CSS": 453, "HTML": 409}
fun indexOf(n: Int, s: IntArray): Int { for (i_j in s.withIndex()) { if (n == i_j.value) { return i_j.index } } return -1 } fun getDigits(n: Int, le: Int, digits: IntArray): Boolean { var mn = n var mle = le while (mn > 0) { val r = mn % 10 if (r == 0...
0
D
0
4
c2a9f154a5ae77eea2b34bbe5e0cc2248333e421
2,857
rosetta
MIT License
src/ch02/iterations.kt
nickaigi
191,916,746
false
null
package ch02 import java.util.* /* fizzbuzz: * - if any number is divisible by 3 = Fizz * - if any number is divisible by 5 = Buzz * - if number is divisible by both 3 and 5 = FizzBuzz */ fun fizzBuzz(i: Int) = when { i % 15 == 0 -> "FizzBuzz " i % 3 == 0 -> "Fizz " i % 5 == 0 -> "Buzz " else -> "$i ...
0
Kotlin
0
0
bc2a547b47fb9531399110c15a60a14c606a419a
2,380
kotlin-in-action
The Unlicense
melif/src/main/kotlin/ru/ifmo/ctddev/isaev/dataset.kt
siviae
53,358,845
false
{"Kotlin": 152748, "Java": 152582}
package ru.ifmo.ctddev.isaev import java.util.* /** * @author iisaev */ abstract class DataSet(val name: String) { abstract fun getFeatureCount(): Int abstract fun getInstanceCount(): Int abstract fun toFeatureSet(): FeatureDataSet abstract fun toInstanceSet(): InstanceDataSet } class DataInst...
0
Kotlin
0
1
2a3300ea32dda160d400258f2400c03ad84cb713
2,841
parallel-feature-selection
MIT License
year2023/src/main/kotlin/net/olegg/aoc/year2023/day23/Day23.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2023.day23 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.utils.Directions import net.olegg.aoc.utils.Directions.Companion.NEXT_4 import net.olegg.aoc.utils.Directions.D import net.olegg.aoc.utils.Directions.L import net.olegg.aoc.utils.Directions.R import net.olegg.aoc.utils.Direc...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
4,615
adventofcode
MIT License
src/main/kotlin/aoc2020/ex12.kt
noamfree
433,962,392
false
{"Kotlin": 93533}
import kotlin.math.abs fun main() { val input = readInputFile("aoc2020/input12") // val input = """ // F10 // N3 // F7 // R90 // F11 // """.trimIndent() val sea = Sea(Ship(pos = Vector.ZERO, faceDir = Dir.E), Vector(s = -1, w = -10)) val lines = input.lines() va...
0
Kotlin
0
0
566cbb2ef2caaf77c349822f42153badc36565b7
4,147
AOC-2021
MIT License
src/main/kotlin/kgp/tree/Tree.kt
JedS6391
90,571,337
false
null
package kgp.tree import java.util.* /** * Represents the different types of tree generation methods. * * [Grow] mode will generate trees with nodes chosen randomly from * the union of the function and terminal sets, allowing trees that are * smaller than the max depth to be created. This method generally produce...
0
Kotlin
0
1
045fd23e0fac9ea31c20489ae459bd168846d30b
14,621
KGP
MIT License
sandbox/src/main/kotlin/tomasvolker/numeriko/sandbox/co2/Regression.kt
TomasVolker
114,266,369
false
null
package tomasvolker.numeriko.sandbox.co2 import koma.extensions.get import koma.fill import koma.matrix.Matrix import kotlin.math.pow fun regressionMatrix(evaluationPoints: Matrix<Double>, basisFunctions: List<(Double)->Double>) = fill(evaluationPoints.numRows(), basisFunctions.size) { row, col -> basisFunctions[...
8
Kotlin
1
3
1e9d64140ec70b692b1b64ecdcd8b63cf41f97af
1,762
numeriko
Apache License 2.0
2020/src/main/kotlin/de/skyrising/aoc2020/day3/solution.kt
skyrising
317,830,992
false
{"Kotlin": 411565}
package de.skyrising.aoc2020.day3 import de.skyrising.aoc.* @PuzzleName("Toboggan Trajectory") fun PuzzleInput.part1v0(): Any { var trees = 0 var x = 0 for (line in lines) { val tree = line[x % line.length] == '#' if (tree )trees++ x += 3 } return trees } @PuzzleName("Tobo...
0
Kotlin
0
0
19599c1204f6994226d31bce27d8f01440322f39
2,198
aoc
MIT License
src/day25/Day25.kt
crmitchelmore
576,065,911
false
{"Kotlin": 115199}
package day25 import helpers.ReadFile import java.math.BigInteger class Day25 { fun parseSnafu(string: String) : Long { val chars = string.split("").filter { it.isNotEmpty() }.reversed() var mult = 1L var total = 0L for (char in chars) { if (char.toCharArray().first()....
0
Kotlin
0
0
fd644d442b5ff0d2f05fbf6317c61ee9ce7b4470
2,089
adventofcode2022
MIT License
src/main/kotlin/net/dilius/daily/coding/problem/n00x/001.kt
diliuskh
298,020,928
false
null
package net.dilius.daily.coding.problem.n00x import net.dilius.daily.coding.problem.Problem /* Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. Bonus: Can you do this in one pass? */ data ...
0
Kotlin
0
0
7e5739f87dbce2b56d24e7bab63b6cee6bbc54bc
1,131
dailyCodingProblem
Apache License 2.0
src/main/kotlin/ValidParenthese.kt
mececeli
553,346,819
false
{"Kotlin": 9018}
import java.util.* //Valid Parentheses //Easy //16.9K //871 //Companies //Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. // //An input string is valid if: // //Open brackets must be closed by the same type of brackets. //Open brackets must be cl...
0
Kotlin
0
0
d05ee9d32c42d11e71e136f4138bb0335114f360
2,283
Kotlin_Exercises
Apache License 2.0
ArrayTools.kt
chynerdu
650,674,895
false
null
fun main() { println("Hello World") println(averageArray(arrayOf(1, 2, 2, 4, 4))) println(averageArray(arrayOf(1, -2, -2, 4, 4))) println(checkValueExistence(arrayOf(1, 2, 2, 4, 4), 8)) println(reverseArray(arrayOf(1, 2, 3, 4, 5, 6, 7, 34, 28))) val ciphertext = caesarCipherFunc() println(...
0
Kotlin
0
0
74926900639459e3ad2b939c6916ea5d5f81e1e8
2,743
JAV1001-Lab2
MIT License
src/Day06.kt
risboo6909
572,912,116
false
{"Kotlin": 66075}
fun main() { fun findUniq(line: String, windowSize: Int): Int? { val window = ArrayDeque<Char>(windowSize+1) for ((i, s) in line.withIndex()) { window.addLast(s) if (window.size == windowSize+1) { window.removeFirst() } if (window.siz...
0
Kotlin
0
0
bd6f9b46d109a34978e92ab56287e94cc3e1c945
957
aoc2022
Apache License 2.0
plugin/src/main/kotlin/nl/tudelft/hyperion/plugin/metric/APIMetric.kt
SERG-Delft
254,399,628
false
null
package nl.tudelft.hyperion.plugin.metric /** * Represents an element as the result of an /api/v1/metrics API call. * Contains the aggregated log counts over the specified interval, i.e. * an interval of 60 represents the logs that happened in the last minute. */ data class APIMetricsResult( val interval: Int,...
0
Kotlin
1
13
a010d1b6e59592231a2ed29a6d11af38644f2834
3,047
hyperion
Apache License 2.0
kotlin/126.Word Ladder II(单词接龙 II).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 two words (<em>beginWord</em> and <em>endWord</em>), and a dictionary&#39;s word list, find all shortest transformation sequence(s) from <em>beginWord</em> to <em>endWord</em>, such that:</p> <ol> <li>Only one letter can be changed at a time</li> <li>Each transformed word must exist in the word list. No...
0
Python
1
3
6731e128be0fd3c0bdfe885c1a409ac54b929597
4,837
leetcode
MIT License
src/day17/d17_2.kt
svorcmar
720,683,913
false
{"Kotlin": 49110}
fun main() { val input = "" val jugs = input.lines().map { it.toInt() } // dynamic programming array // dp[n][r][c] = number of ways to fill capacity "c" when using exactly "r" of the first "n" jugs val dp = Array(jugs.size + 1) { Array(jugs.size + 1) { Array(150 + 1) { 0 } } } (1 until dp.size).forEach { n...
0
Kotlin
0
0
cb097b59295b2ec76cc0845ee6674f1683c3c91f
682
aoc2015
MIT License
src/main/java/challenges/leetcode/PalindromeNumber.kt
ShabanKamell
342,007,920
false
null
package challenges.leetcode import java.util.* /** Given an integer x, return true if x is palindrome integer. An integer is a palindrome when it reads the same backward as forward. For example, 121 is a palindrome while 123 is not. Example 1: Input: x = 121 Output: true Explanation: 121 reads as 121 from left t...
0
Kotlin
0
0
ee06bebe0d3a7cd411d9ec7b7e317b48fe8c6d70
2,720
CodingChallenges
Apache License 2.0
src/main/kotlin/ctci/chapterten/SearchInRotatedArray.kt
amykv
538,632,477
false
{"Kotlin": 169929}
package ctci.chapterten // 10.3 - page 150 // Given a sorted array of n integers that has been rotated an unknown number of times, write Kotlin code to // find an element in the array. You may assume that the array was originally sorted in increasing order. fun main() { val arr = intArrayOf(15, 16, 19, 20, 25, 1,...
0
Kotlin
0
2
93365cddc95a2f5c8f2c136e5c18b438b38d915f
1,850
dsa-kotlin
MIT License
archive/src/main/kotlin/com/grappenmaker/aoc/year18/Day04.kt
770grappenmaker
434,645,245
false
{"Kotlin": 409647, "Python": 647}
package com.grappenmaker.aoc.year18 import com.grappenmaker.aoc.PuzzleSet import com.grappenmaker.aoc.mostFrequent import com.grappenmaker.aoc.splitInts import java.text.SimpleDateFormat import java.time.ZoneOffset fun PuzzleSet.day4() = puzzle { // Wacky way to do this stuff val format = SimpleDateFormat("yy...
0
Kotlin
0
7
92ef1b5ecc3cbe76d2ccd0303a73fddda82ba585
2,074
advent-of-code
The Unlicense
src/main/kotlin/bk66/Problem3.kt
yvelianyk
405,919,452
false
{"Kotlin": 147854, "Java": 610}
package bk66 fun main() { val result = Problem3().minCost(intArrayOf(0, 3), intArrayOf(2, 3), intArrayOf(5, 4, 3), intArrayOf(8, 2, 6, 7)) println(result) } class Problem3 { fun minCost(startPos: IntArray, homePos: IntArray, rowCosts: IntArray, colCosts: IntArray): Int { val startI = startPos[0] ...
0
Kotlin
0
0
780d6597d0f29154b3c2fb7850a8b1b8c7ee4bcd
904
leetcode-kotlin
MIT License
src/Day07.kt
luiscobo
574,302,765
false
{"Kotlin": 19047}
enum class FileType { PLAIN_FILE, DIRECTORY } data class Node(val fileName: String, val fileType: FileType, var size: Int, var parent: Node? = null) { private val children: MutableList<Node> = mutableListOf() fun getChildByName(dirName: String): Node? { return children.firstOrNull { ...
0
Kotlin
0
0
c764e5abca0ea40bca0b434bdf1ee2ded6458087
5,136
advent-of-code-2022
Apache License 2.0
core/model/src/main/java/online/partyrun/partyrunapplication/core/model/util/RunningRecordCalculation.kt
SWM-KAWAI-MANS
649,352,661
false
{"Kotlin": 806784}
package online.partyrun.partyrunapplication.core.model.util import online.partyrun.partyrunapplication.core.model.running_result.common.RunnerRecord import online.partyrun.partyrunapplication.core.model.running_result.common.RunnerStatus import java.time.Duration import kotlin.math.roundToInt fun formatPace(pace: Dou...
0
Kotlin
1
13
c1a613d5632726a579a35cc0f534e5607c3d6d74
3,518
party-run-application
MIT License
src/main/kotlin/g0101_0200/s0130_surrounded_regions/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g0101_0200.s0130_surrounded_regions // #Medium #Top_Interview_Questions #Array #Depth_First_Search #Breadth_First_Search #Matrix // #Union_Find #Algorithm_II_Day_8_Breadth_First_Search_Depth_First_Search // #2022_10_08_Time_355_ms_(84.42%)_Space_51.2_MB_(68.83%) class Solution { fun solve(board: Array<Cha...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
2,152
LeetCode-in-Kotlin
MIT License
src/Day08.kt
Misano9699
572,108,457
false
null
fun main() { fun determineGrid(input: List<String>): List<List<Int>> { val grid = mutableListOf<List<Int>>() input.forEach { line -> grid.add(line.toCharArray().map { it.toString().toInt() }.toList()) } return grid } fun addToVisibleTrees(visibleTrees: MutableMa...
0
Kotlin
0
0
adb8c5e5098fde01a4438eb2a437840922fb8ae6
4,921
advent-of-code-2022
Apache License 2.0
year2018/src/main/kotlin/net/olegg/aoc/year2018/day14/Day14.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2018.day14 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.year2018.DayOf2018 /** * See [Year 2018, Day 14](https://adventofcode.com/2018/day/14) */ object Day14 : DayOf2018(14) { override fun first(): Any? { val rounds = data.toInt() val recipes = mutableListOf(3, 7) ...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
1,600
adventofcode
MIT License
src/main/kotlin/ru/amai/study/hackerrank/practice/interviewPreparationKit/strings/special/SubstrCount.kt
slobanov
200,526,003
false
null
package ru.amai.study.hackerrank.practice.interviewPreparationKit.strings.special import java.lang.Integer.max import java.util.* fun subStrCount(string: String): Long = cntSubstringsWithSameChars(string) + cntSubstringsWithSameCharsExceptMiddle(string) private fun cntSubstringsWithSameCharsExceptMiddle(string: ...
0
Kotlin
0
0
2cfdf851e1a635b811af82d599681b316b5bde7c
2,032
kotlin-hackerrank
MIT License
core/src/main/kotlin/grammar/classification.kt
SalHe
471,474,974
false
{"Kotlin": 74974, "C": 281}
package com.github.salhe.compiler.grammar import com.github.salhe.compiler.filterComment import com.github.salhe.compiler.grammar.GrammarClassification.* import com.github.salhe.compiler.token.* import com.github.salhe.compiler.token.scanner.Scanner import java.io.ByteArrayInputStream enum class GrammarClassification...
1
Kotlin
1
0
2347899312fc18dba2543746927fa8594cf0288a
6,663
compiler
MIT License
src/leetcode/aprilChallenge2020/weekthree/LeftmostColumnWithAtLeastOne.kt
adnaan1703
268,060,522
false
null
package leetcode.aprilChallenge2020.weekthree private class BinaryMatrix(val grid: Array<IntArray>) { fun get(x: Int, y: Int): Int { return grid[x][y] } fun dimensions(): List<Int> { return listOf(grid.size, grid[0].size) } } fun main() { var grid = arrayOf( intArrayOf(0, ...
0
Kotlin
0
0
e81915db469551342e78e4b3f431859157471229
2,260
KotlinCodes
The Unlicense
src/utils/Math.kt
jrmacgill
573,065,109
false
{"Kotlin": 76362}
@file:Suppress("unused") package utils import kotlin.math.absoluteValue import kotlin.math.pow /** * Euclid's algorithm for finding the greatest common divisor of a and b. */ fun gcd(a: Int, b: Int): Int = if (b == 0) a.absoluteValue else gcd(b, a % b) fun gcd(f: Int, vararg n: Int): Int = n.fold(f, ::gcd) fun Ite...
0
Kotlin
0
1
3dcd590f971b6e9c064b444139d6442df034355b
1,967
aoc-2022-kotlin
Apache License 2.0
shared/impl/src/main/kotlin/dev/eduayuso/cgkotlin/shared/impl/algorithms/AlgorithmUtil.kt
eduayuso
353,986,267
false
{"Kotlin": 84337}
package dev.eduayuso.cgkotlin.shared.impl.algorithms import dev.eduayuso.cgkotlin.shared.domain.entities.PointEntity import dev.eduayuso.cgkotlin.shared.domain.entities.PointSetEntity import dev.eduayuso.cgkotlin.shared.domain.entities.SegmentEntity object AlgorithmUtil { /** * Checks if point s is at left ...
0
Kotlin
0
0
4e1b5272088b77353a87073255dddbb6487318f7
2,764
compose-computational-geometry
Apache License 2.0
kotlin/dp/ShortestHamiltonianCycle.kt
polydisc
281,633,906
true
{"Java": 540473, "Kotlin": 515759, "C++": 265630, "CMake": 571}
package dp import java.util.Arrays object ShortestHamiltonianCycle { fun getShortestHamiltonianCycle(dist: Array<IntArray>): Int { val n = dist.size val dp = Array(1 shl n) { IntArray(n) } for (d in dp) Arrays.fill(d, Integer.MAX_VALUE / 2) dp[1][0] = 0 var mask = 1 ...
1
Java
0
0
4566f3145be72827d72cb93abca8bfd93f1c58df
1,822
codelibrary
The Unlicense
src/main/kotlin/org/maspitzner/presencesimulation/evaluation/NeedlemanWunschAlgorithm.kt
MASpitzner
374,770,623
false
null
package org.maspitzner.presencesimulation.evaluation import java.lang.Double.min /** * Class abstraction to implement the needleman wunsch algorithm. * This is used to calculate a global alignment between two label sequences * (at least in this context). * */ class NeedlemanWunschAlgorithm { //Since this is ...
0
Kotlin
0
0
9d2cf33f987e7e509c62a299ae747df15031e116
2,644
PresenceSimulation
Apache License 2.0
src/main/kotlin/com/github/solairerove/algs4/leprosorium/linked_list/FlattenAMultilevelDoublyLinkedList.kt
solairerove
282,922,172
false
{"Kotlin": 251919}
package com.github.solairerove.algs4.leprosorium.linked_list /** * You are given a doubly linked list, * which contains nodes that have a next pointer, a previous pointer, and an additional child pointer. * This child pointer may or may not point to a separate doubly linked list, * also containing these special no...
1
Kotlin
0
3
64c1acb0c0d54b031e4b2e539b3bc70710137578
2,238
algs4-leprosorium
MIT License
2023/src/main/kotlin/de/skyrising/aoc2023/day16/solution.kt
skyrising
317,830,992
false
{"Kotlin": 411565}
package de.skyrising.aoc2023.day16 import de.skyrising.aoc.* import java.util.* @JvmInline value class State(val intValue: Int) { constructor(x: Int, y: Int, dir: Direction): this(((x and 0x7fff) shl 15) or (y and 0x7fff) or (dir.ordinal shl 30)) val x inline get() = intValue shl 2 shr 17 val y inline ge...
0
Kotlin
0
0
19599c1204f6994226d31bce27d8f01440322f39
3,332
aoc
MIT License
src/chapter5/section1/MSD.kt
w1374720640
265,536,015
false
{"Kotlin": 1373556}
package chapter5.section1 import chapter2.swap /** * 高位优先的字符串排序 */ object MSD { private const val R = 256 private const val M = 10 fun sort(array: Array<String>) { val aux = Array(array.size) { "" } sort(array, aux, 0, array.size - 1, 0) } private fun sort(array: Array<String>,...
0
Kotlin
1
6
879885b82ef51d58efe578c9391f04bc54c2531d
2,627
Algorithms-4th-Edition-in-Kotlin
MIT License
src/Day14.kt
StephenVinouze
572,377,941
false
{"Kotlin": 55719}
fun main() { fun List<String>.toRocks(): Set<Coordinates> { val rocksCoordinates = this.map { it.split(" -> ").map { coordinates -> coordinates.split(",").let { point -> Coordinates(x = point.first().toInt(), y = point.last().toInt()) } ...
0
Kotlin
0
0
11b9c8816ded366aed1a5282a0eb30af20fff0c5
4,484
AdventOfCode2022
Apache License 2.0
src/day03/Day03.kt
robin-schoch
572,718,550
false
{"Kotlin": 26220}
package day03 import AdventOfCodeSolution fun main() { Day03.run() } fun splittIntoCompartments(content: String) = with(content.length / 2) { content.take(this).toSet() to content.takeLast(this).toSet() } fun Char.calculatePriority() = when { isLowerCase() -> this - 'a' + 1 isUpperCase() -> this - ...
0
Kotlin
0
0
fa993787cbeee21ab103d2ce7a02033561e3fac3
999
aoc-2022
Apache License 2.0
src/main/aoc2019/Day20.kt
nibarius
154,152,607
false
{"Kotlin": 963896}
package aoc2019 import org.magicwerk.brownies.collections.GapList class Day20(input: List<String>) { data class Bounds(val u: Int, val iu: Int, val id: Int, val d: Int, val l: Int, val il: Int, val ir: Int, val r: Int) val parsedInput = parseInput(input) private val bounds = findBounds(parsedInput) ...
0
Kotlin
0
6
f2ca41fba7f7ccf4e37a7a9f2283b74e67db9f22
6,777
aoc
MIT License
src/main/kotlin/nl/jackploeg/aoc/_2023/calendar/day11/Day11.kt
jackploeg
736,755,380
false
{"Kotlin": 318734}
package nl.jackploeg.aoc._2023.calendar.day11 import nl.jackploeg.aoc.generators.InputGenerator.InputGeneratorFactory import nl.jackploeg.aoc.utilities.readStringFile import java.util.* import javax.inject.Inject import kotlin.math.abs class Day11 @Inject constructor( private val generatorFactory: InputGeneratorFac...
0
Kotlin
0
0
f2b873b6cf24bf95a4ba3d0e4f6e007b96423b76
5,252
advent-of-code
MIT License
implementation/src/main/kotlin/io/github/tomplum/aoc/engine/Engine.kt
TomPlum
724,225,748
false
{"Kotlin": 141244}
package io.github.tomplum.aoc.engine import io.github.tomplum.libs.extensions.product import io.github.tomplum.libs.math.map.AdventMap2D import io.github.tomplum.libs.math.point.Point2D import kotlin.math.abs class Engine(private val schematic: List<String>) : AdventMap2D<EnginePart>() { private var groups: List...
0
Kotlin
0
1
d1f941a3c5bacd126177ace6b9f576c9af07fed6
3,542
advent-of-code-2023
Apache License 2.0
src/main/kotlin/com/leetcode/random_problems/easy/best_buy_sell_stock/Main.kt
frikit
254,842,734
false
null
package com.leetcode.random_problems.easy.best_buy_sell_stock fun main() { println("Test case 1:") println(Solution().maxProfit(intArrayOf(7, 1, 5, 3, 6, 4))) // 5 println() println("Test case 2:") println(Solution().maxProfit(intArrayOf(7, 6, 4, 3, 1))) // 0 println() println("Test case ...
0
Kotlin
0
0
dda68313ba468163386239ab07f4d993f80783c7
1,027
leet-code-problems
Apache License 2.0
src/kickstart2022/g/CuteLittleButterfly.kt
vubogovich
256,984,714
false
null
package kickstart2022.g // TODO fun main() { val inputFileName = "src/kickstart2022/g/CuteLittleButterfly.in" java.io.File(inputFileName).takeIf { it.exists() }?.also { System.setIn(it.inputStream()) } for (case in 1..readLine()!!.toInt()) { val (n, e) = readLine()!!.split(' ').map { it.toInt() } ...
0
Kotlin
0
0
fc694f84bd313cc9e8fcaa629bafa1d16ca570fb
1,210
kickstart
MIT License
src/iii_conventions/MyDate.kt
agpopikov
79,062,354
false
null
package iii_conventions data class MyDate(val year: Int, val month: Int, val dayOfMonth: Int) : Comparable<MyDate> { override fun compareTo(other: MyDate): Int { if (year.compareTo(other.year) != 0) { return year.compareTo(other.year) } else if (month.compareTo(other.month) != 0) { ...
0
Kotlin
0
0
9ff8f0b38e04623bc99d098e20d6a90deb85587b
1,606
kotlin-koans
MIT License
src/Day09.kt
trosendo
572,903,458
false
{"Kotlin": 26100}
import java.lang.Exception enum class Direction(val code: Char) { UP('U'), DOWN('D'), LEFT('L'), RIGHT('R') } data class Position(val x: Int, val y: Int) { fun move(direction: Direction) = this.move(direction.code) fun move(direction: Char): Position = when (Direction.values().find { it.code == direction...
0
Kotlin
0
0
ea66a6f6179dc131a73f884c10acf3eef8e66a43
5,248
AoC-2022
Apache License 2.0
src/nativeMain/kotlin/com.qiaoyuang.algorithm/special/Questions1.kt
qiaoyuang
100,944,213
false
{"Kotlin": 338134}
package com.qiaoyuang.algorithm.special fun test1() { printlnResult(15, 2) printlnResult(100, 4) printlnResult(101, 4) printlnResult(3, 4) printlnResult(96, 7) } /** * Questions 1: Implement a integer divide function, don't allow use '/', '*' and '%' */ private infix fun Int.divide(divisor: Int)...
0
Kotlin
3
6
66d94b4a8fa307020d515d4d5d54a77c0bab6c4f
1,344
Algorithm
Apache License 2.0
src/main/kotlin/com/hj/leetcode/kotlin/problem1143/Solution.kt
hj-core
534,054,064
false
{"Kotlin": 619841}
package com.hj.leetcode.kotlin.problem1143 import kotlin.math.max /** * LeetCode page: [1143. Longest Common Subsequence](https://leetcode.com/problems/longest-common-subsequence/); */ class Solution { /* Complexity: * Time O(MN) and Space O(MN) where M and N are the length of text1 and * text2, respe...
1
Kotlin
0
1
14c033f2bf43d1c4148633a222c133d76986029c
884
hj-leetcode-kotlin
Apache License 2.0
src/main/kotlin/day01/Day1.kt
limelier
725,979,709
false
{"Kotlin": 48112}
package day01 import common.InputReader private fun String.asDigit(): Int = when(this) { "one", "1" -> 1 "two", "2" -> 2 "three", "3" -> 3 "four", "4" -> 4 "five", "5" -> 5 "six", "6" -> 6 "seven", "7" -> 7 "eight", "8" -> 8 "nine", "9" -> 9 "zero", "0" -> 0 else -> throw I...
0
Kotlin
0
0
0edcde7c96440b0a59e23ec25677f44ae2cfd20c
1,189
advent-of-code-2023-kotlin
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/MultiplyStrings.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,492
kotlab
Apache License 2.0
src/main/java/Exercise21.kt
cortinico
317,667,457
false
null
fun main() { val food = object {} .javaClass .getResource("input-21.txt") .readText() .split("\n") .map { it.replace("(", "").replace(")", "").replace(",", "") } .map { it.split(" contains ") } .map { it[0].trim().split(" ")...
1
Kotlin
0
4
a0d980a6253ec210433e2688cfc6df35104aa9df
1,191
adventofcode-2020
MIT License
leetcode/src/daily/Interview0108.kt
zhangweizhe
387,808,774
false
null
package daily fun main() { // 面试题 01.08. 零矩阵 // https://leetcode.cn/problems/zero-matrix-lcci/ val matrix = arrayOf(arrayOf(0,1,2,0).toIntArray(), arrayOf(3,4,5,2).toIntArray(), arrayOf(1,3,1,5).toIntArray()) setZeroes1(matrix) println(matrix.contentDeepToString()) } fun setZeroes(matrix: Array<I...
0
Kotlin
0
0
1d213b6162dd8b065d6ca06ac961c7873c65bcdc
2,418
kotlin-study
MIT License
Kotlin/EdmondsKarp/EdmondsKarp.kt
19-2-SKKU-OSS
223,087,912
true
{"C++": 154443, "Java": 104625, "JavaScript": 78282, "Python": 75943, "HTML": 72298, "CSS": 45256, "C": 45238, "Swift": 22186, "C#": 20216, "Go": 17191, "Kotlin": 16813, "Ruby": 14089, "Haskell": 5956, "Shell": 4379, "Scala": 4198, "Rust": 3485, "Perl": 1926, "Crystal": 812, "Smalltalk": 793, "Makefile": 727, "Racket":...
import java.util.Scanner import java.util.* //FloydWarshall fun main(args: Array<String>){ println("FloydWarshall"); var capacity = Array<IntArray>(51, {IntArray(51)}) var flow = Array<IntArray>(51, {IntArray(51)}) var visited = IntArray(51){0} val V = 5; //V : number of vertices //E : number of edges ...
0
C++
1
0
2b55676c1bcd5d327fc9e304925a05cb70e25904
2,147
2019-2-OSS-L5
Apache License 2.0
src/codeforces/problem1B/Main.kt
arnavb
241,486,069
false
null
package codeforces.problem1B fun convertToExcelFormat(coord: String, alphabet: CharArray): String { val row = coord.substring(1, coord.indexOf('C')) var column = coord.substring(coord.indexOf('C') + 1).toInt() // Convert column number to letters val resultingColumn = StringBuilder() while (column...
0
Kotlin
0
0
5b805ce90f10192d4499d9abead8b2c109ff59ea
1,815
competitive-programming-kotlin
MIT License
src/main/kotlin/days/Day19.kt
andilau
429,557,457
false
{"Kotlin": 103829}
package days import java.util.* @AdventOfCodePuzzle( name = "<NAME>", url = "https://adventofcode.com/2015/day/19", date = Date(day = 19, year = 2015) ) class Day19(input: List<String>) : Puzzle { private val replacements = parseReplacements(input) private val medicine = parseMedicin(input) o...
0
Kotlin
0
0
55932fb63d6a13a1aa8c8df127593d38b760a34c
2,549
advent-of-code-2015
Creative Commons Zero v1.0 Universal
src/main/kotlin/g0301_0400/s0315_count_of_smaller_numbers_after_self/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g0301_0400.s0315_count_of_smaller_numbers_after_self // #Hard #Top_Interview_Questions #Array #Binary_Search #Ordered_Set #Divide_and_Conquer // #Segment_Tree #Binary_Indexed_Tree #Merge_Sort // #2022_11_10_Time_1282_ms_(88.46%)_Space_109.8_MB_(46.15%) import java.util.LinkedList @Suppress("NAME_SHADOWING") ...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,607
LeetCode-in-Kotlin
MIT License
src/main/kotlin/abc/315-e.kt
kirimin
197,707,422
false
null
package abc import utilities.debugLog import java.util.* fun main(args: Array<String>) { val sc = Scanner(System.`in`) val n = sc.nextInt() val p = (0 until n).map { val c = sc.next().toInt() (0 until c).map { sc.next().toInt() } } println(problem315e(n, p)) } fun problem315e(n: I...
0
Kotlin
1
5
23c9b35da486d98ab80cc56fad9adf609c41a446
2,070
AtCoderLog
The Unlicense
src/main/kotlin/com/github/ferinagy/adventOfCode/aoc2017/2017-13.kt
ferinagy
432,170,488
false
{"Kotlin": 787586}
package com.github.ferinagy.adventOfCode.aoc2017 fun main() { println("Part1:") println(part1(testInput1)) println(part1(input)) println() println("Part2:") println(part2(testInput1)) println(part2(input)) } private fun part1(input: String): Int { val setup = parse(input) return ...
0
Kotlin
0
1
f4890c25841c78784b308db0c814d88cf2de384b
1,265
advent-of-code
MIT License
app/src/main/kotlin/kotlinadventofcode/2015/2015-15.kt
pragmaticpandy
356,481,847
false
{"Kotlin": 1003522, "Shell": 219}
// Originally generated by the template in CodeDAO package kotlinadventofcode.`2015` import com.github.h0tk3y.betterParse.combinators.* import com.github.h0tk3y.betterParse.grammar.Grammar import com.github.h0tk3y.betterParse.grammar.parseToEnd import com.github.h0tk3y.betterParse.lexer.literalToken import com.github....
0
Kotlin
0
3
26ef6b194f3e22783cbbaf1489fc125d9aff9566
7,415
kotlinadventofcode
MIT License
src/main/kotlin/org/nield/kotlinstatistics/Random.kt
thomasnield
84,361,977
false
null
package org.nield.kotlinstatistics import java.util.concurrent.ThreadLocalRandom /** * Samples a single random element `T` from a `List<T>`, and throws an error if no elements exist */ fun <T> List<T>.randomFirst() = randomFirstOrNull()?: throw Exception("No elements found!") /** * Samples a single random elemen...
15
Kotlin
48
840
17f64bae2a3cea2e85f05c08172d19a290561e3b
3,911
kotlin-statistics
Apache License 2.0
src/Day04.kt
jorgecastrejon
573,097,701
false
{"Kotlin": 33669}
fun main() { fun part1(input: List<String>): Int = input.map { pairs -> pairs.getAssignments() } .count { (a, b, c, d) -> a in c..d && b in c..d || c in a..b && d in a..b } fun part2(input: List<String>): Int = input.map { pairs -> pairs.getAssignments() } .count { (a,...
0
Kotlin
0
0
d83b6cea997bd18956141fa10e9188a82c138035
752
aoc-2022
Apache License 2.0
src/test/kotlin/amb/aoc2020/day18.kt
andreasmuellerbluemlein
318,221,589
false
null
package amb.aoc2020 import org.junit.jupiter.api.Test import kotlin.test.assertEquals class Day18 : TestBase() { class Number(var number: String) : Operand { override fun getValue(): Long { return number.toLong() } } interface Operand { fun getValue(): Long } ...
1
Kotlin
0
0
dad1fa57c2b11bf05a51e5fa183775206cf055cf
3,825
aoc2020
MIT License
src/2023/Day04.kt
nagyjani
572,361,168
false
{"Kotlin": 369497}
package `2023` import java.io.File import java.util.* fun main() { Day04().solve() } class Day04 { val input1 = """ Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53 Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19 Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1 Card 4: 41 ...
0
Kotlin
0
0
f0c61c787e4f0b83b69ed0cde3117aed3ae918a5
1,906
advent-of-code
Apache License 2.0
keywordsearch/src/main/kotlin/com/ikbalabki/keywordsearch/model/TernarySearchTrie.kt
ikbalkaya
655,813,368
false
null
package com.ikbalabki.keywordsearch.model /*** This class implements ternary search tree (https://en.wikipedia.org/wiki/Ternary_search_tree) Which is similar to a binary tree with exception of nodes having 3 child nodes instead of one This data structure is memory efficient and can be used for large data sets. * */ i...
0
Kotlin
0
0
99bb35ca5f73d2775b395cb2ae9e9221329f6178
5,211
KeywordSearch
Apache License 2.0
src/questions/PascalTriangle.kt
realpacific
234,499,820
false
null
package questions import _utils.UseCommentAsDocumentation import utils.shouldBe /** * Given an integer numRows, return the first numRows of Pascal's triangle. * In Pascal's triangle, each number is the sum of the two numbers directly above it as shown: * * <img src="https://upload.wikimedia.org/wikipedia/commons/...
4
Kotlin
5
93
22eef528ef1bea9b9831178b64ff2f5b1f61a51f
1,774
algorithms
MIT License
src/main/kotlin/com/kishor/kotlin/algo/algorithms/graph/AdjacencyMatrixWeightedGraph.kt
kishorsutar
276,212,164
false
null
package com.kishor.kotlin.algo.algorithms.graph import java.util.* fun main() { val adjacencyMatrixWeightedGraph = AdjacencyMatrixWeightedGraph(6) adjacencyMatrixWeightedGraph.accept(Scanner(System.`in`)) adjacencyMatrixWeightedGraph.display() } class AdjacencyMatrixWeightedGraph(val vertCount: Int) { ...
0
Kotlin
0
0
6672d7738b035202ece6f148fde05867f6d4d94c
1,227
DS_Algo_Kotlin
MIT License
src/main/kotlin/g1201_1300/s1203_sort_items_by_groups_respecting_dependencies/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g1201_1300.s1203_sort_items_by_groups_respecting_dependencies // #Hard #Depth_First_Search #Breadth_First_Search #Graph #Topological_Sort // #2023_06_09_Time_503_ms_(100.00%)_Space_56.8_MB_(100.00%) import java.util.LinkedList import java.util.Queue class Solution { fun sortItems(n: Int, m: Int, group: I...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
3,578
LeetCode-in-Kotlin
MIT License
src/org/mjurisic/aoc2020/day12/Day12.kt
mjurisic
318,555,615
false
null
package org.mjurisic.aoc2020.day12 import java.io.File import kotlin.math.abs class Day12 { companion object { @JvmStatic fun main(args: Array<String>) = try { val ship = Ship(0, 0) val waypoint = Waypoint(10, -1) File(ClassLoader.getSystemResource("resources/...
0
Kotlin
0
0
9fabcd6f1daa35198aaf91084de3b5240e31b968
2,583
advent-of-code-2020
Apache License 2.0
src/main/kotlin/aoc2022/Day10.kt
j4velin
572,870,735
false
{"Kotlin": 285016, "Python": 1446}
package aoc2022 import readInput fun main() { fun part1(input: List<String>): Int { var register = 1 var cycle = 1 var signalStrenght = 0 val calculateSignalStrengh = { if ((cycle - 20) % 40 == 0) { signalStrenght += register * cycle } ...
0
Kotlin
0
0
f67b4d11ef6a02cba5b206aba340df1e9631b42b
1,713
adventOfCode
Apache License 2.0
src/main/kotlin/days/Day04.kt
poqueque
430,806,840
false
{"Kotlin": 101024}
package days import util.Coor class Day04 : Day(4) { override fun partOne(): Any { val data = inputList[0].split(",").map { it.toInt() }.toList() var i = 2 val boards = mutableListOf<MutableMap<Coor,Int>>() while (i<inputList.size) { val map = mutableMapOf<Coor,Int>() ...
0
Kotlin
0
0
4fa363be46ca5cfcfb271a37564af15233f2a141
5,008
adventofcode2021
MIT License
src/day22/d22_1.kt
svorcmar
720,683,913
false
{"Kotlin": 49110}
import java.util.TreeSet val initMana = 500 val initHp = 50 val missileMana = 53 val missileDmg = 4 val drainMana = 73 val drainDelta = 2 val shieldMana = 113 val shieldTurns = 6 val shieldArmor = 7 val poisonMana = 173 val poisonTurns = 6 val poisonDmg = 3 val rechargeMana = 229 val rechargeTurns = 5 val recharg...
0
Kotlin
0
0
cb097b59295b2ec76cc0845ee6674f1683c3c91f
4,385
aoc2015
MIT License
kotlinLeetCode/src/main/kotlin/leetcode/editor/cn/[387]字符串中的第一个唯一字符.kt
maoqitian
175,940,000
false
{"Kotlin": 354268, "Java": 297740, "C++": 634}
//给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。 // // // // 示例: // // s = "leetcode" //返回 0 // //s = "loveleetcode" //返回 2 // // // // // 提示:你可以假定该字符串只包含小写字母。 // Related Topics 哈希表 字符串 // 👍 332 👎 0 //leetcode submit region begin(Prohibit modification and deletion) class Solution { fun firstUniqChar(s: Stri...
0
Kotlin
0
1
8a85996352a88bb9a8a6a2712dce3eac2e1c3463
1,041
MyLeetCode
Apache License 2.0
Lab 5/src/main/kotlin/QuickHull.kt
knu-3-tochanenko
273,874,096
false
null
import kotlin.math.PI import kotlin.math.abs import kotlin.math.atan2 class QuickHull { companion object { private var result = mutableListOf<Dot>() fun calculate(dots: List<Dot>): List<Dot> { assert(dots.size > 2) var minX = 0 var maxX = 0 // Find...
0
Kotlin
0
0
d33c5e03ccec496ffa6400c7824780886a46b1ba
2,855
ComputerGraphics
MIT License
src/main/kotlin/io/github/carlomicieli/data/Fraction.kt
CarloMicieli
92,217,015
false
null
/* * Copyright 2017 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in wr...
0
Kotlin
0
0
339d19062be2ea7b062b76e9a14ba63badd56413
3,327
the-wrath-of-kotlin
Apache License 2.0
fd-applet-server/src/main/kotlin/io/github/haruhisa_enomoto/backend/utils/ListWithLeq.kt
haruhisa-enomoto
628,298,470
false
null
package io.github.haruhisa_enomoto.backend.utils import io.github.haruhisa_enomoto.backend.quiver.Arrow import io.github.haruhisa_enomoto.backend.quiver.Quiver /** * A data class representing a list of elements and a binary relation [leqs], denoted as `<=`. * * @param T The type for elements. * @property elements...
0
Kotlin
0
0
8ec1afe14e9f0d6330d02652c1cd782a68fca5db
2,652
fd-applet
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/GetDescentPeriods.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
1,776
kotlab
Apache License 2.0
src/Day09.kt
JohannaGudmandsen
573,090,573
false
{"Kotlin": 19316}
import java.io.File import kotlin.collections.* class Position(var X:Int, var Y:Int) fun moveTail(head:Position, tail:Position){ if (head.X > tail.X + 1){ tail.X++ if (head.Y > tail.Y){ tail.Y++ } else if (head.Y < tail.Y){ tail.Y-- } } else ...
0
Kotlin
0
1
21daaa4415bd20c14d67132e615971519211ab16
2,723
aoc-2022
Apache License 2.0
year2020/src/main/kotlin/net/olegg/aoc/year2020/day8/Day8.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2020.day8 import net.olegg.aoc.someday.SomeDay import net.olegg.aoc.utils.toPair import net.olegg.aoc.year2020.DayOf2020 /** * See [Year 2020, Day 8](https://adventofcode.com/2020/day/8) */ object Day8 : DayOf2020(8) { override fun first(): Any? { val program = lines .map { it....
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
1,758
adventofcode
MIT License
src/main/kotlin/Problem19.kt
jimmymorales
496,703,114
false
{"Kotlin": 67323}
/** * You are given the following information, but you may prefer to do some research for yourself. * - 1 Jan 1900 was a Monday. * - Thirty days has September, * April, June and November. * All the rest have thirty-one, * Saving February alone, * Which has twenty-eight, rain or shine. * And on leap ye...
0
Kotlin
0
0
e881cadf85377374e544af0a75cb073c6b496998
2,155
project-euler
MIT License
src/main/kotlin/kr/co/programmers/P67256.kt
antop-dev
229,558,170
false
{"Kotlin": 695315, "Java": 213000}
package kr.co.programmers import kotlin.math.abs // https://programmers.co.kr/learn/courses/30/lessons/67256 class P67256 { fun solution(numbers: IntArray, hand: String): String { var answer = "" val prev = arrayOf(intArrayOf(3, 0), intArrayOf(3, 2)) // 초기 위치 for (n in numbers) { ...
1
Kotlin
0
0
9a3e762af93b078a2abd0d97543123a06e327164
1,561
algorithm
MIT License
src/test/kotlin/org/nield/kotlinstatistics/DoubleStatisticsTest.kt
thomasnield
84,361,977
false
null
package org.nield.kotlinstatistics import org.junit.Assert import org.junit.Test class DoubleStatisticsTest { val doubleVector = sequenceOf(0.0, 1.0, 3.0, 5.0, 11.0) val groups = sequenceOf("A", "B","B","C", "C") @Test fun sumBy() { val r = mapOf("A" to 0.0, "B" to 4.0, "C" to 16.0) ...
15
Kotlin
48
840
17f64bae2a3cea2e85f05c08172d19a290561e3b
1,879
kotlin-statistics
Apache License 2.0
code/day_12/src/jvm8Main/kotlin/task2.kt
dhakehurst
725,945,024
false
{"Kotlin": 105846}
package day_12 import korlibs.io.lang.substr import kotlin.math.min class BitString( val value: ULong ) : Iterable<Boolean> { val groups: List<Int> by lazy { val g = mutableListOf<Int>() var grp = 0 for (b in this.reversed()) { if (b) { grp++ } ...
0
Kotlin
0
0
be416bd89ac375d49649e7fce68c074f8c4e912e
9,909
advent-of-code
Apache License 2.0
kotlinLeetCode/src/main/kotlin/leetcode/editor/cn/[628]三个数的最大乘积.kt
maoqitian
175,940,000
false
{"Kotlin": 354268, "Java": 297740, "C++": 634}
import java.util.* import kotlin.math.max //给定一个整型数组,在数组中找出由三个数组成的最大乘积,并输出这个乘积。 // // 示例 1: // // //输入: [1,2,3] //输出: 6 // // // 示例 2: // // //输入: [1,2,3,4] //输出: 24 // // // 注意: // // // 给定的整型数组长度范围是[3,104],数组中所有的元素范围是[-1000, 1000]。 // 输入的数组中任意三个数的乘积不会超出32位有符号整数的范围。 // // Related Topics 数组 数学 // 👍 261 👎...
0
Kotlin
0
1
8a85996352a88bb9a8a6a2712dce3eac2e1c3463
2,222
MyLeetCode
Apache License 2.0
src/Day01.kt
woainikk
572,944,262
false
{"Kotlin": 1515}
fun main() { fun calculateSnacks(input: List<String>): MutableList<Int>{ val reindeers: MutableList<Int> = mutableListOf() var sum = 0 for (i in input) { if(i.isEmpty()){ reindeers.add(sum) sum = 0 continue } ...
0
Kotlin
0
0
dc06fb37a78d929308d61f562e2003696cad0305
874
adventOfCode
Apache License 2.0
src/main/java/it/smartphonecombo/uecapabilityparser/query/ComboValue.kt
HandyMenny
539,436,833
false
{"Kotlin": 572976, "Dockerfile": 1718, "CSS": 45, "JavaScript": 19}
package it.smartphonecombo.uecapabilityparser.query import it.smartphonecombo.uecapabilityparser.io.IOUtils.echoSafe import it.smartphonecombo.uecapabilityparser.model.combo.ICombo import it.smartphonecombo.uecapabilityparser.model.component.IComponent import kotlinx.serialization.SerialName import kotlinx.serializati...
2
Kotlin
8
13
30c02e3eb8c36beb5aca6c6683286170caf33841
4,095
uecapabilityparser
MIT License
src/leetcodeProblem/leetcode/editor/en/ReverseLinkedList.kt
faniabdullah
382,893,751
false
null
//Given the head of a singly linked list, reverse the list, and return the //reversed list. // // // Example 1: // // //Input: head = [1,2,3,4,5] //Output: [5,4,3,2,1] // // // Example 2: // // //Input: head = [1,2] //Output: [2,1] // // // Example 3: // // //Input: head = [] //Output: [] // // // // Constr...
0
Kotlin
0
6
ecf14fe132824e944818fda1123f1c7796c30532
1,603
dsa-kotlin
MIT License
src/main/kotlin/me/peckb/aoc/_2017/calendar/day24/Day24.kt
peckb1
433,943,215
false
{"Kotlin": 956135}
package me.peckb.aoc._2017.calendar.day24 import javax.inject.Inject import me.peckb.aoc.generators.InputGenerator.InputGeneratorFactory class Day24 @Inject constructor(private val generatorFactory: InputGeneratorFactory) { fun partOne(filename: String) = generatorFactory.forFile(filename).readAs(::day24) { input ...
0
Kotlin
1
3
2625719b657eb22c83af95abfb25eb275dbfee6a
1,983
advent-of-code
MIT License
src/main/kotlin/me/alejandrorm/klosure/sparql/algebra/operators/LeftJoin.kt
alejandrorm
512,041,126
false
{"Kotlin": 196720, "Ruby": 28544, "HTML": 25737}
package me.alejandrorm.klosure.sparql.algebra.operators import me.alejandrorm.klosure.model.Graph import me.alejandrorm.klosure.model.Graphs import me.alejandrorm.klosure.sparql.SolutionMapping import me.alejandrorm.klosure.sparql.algebra.filters.Expression import me.alejandrorm.klosure.sparql.algebra.filters.getEffec...
0
Kotlin
0
0
14abf426f3cad162c021ffae750038e25b8cb271
4,105
klosure
Apache License 2.0
src/main/kotlin/com/hj/leetcode/kotlin/problem1160/Solution.kt
hj-core
534,054,064
false
{"Kotlin": 619841}
package com.hj.leetcode.kotlin.problem1160 /** * LeetCode page: [1160. Find Words That Can Be Formed by Characters](https://leetcode.com/problems/find-words-that-can-be-formed-by-characters/); */ class Solution { /* Complexity: * Time O(N+M) and Space O(1) where N is the flattened length of words * and...
1
Kotlin
0
1
14c033f2bf43d1c4148633a222c133d76986029c
1,154
hj-leetcode-kotlin
Apache License 2.0
src/main/kotlin/me/peckb/aoc/_2021/calendar/day22/Day22.kt
peckb1
433,943,215
false
{"Kotlin": 956135}
package me.peckb.aoc._2021.calendar.day22 import me.peckb.aoc.generators.InputGenerator.InputGeneratorFactory import org.apache.commons.geometry.euclidean.threed.Bounds3D import org.apache.commons.geometry.euclidean.threed.Vector3D import javax.inject.Inject class Day22 @Inject constructor(private val generatorFactor...
0
Kotlin
1
3
2625719b657eb22c83af95abfb25eb275dbfee6a
2,464
advent-of-code
MIT License
src/commonMain/kotlin/urbanistic.transform/AnyToXY.kt
Monkey-Maestro
363,166,892
false
{"Kotlin": 334900}
package urbanistic.transform import kotlin.math.sqrt class Point3(var x: Double = 0.0, var y: Double = 0.0, var z: Double = 0.0) { fun set(x: Double, y: Double, z: Double) { this.x = x this.y = y this.z = z } operator fun minus(v2: Point3): Point3 { return Point3(x - v2.x,...
0
Kotlin
0
0
51396cdd4557480232f42a5649de42caa29d963c
3,823
earcut-kotlin-multiplatform
MIT License
src/main/kotlin/day21.kt
Gitvert
725,292,325
false
{"Kotlin": 97000}
fun day21 (lines: List<String>) { part1(lines) part2(lines) } fun part1(lines: List<String>) { val start = findStartPosition(lines) val currentPositions = mutableSetOf(start) val maxX = lines[0].indices.last val maxY = lines.indices.last for (i in 1..64) { takeAllPossibleSteps(line...
0
Kotlin
0
0
f204f09c94528f5cd83ce0149a254c4b0ca3bc91
3,247
advent_of_code_2023
MIT License
src/main/kotlin/g0701_0800/s0792_number_of_matching_subsequences/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g0701_0800.s0792_number_of_matching_subsequences // #Medium #String #Hash_Table #Sorting #Trie // #2023_03_13_Time_346_ms_(100.00%)_Space_41.7_MB_(40.00%) class Solution { fun numMatchingSubseq(s: String, words: Array<String>): Int { val buckets: Array<MutableList<Node>?> = arrayOfNulls(26) ...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,146
LeetCode-in-Kotlin
MIT License
bot/engine/src/main/kotlin/admin/bot/ArtifactVersion.kt
theopenconversationkit
84,538,053
false
{"Kotlin": 5672130, "TypeScript": 1097149, "HTML": 464445, "CSS": 143185, "SCSS": 74060, "Shell": 10923, "JavaScript": 5496}
/* * Copyright (C) 2017/2021 e-voyageurs technologies * * 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...
147
Kotlin
119
435
aa697c247870de83ada91b342164cc1a525fdfa7
2,637
tock
Apache License 2.0
src/Day11.kt
erwinw
572,913,172
false
{"Kotlin": 87621}
@file:Suppress("MagicNumber") private const val DAY = "11" private const val PART1_CHECK = 10605L private const val PART2_CHECK = 2713310158L fun main() { data class Monkey( val id: Int, var items: MutableList<Long>, val operation: (Long) -> Long, val divisor: Long, val tr...
0
Kotlin
0
0
57cba37265a3c63dea741c187095eff24d0b5381
5,097
adventofcode2022
Apache License 2.0
src/main/kotlin/y2023/day10/Day10.kt
niedrist
726,105,019
false
{"Kotlin": 19919}
package y2023.day10 import BasicDay import util.FileReader val d = FileReader.asStrings("2023/day10.txt").map { it.toCharArray() }.toCoordinates().toMutableList() fun main() = Day09.run() object Day09 : BasicDay() { override fun part1(): Int { val start = d.first { it.pipe == 'S' } val updatedSt...
0
Kotlin
0
1
37e38176d0ee52bef05f093b73b74e47b9011e24
4,395
advent-of-code
Apache License 2.0
src/main/kotlin/com/ginsberg/advent2017/Day06.kt
tginsberg
112,672,087
false
null
/* * Copyright (c) 2017 by <NAME> */ package com.ginsberg.advent2017 /** * AoC 2017, Day 6 * * Problem Description: http://adventofcode.com/2017/day/6 * Blog Post/Commentary: https://todd.ginsberg.com/post/advent-of-code/2017/day6/ */ typealias AnswerFunction = (Map<String, Int>, String) -> Int class Day06(s...
0
Kotlin
0
15
a57219e75ff9412292319b71827b35023f709036
1,306
advent-2017-kotlin
MIT License
src/main/kotlin/probability/independence.kt
jpgagnebmc
625,129,199
false
null
package probability import bayesian.Markov import bayesian.Node import logic.braced interface I { val X: List<Node> val Z: List<Node> val Y: List<Node> } fun I(X: List<Node>, Z: List<Node>, Y: List<Node>): I = IImpl(X, Z, Y) val I.iString: String get() = "I(${X.s}, ${Z.s}, ${Y.s})" private val List...
0
Kotlin
0
0
087bcc0f908fb71da2e3f0e03fe8066f44797643
1,269
homework
Apache License 2.0
src/main/kotlin/days/day7/Day7.kt
Stenz123
694,797,878
false
{"Kotlin": 27460}
package days.day7 import days.Day class Day7:Day() { override fun partOne(): Any { return getValidBagCunt("shiny gold", readInput()).count() } fun getValidBagCunt(bag: String, input: List<String>): Set<String> { val validBags = input.filter{it.substringAfter(" ").contains(bag)} if...
0
Kotlin
0
0
3e5ee86cd723c293ec44b1be314697ccf5cdaab7
1,301
advent-of-code-2020
The Unlicense