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/Day22.kt
HylkeB
573,815,567
false
{"Kotlin": 83982}
@file:Suppress("PackageDirectoryMismatch") package day22 import readInput private sealed class Instruction { class Move(val amount: Int) : Instruction() class Rotate(val direction: Char) : Instruction() } fun main() { fun part1(input: List<String>): Int { val width = input.maxOf { it.length } //...
0
Kotlin
0
0
8649209f4b1264f51b07212ef08fa8ca5c7d465b
5,191
advent-of-code-2022-kotlin
Apache License 2.0
src/Year2022Day10.kt
zhangt2333
575,260,256
false
{"Kotlin": 34993}
fun main() { fun part1(input: List<String>): Int { val targetCycles = (20..220 step 40) var x = 1 var cycle = 1 var ans = 0 fun dida() { if (++cycle in targetCycles) ans += cycle * x } for (line in input) { if (line.s...
0
Kotlin
0
0
cdba887c4df3a63c224d5a80073bcad12786ac71
1,306
aoc-2022-in-kotlin
Apache License 2.0
app/src/main/java/com/arindam/kotlin/ds/GFG.kt
arindamxd
192,865,868
false
null
package com.arindam.kotlin.ds /** * Kotlin program to find out all combinations of positive numbers that add up to given number. * * Created by <NAME> on 29/7/19. */ fun main() { val k = 5 findCombinations(k) } /** * @param arr array to store the combination * @param index next location in ...
0
Kotlin
1
14
d9393b8c211b5d06d81d67455e4b496d01e7c673
1,603
kotlin-development
Apache License 2.0
AoC2021day04-GiantSquid/src/main/kotlin/Main.kt
mcrispim
533,770,397
false
{"Kotlin": 29888}
import java.io.File import java.util.* var numbers: List<Int> = emptyList() var boards: MutableList<Board> = mutableListOf() data class Square(var number: Int, var isChecked: Boolean = false) class Board() { var won: Boolean = false val numbers = mutableSetOf<Int>() val squares = arrayOf( arrayO...
0
Kotlin
0
0
ac4aa71c9b5955fa4077ae40fc7e3fc3d5242523
2,994
AoC2021
MIT License
src/Day12.kt
frozbiz
573,457,870
false
{"Kotlin": 124645}
import java.util.PriorityQueue class TopoGrid ( val grid: List<List<Char>>, val start: Point, val end: Point, val lowPoints: List<Point> ) { val bestPathVals = mutableMapOf(Pair(start, 0)) fun solve(): Int { var routes = PriorityQueue<Triple<Point, Int, Int>> { triple, triple2 -> ...
0
Kotlin
0
0
4feef3fa7cd5f3cea1957bed1d1ab5d1eb2bc388
5,596
2022-aoc-kotlin
Apache License 2.0
src/Day01.kt
sushovan86
573,586,806
false
{"Kotlin": 47064}
import java.io.File import java.util.* val EMPTY_LINE_SEPARATOR = System.lineSeparator().repeat(2) fun main() { fun String.splitByEmptyLine() = this.splitToSequence(EMPTY_LINE_SEPARATOR) fun topElvesCalories(numberOfElves: Int, input: String): List<Int> { val priorityQueue = PriorityQueue<Int>() ...
0
Kotlin
0
0
d5f85b6a48e3505d06b4ae1027e734e66b324964
1,163
aoc-2022
Apache License 2.0
src/main/kotlin/day4.kt
tianyu
574,561,581
false
{"Kotlin": 49942}
private fun main() { part1("The number of fully overlapping assignments is:") { sectionAssignmentPairs().count { (left, right) -> left in right || right in left } } part2("The number of partially overlapping assignments is:") { sectionAssignmentPairs().count { (left, right) -> left.first ...
0
Kotlin
0
0
6144cc0ccf1a51ba2e28c9f38ae4e6dd4c0dc1ea
713
AdventOfCode2022
MIT License
src/main/kotlin/com/hj/leetcode/kotlin/problem76/Solution.kt
hj-core
534,054,064
false
{"Kotlin": 619841}
package com.hj.leetcode.kotlin.problem76 /** * LeetCode page: [76. Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring/); */ class Solution { /* Complexity: * Time O(M+N) and Space O(N) where M and N are the length of s and t respectively; */ fun minWindow(s: String, t:...
1
Kotlin
0
1
14c033f2bf43d1c4148633a222c133d76986029c
1,365
hj-leetcode-kotlin
Apache License 2.0
src/com/kingsleyadio/adventofcode/y2023/Day20.kt
kingsleyadio
435,430,807
false
{"Kotlin": 134666, "JavaScript": 5423}
package com.kingsleyadio.adventofcode.y2023 import com.kingsleyadio.adventofcode.util.lcm import com.kingsleyadio.adventofcode.util.readInput fun main() { val (model, inputs) = buildModel() part1(model, inputs) part2(model, inputs) } private fun part1(model: Model, inputs: Inputs) { val signals = Int...
0
Kotlin
0
1
9abda490a7b4e3d9e6113a0d99d4695fcfb36422
3,730
adventofcode
Apache License 2.0
src/commonMain/kotlin/ai/hypergraph/kaliningraph/automata/FSA.kt
breandan
245,074,037
false
{"Kotlin": 1482924, "Haskell": 744, "OCaml": 200}
package ai.hypergraph.kaliningraph.automata import ai.hypergraph.kaliningraph.graphs.* import ai.hypergraph.kaliningraph.parsing.Σᐩ import ai.hypergraph.kaliningraph.tokenizeByWhitespace import ai.hypergraph.kaliningraph.types.* typealias Arc = Π3A<Σᐩ> typealias TSA = Set<Arc> fun Arc.pretty() = "$π1 -<$π2>-> $π3" fu...
0
Kotlin
8
100
c755dc4858ed2c202c71e12b083ab0518d113714
4,133
galoisenne
Apache License 2.0
usvm-util/src/test/kotlin/org/usvm/algorithms/WeightedAaTreeTests.kt
UnitTestBot
586,907,774
false
{"Kotlin": 2547205, "Java": 471958}
package org.usvm.algorithms import org.junit.jupiter.api.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertTrue import kotlin.test.fail internal class WeightedAaTreeTests { private fun checkInvariants(node : AaTreeNode<*>) { // The level of every leaf node is ...
39
Kotlin
0
7
94c5a49a0812737024dee5be9d642f22baf991a2
3,100
usvm
Apache License 2.0
src/nativeMain/kotlin/com.qiaoyuang.algorithm/round0/Questions28.kt
qiaoyuang
100,944,213
false
{"Kotlin": 338134}
package com.qiaoyuang.algorithm.round0 fun test28() { val a = BinaryTreeNode(8) val b = BinaryTreeNode(6) val c = BinaryTreeNode(6) val d = BinaryTreeNode(5) val e = BinaryTreeNode(7) val f = BinaryTreeNode(7) val g = BinaryTreeNode(5) a.left = b a.right = c b.left = d b.right = e c.left = f c.right = g ...
0
Kotlin
3
6
66d94b4a8fa307020d515d4d5d54a77c0bab6c4f
1,436
Algorithm
Apache License 2.0
dcp_kotlin/src/main/kotlin/dcp/day309/day309.kt
sraaphorst
182,330,159
false
{"C++": 577416, "Kotlin": 231559, "Python": 132573, "Scala": 50468, "Java": 34742, "CMake": 2332, "C": 315}
package dcp.day309 // day309.kt // By <NAME> // M people sitting in a row of N seats. enum class SeatContent { PERSON, EMPTY } typealias SeatContents=List<SeatContent> /** * Clump the people in the seats so that there are no gaps * between them using the fewest moves. */ fun SeatContents.group(): Int { ...
0
C++
1
0
5981e97106376186241f0fad81ee0e3a9b0270b5
1,382
daily-coding-problem
MIT License
src/Day01.kt
davedupplaw
573,042,501
false
{"Kotlin": 29190}
fun main() { fun getElvesWithCalories(input: List<String>): Map<Int, Int> { var elfNumber = 0 return input.mapNotNull { i -> if (i.isBlank()) { elfNumber++; null } else elfNumber to i.toInt() } .groupBy({ it.first }, { it.second }) ...
0
Kotlin
0
0
3b3efb1fb45bd7311565bcb284614e2604b75794
797
advent-of-code-2022
Apache License 2.0
src/2021/Day13.kt
nagyjani
572,361,168
false
{"Kotlin": 369497}
package `2021` import common.Point import java.io.File import java.util.* fun main() { Day13().solve() } class Day13 { val input0 = """ 6,10 0,14 9,10 0,3 10,4 4,11 6,0 6,12 4,1 0,13 10,12 3,4 3,0 8,4 1,10 2,14 8,10 9,0 fold along y=7 fold along x=5 """.trimIndent() private data class Instruction(v...
0
Kotlin
0
0
f0c61c787e4f0b83b69ed0cde3117aed3ae918a5
2,427
advent-of-code
Apache License 2.0
src/Lesson7StacksAndQueues/Nesting.kt
slobodanantonijevic
557,942,075
false
{"Kotlin": 50634}
import java.util.Stack /** * 100/100 * @param S * @return */ fun solution(S: String): Int { if (S.length == 0) return 1 if (S.length % 2 != 0) return 0 val stack: Stack<Char> = Stack<Char>() for (i in 0 until S.length) { val character = S[i] if (character == ')') { if ...
0
Kotlin
0
0
155cf983b1f06550e99c8e13c5e6015a7e7ffb0f
1,400
Codility-Kotlin
Apache License 2.0
kotlin/src/com/s13g/aoc/aoc2015/Day7.kt
shaeberling
50,704,971
false
{"Kotlin": 300158, "Go": 140763, "Java": 107355, "Rust": 2314, "Starlark": 245}
package com.s13g.aoc.aoc2015 import com.s13g.aoc.Result import com.s13g.aoc.Solver import com.s13g.aoc.resultFrom /** * --- Day 7: Some Assembly Required --- * https://adventofcode.com/2015/day/7 */ class Day7 : Solver { private val wires = mutableMapOf<String, Long>() override fun solve(lines: List<String>): ...
0
Kotlin
1
2
7e5806f288e87d26cd22eca44e5c695faf62a0d7
1,977
euler
Apache License 2.0
src/main/kotlin/com/github/michaelbull/advent2021/day13/TransparentPaper.kt
michaelbull
433,565,311
false
{"Kotlin": 162839}
package com.github.michaelbull.advent2021.day13 import com.github.michaelbull.advent2021.math.Vector2 fun Sequence<String>.toTransparentPaper(): TransparentPaper { val dots = mutableSetOf<Vector2>() val instructions = mutableListOf<FoldInstruction>() var readingInstructions = false for (line in this)...
0
Kotlin
0
4
7cec2ac03705da007f227306ceb0e87f302e2e54
2,244
advent-2021
ISC License
src/main/kotlin/g2401_2500/s2499_minimum_total_cost_to_make_arrays_unequal/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g2401_2500.s2499_minimum_total_cost_to_make_arrays_unequal // #Hard #Array #Hash_Table #Greedy #Counting // #2023_07_04_Time_628_ms_(100.00%)_Space_63.2_MB_(100.00%) class Solution { fun minimumTotalCost(nums1: IntArray, nums2: IntArray): Long { val n = nums1.size val bucket = IntArray(n +...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,252
LeetCode-in-Kotlin
MIT License
sources/dependency-resolution/src/org/jetbrains/amper/dependency/resolution/conflicts.kt
JetBrains
709,379,874
false
{"Kotlin": 952413, "Java": 184565, "Shell": 18598, "Lex": 16216, "Swift": 10408, "Ruby": 4639, "Batchfile": 4628, "Dockerfile": 838}
/* * Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.amper.dependency.resolution import org.apache.maven.artifact.versioning.ComparableVersion /** * Defines a conflict on a group of nodes with the same key and provides ...
1
Kotlin
18
526
0e86e9b925df5c20c836209be0a134bc21316ecd
2,476
amper
Apache License 2.0
src/Day01.kt
baghaii
573,918,961
false
{"Kotlin": 11922}
fun main() { fun part1(input: List<String>): Int { val calories = mutableListOf<Int>() var calorieCount = 0 var maxCalories = 0 input.forEach { if (it.isNotEmpty()) { calorieCount += it.toInt() } else { if (calorieCount > maxCal...
0
Kotlin
0
0
8c66dae6569f4b269d1cad9bf901e0a686437469
1,177
AdventOfCode2022
Apache License 2.0
lib_algorithms_sort_kotlin/src/main/java/net/chris/lib/algorithms/sort/kotlin/KTBucketSorter.kt
chrisfang6
105,401,243
false
{"Java": 68669, "Kotlin": 26275, "C++": 12503, "CMake": 2182, "C": 1403}
package net.chris.lib.algorithms.sort.kotlin import java.util.* /** * Bucket sort. * * @param <T> </T> */ abstract class KTBucketSorter : KTSorter() { private var buckets: MutableList<Bucket>? = null override fun subSort(array: IntArray) { if (array == null) { return } ...
0
Java
0
0
1f1c2206d5d9f0a3d6c070a7f6112f60c2714ec0
1,866
sort
Apache License 2.0
src/main/kotlin/dev/shtanko/algorithms/leetcode/ReverseVowels.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2022 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
4
Kotlin
0
19
776159de0b80f0bdc92a9d057c852b8b80147c11
2,301
kotlab
Apache License 2.0
app/src/main/kotlin/me/mataha/misaki/solutions/adventofcode/aoc2020/d01/Day.kt
mataha
302,513,601
false
{"Kotlin": 92734, "Gosu": 702, "Batchfile": 104, "Shell": 90}
package me.mataha.misaki.solutions.adventofcode.aoc2020.d01 import me.mataha.misaki.domain.adventofcode.AdventOfCode import me.mataha.misaki.domain.adventofcode.AdventOfCodeDay /** See the puzzle's full description [here](https://adventofcode.com/2020/day/1). */ @AdventOfCode("Report Repair", 2020, 1) class ReportRep...
0
Kotlin
0
0
748a5b25a39d01b2ffdcc94f1a99a6fbc8a02685
1,603
misaki
MIT License
src/leetcodeProblem/leetcode/editor/en/SingleNumberIii.kt
faniabdullah
382,893,751
false
null
//Given an integer array nums, in which exactly two elements appear only once //and all the other elements appear exactly twice. Find the two elements that //appear only once. You can return the answer in any order. // // You must write an algorithm that runs in linear runtime complexity and uses //only constant ext...
0
Kotlin
0
6
ecf14fe132824e944818fda1123f1c7796c30532
1,631
dsa-kotlin
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/NumIdenticalPairs.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2020 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
4
Kotlin
0
19
776159de0b80f0bdc92a9d057c852b8b80147c11
1,852
kotlab
Apache License 2.0
2020/src/main/kotlin/sh/weller/adventofcode/twentytwenty/Day12.kt
Guruth
328,467,380
false
{"Kotlin": 188298, "Rust": 13289, "Elixir": 1833}
package sh.weller.adventofcode.twentytwenty import kotlin.math.absoluteValue fun List<String>.day12Part2(): Int { var shipCoordinates = Coordinates(0, 0) var waypointCoordinates = Coordinates(10, 1) this.map { it.toInstruction() } .forEach { instruction -> when (instruction.getOperat...
0
Kotlin
0
0
69ac07025ce520cdf285b0faa5131ee5962bd69b
4,421
AdventOfCode
MIT License
jvm/src/main/kotlin/io/prfxn/aoc2021/day02.kt
prfxn
435,386,161
false
{"Kotlin": 72820, "Python": 362}
// Dive! (https://adventofcode.com/2021/day/2) package io.prfxn.aoc2021 fun main() { val lines = textResourceReader("input/02.txt").useLines { ls -> ls.map { ln -> ln.split(" ").let { it[0] to it[1].toInt() } }.toList() } val answer1 = lines ...
0
Kotlin
0
0
148938cab8656d3fbfdfe6c68256fa5ba3b47b90
1,262
aoc2021
MIT License
kotlin/src/com/daily/algothrim/leetcode/CheckPossibility.kt
idisfkj
291,855,545
false
null
package com.daily.algothrim.leetcode /** * 665. 非递减数列 * * 给你一个长度为 n 的整数数组,请你判断在 最多 改变 1 个元素的情况下,该数组能否变成一个非递减数列。 * 我们是这样定义一个非递减数列的: 对于数组中所有的 i (0 <= i <= n-2),总满足 nums[i] <= nums[i + 1]。 */ class CheckPossibility { companion object { @JvmStatic fun main(args: Array<String>) { print...
0
Kotlin
9
59
9de2b21d3bcd41cd03f0f7dd19136db93824a0fa
1,427
daily_algorithm
Apache License 2.0
src/main/kotlin/org/olafneumann/regex/generator/regex/RecognizerCombiner.kt
wasi-master
406,654,940
true
{"Kotlin": 80063, "HTML": 17238, "CSS": 2167, "Dockerfile": 201, "JavaScript": 153}
package org.olafneumann.regex.generator.regex object RecognizerCombiner { fun combineMatches( inputText: String, selectedMatches: Collection<RecognizerMatch>, options: Options ): RegularExpression { val rangesToMatches = selectedMatches.flatMap { match -> match.range...
0
Kotlin
0
1
1c1d8035ddc2afa3ccf4f0709ccdfe57a0200b63
6,985
regex-generator
MIT License
sykdomstidslinje/src/main/kotlin/no/nav/helse/tournament/DagTurnering.kt
navikt
211,019,921
false
null
package no.nav.helse.tournament import no.nav.helse.sykdomstidslinje.dag.Dag import no.nav.helse.sykdomstidslinje.dag.Ubestemtdag internal val dagTurnering = DagTurnering() internal class DagTurnering(val source: String = "/dagturnering.csv") { internal val strategies: Map<Dag.Nøkkel, Map<Dag.Nøkkel, Strategy>>...
0
Kotlin
0
1
f9e93b54da76aa03c74e2b650f5cdcc2077d73f4
3,424
helse-sykdomstidslinje
MIT License
app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateRanker.kt
Rattlehead15
330,245,026
true
null
package eu.kanade.tachiyomi.data.library import eu.kanade.tachiyomi.data.database.models.Manga import java.util.Collections import kotlin.Comparator import kotlin.math.abs /** * This class will provide various functions to rank manga to efficiently schedule manga to update. */ object LibraryUpdateRanker { val ...
9
Kotlin
4
61
e64143ef4a3734ba60334677be0b5e70074782ec
2,024
tachiyomiOCR
Apache License 2.0
2021/kotlin/me/brandonbuck/adventofcode/binarydiagnostic/Solution2.kt
bbuck
437,605,794
false
{"Kotlin": 5823, "Starlark": 3013}
package me.brandonbuck.adventofcode.binarydiagnostic import me.brandonbuck.adventofcode.common.io.readAllFromStandardIn fun main() { val inputs = readAllFromStandardIn() println(solution2(inputs)) } fun solution2(inputs: List<String>): Int { val binLength = inputs[0].length var o2List = inputs; var co2List = i...
0
Kotlin
0
0
c06cbc73b6fbb848f3f8a2327a60f40d69a5f4fa
1,115
advent-of-code
MIT License
src/main/kotlin/us/sodiumlabs/electorate/sim/RegretMetrics.kt
napentathol
130,545,021
false
null
package us.sodiumlabs.electorate.sim import com.google.common.base.Strings import us.sodiumlabs.electorate.BigDecimalAverageCollector import java.math.BigDecimal import java.util.function.Function open class RegretMetrics( val rawUtility: BigDecimalWrapper, val regret: BigDecimalWrapper, val normalizedReg...
0
Kotlin
0
1
ad82e05775861030c40e0c39384016de34e69275
3,463
electorate
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/CountNodes.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,676
kotlab
Apache License 2.0
src/main/kotlin/g1801_1900/s1801_number_of_orders_in_the_backlog/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g1801_1900.s1801_number_of_orders_in_the_backlog // #Medium #Array #Heap_Priority_Queue #Simulation // #2023_06_19_Time_668_ms_(100.00%)_Space_101.6_MB_(100.00%) import java.util.PriorityQueue class Solution { private class Order(var price: Int, var qty: Int) fun getNumberOfBacklogOrders(orders: Arr...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
2,006
LeetCode-in-Kotlin
MIT License
src/com/kingsleyadio/adventofcode/y2022/day01/Solution.kt
kingsleyadio
435,430,807
false
{"Kotlin": 134666, "JavaScript": 5423}
package com.kingsleyadio.adventofcode.y2022.day01 import com.kingsleyadio.adventofcode.util.readInput fun main() { part1() part2() } fun part1() { var max = 0 var sum = 0 readInput(2022, 1).forEachLine { line -> if (line.isEmpty()) { max = maxOf(max, sum) sum = 0 ...
0
Kotlin
0
1
9abda490a7b4e3d9e6113a0d99d4695fcfb36422
995
adventofcode
Apache License 2.0
src/Day03.kt
RandomUserIK
572,624,698
false
{"Kotlin": 21278}
private const val GROUP_SIZE = 3 private val PRIORITIES = (('a'..'z') + ('A'..'Z')).mapIndexed { idx, c -> c to (idx + 1) }.toMap() fun main() { fun part1(input: List<String>): Int = input .map { val (first, second) = it.chunked(it.length / 2) Pair(first.toSet(), second.toSet()) } .fold(0) { acc, ...
0
Kotlin
0
0
f22f10da922832d78dd444b5c9cc08fadc566b4b
763
advent-of-code-2022
Apache License 2.0
src/main/aoc2021/Day19.kt
nibarius
154,152,607
false
{"Kotlin": 963896}
package aoc2021 import java.lang.Integer.max import kotlin.math.abs // typealias is global, so use a name that won't collide with coordinates in other puzzles /** * Each beacon position is just a list of three coordinates. Due to scanner alignment issues different * indexes in the list may refer to different axis b...
0
Kotlin
0
6
f2ca41fba7f7ccf4e37a7a9f2283b74e67db9f22
8,888
aoc
MIT License
src/questions/MergeSortedLists.kt
realpacific
234,499,820
false
null
package questions import _utils.UseCommentAsDocumentation import algorithmdesignmanualbook.print import questions.common.LeetNode import utils.assertIterableSame import utils.shouldBe /** * Merge two sorted linked lists and return it as a sorted list. * The list should be made by splicing together the nodes of the ...
4
Kotlin
5
93
22eef528ef1bea9b9831178b64ff2f5b1f61a51f
1,586
algorithms
MIT License
solutions/src/main/kotlin/fr/triozer/aoc/y2022/Day01.kt
triozer
573,964,813
false
{"Kotlin": 16632, "Shell": 3355, "JavaScript": 1716}
package fr.triozer.aoc.y2022 import fr.triozer.aoc.utils.readInput // #region part1 private fun part1(input: List<String>): Int { return input.joinToString(";") .split(";;") .maxOf { carriedCalories -> carriedCalories.split(";").sumOf { it.toInt() } } } // #endregion part1 // ...
0
Kotlin
0
1
a9f47fa0f749a40e9667295ea8a4023045793ac1
895
advent-of-code
Apache License 2.0
aoc-2018/src/main/kotlin/nl/jstege/adventofcode/aoc2018/days/Day16.kt
JStege1206
92,714,900
false
null
package nl.jstege.adventofcode.aoc2018.days import nl.jstege.adventofcode.aoc2018.days.instructionset.Instruction.OpCodeInstruction import nl.jstege.adventofcode.aoc2018.days.instructionset.Op import nl.jstege.adventofcode.aoc2018.days.instructionset.RegisterBank import nl.jstege.adventofcode.aoccommon.days.Day import...
0
Kotlin
0
0
d48f7f98c4c5c59e2a2dfff42a68ac2a78b1e025
4,806
AdventOfCode
MIT License
src/Day01.kt
mkulak
573,910,880
false
{"Kotlin": 14860}
fun main() { fun part1(input: List<String>): Int = input.fold(0 to 0) { (maximum, current), str -> if (str.isEmpty()) Math.max(maximum, current) to 0 else maximum to current + str.toInt() }.first fun part2(input: List<String>): Int = input.fold(listOf<Int>() to 0) { (list, a...
0
Kotlin
0
0
3b4e9b32df24d8b379c60ddc3c007d4be3f17d28
547
AdventOfKo2022
Apache License 2.0
2020/src/year2020/day14/Day14.kt
eburke56
436,742,568
false
{"Kotlin": 61133}
package year2020.day12 import util.readAllLines import java.util.regex.Pattern private fun printBits(value: ULong) { println(value.toString(radix = 2).padStart(Long.SIZE_BITS, '0')) } private fun processMask(mask: String): Pair<ULong, ULong> { var andWord = 0.toULong() var andBit = 1.toULong() var or...
0
Kotlin
0
0
24ae0848d3ede32c9c4d8a4bf643bf67325a718e
3,531
adventofcode
MIT License
src/main/kotlin/com/colinodell/advent2021/Day15.kt
colinodell
433,864,377
true
{"Kotlin": 111114}
package com.colinodell.advent2021 import java.util.PriorityQueue import kotlin.math.abs class Day15(input: List<String>) { private val cavern = input.toGrid(Character::getNumericValue) fun solvePart1() = a_star(cavern, cavern.topLeft(), cavern.bottomRight()) fun solvePart2() = cavern.tile(5).let { ...
0
Kotlin
0
1
a1e04207c53adfcc194c85894765195bf147be7a
2,351
advent-2021
Apache License 2.0
src/main/kotlin/ru/timakden/aoc/year2022/Day03.kt
timakden
76,895,831
false
{"Kotlin": 321649}
package ru.timakden.aoc.year2022 import ru.timakden.aoc.util.measure import ru.timakden.aoc.util.readInput /** * [Day 3: Rucksack Reorganization](https://adventofcode.com/2022/day/3). */ object Day03 { @JvmStatic fun main(args: Array<String>) { measure { val input = readInput("year2022/D...
0
Kotlin
0
3
acc4dceb69350c04f6ae42fc50315745f728cce1
1,052
advent-of-code
MIT License
src/main/kotlin/biz/koziolek/adventofcode/year2023/day12/day12.kt
pkoziol
434,913,366
false
{"Kotlin": 715025, "Shell": 1892}
package biz.koziolek.adventofcode.year2023.day12 import biz.koziolek.adventofcode.findInput import java.time.LocalDateTime fun main() { val inputFile = findInput(object {}) val springs = parseHotSpringsRecords(inputFile.bufferedReader().readLines()) println("There are ${countPossibleArrangements(springs)}...
0
Kotlin
0
0
1b1c6971bf45b89fd76bbcc503444d0d86617e95
7,153
advent-of-code
MIT License
2022/src/main/kotlin/de/skyrising/aoc2022/day22/solution.kt
skyrising
317,830,992
false
{"Kotlin": 411565}
package de.skyrising.aoc2022.day22 import de.skyrising.aoc.* private fun parseInput(input: PuzzleInput): Pair<CharGrid, List<String>> { val grid = CharGrid.parse(input.lines.subList(0, input.lines.size - 2)) val path = Regex("\\d+|R|L").findAll(input.lines.last()).map { it.value }.toList() return grid to ...
0
Kotlin
0
0
19599c1204f6994226d31bce27d8f01440322f39
4,726
aoc
MIT License
src/main/kotlin/solutions/constantTime/iteration3/MemorizedBracketTaxCalculator.kt
daniel-rusu
669,564,782
false
{"Kotlin": 70755}
package solutions.constantTime.iteration3 import dataModel.base.Money import dataModel.base.Money.Companion.dollars import dataModel.base.TaxBracket import dataModel.base.TaxCalculator import solutions.constantTime.iteration2.BoundedMemorizedTaxCalculator import dataModel.v2.AccumulatedTaxBracket import dataModel.v2.t...
0
Kotlin
0
1
166d8bc05c355929ffc5b216755702a77bb05c54
1,825
tax-calculator
MIT License
language/kotlin/Kotlin for Java Developers. Week 3/Taxi Park/Task/src/taxipark/TaxiParkTask.kt
posadskiy
125,151,585
false
{"Java": 315541, "Kotlin": 111425, "HTML": 37044, "JavaScript": 16971, "CSS": 7560, "Swift": 6246}
package taxipark import kotlin.math.roundToInt /* * Task #1. Find all the drivers who performed no trips. */ fun TaxiPark.findFakeDrivers(): Set<Driver> = this.allDrivers.filter { driver -> this.trips.all { trip -> !trip.driver.name.equals(driver.name) } }.toSet() /* * Task #2. Find all the clients who co...
1
Java
0
3
a0fd842209e1644298c19680aeffa672069955ed
2,548
study-everyday
MIT License
src/Day01.kt
achugr
573,234,224
false
null
fun main() { fun groupAndSum(input: List<String>) = input.foldIndexed(mutableListOf<MutableList<Int>>(mutableListOf())) { index, list, value -> when { value.isBlank() -> list.add(mutableListOf()) list.isNotEmpty() -> list.last().add(value.toInt()) ...
0
Kotlin
0
0
d91bda244d7025488bff9fc51ca2653eb6a467ee
931
advent-of-code-kotlin-2022
Apache License 2.0
src/Day16.kt
GarrettShorr
571,769,671
false
{"Kotlin": 82669}
import java.lang.Math.* import java.util.* fun main() { class Valve( var name: String, var flowRate: Int, var isOpen: Boolean = false, var isOpening: Boolean = false, var totalPressureReleased: Int = Integer.MAX_VALUE, var mostFlowRate: LinkedList<Valve> = LinkedList(), var adjacentNodes:...
0
Kotlin
0
0
391336623968f210a19797b44d027b05f31484b5
6,316
AdventOfCode2022
Apache License 2.0
src/main/kotlin/org/rust/toml/crates/local/CrateVersionRequirement.kt
intellij-rust
42,619,487
false
{"Kotlin": 11390660, "Rust": 176571, "Python": 109964, "HTML": 23157, "Lex": 12605, "ANTLR": 3304, "Java": 688, "Shell": 377, "RenderScript": 343}
/* * Use of this source code is governed by the MIT license that can be * found in the LICENSE file. */ package org.rust.toml.crates.local import io.github.z4kn4fein.semver.Version import io.github.z4kn4fein.semver.constraints.Constraint import io.github.z4kn4fein.semver.constraints.satisfiedBy import io.github.z4...
1,843
Kotlin
392
4,524
c6657c02bb62075bf7b7ceb84d000f93dda34dc1
2,787
intellij-rust
MIT License
src/main/kotlin/g0901_1000/s0959_regions_cut_by_slashes/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g0901_1000.s0959_regions_cut_by_slashes // #Medium #Depth_First_Search #Breadth_First_Search #Graph #Union_Find // #2023_05_03_Time_180_ms_(100.00%)_Space_37.2_MB_(50.00%) @Suppress("NAME_SHADOWING") class Solution { private var regions = 0 private lateinit var parent: IntArray fun regionsBySlashe...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
2,164
LeetCode-in-Kotlin
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/VerbalArithmeticPuzzle.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
3,217
kotlab
Apache License 2.0
src/main/kotlin/cloud/dqn/leetcode/FindAllNumbersDisappearedInAnArrayKt.kt
aviuswen
112,305,062
false
null
package cloud.dqn.leetcode /** * https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/description/ Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this a...
0
Kotlin
0
0
23458b98104fa5d32efe811c3d2d4c1578b67f4b
2,694
cloud-dqn-leetcode
No Limit Public License
day02/kotlin/corneil/src/main/kotlin/solution.kt
timgrossmann
224,991,491
true
{"HTML": 2739009, "Python": 169603, "Java": 157274, "Jupyter Notebook": 116902, "TypeScript": 113866, "Kotlin": 89503, "Groovy": 73664, "Dart": 47763, "C++": 43677, "CSS": 34994, "Ruby": 27091, "Haskell": 26727, "Scala": 11409, "Dockerfile": 10370, "JavaScript": 6496, "PHP": 4152, "Go": 2838, "Shell": 2493, "Rust": 208...
package com.github.corneil.aoc2019.day2 import java.io.File fun readProgram(input: String) = input.split(",").map { it.toInt() } fun readProgram(input: File) = readProgram(input.readText().trim()) fun deref(input: List<Int>, address: Int): Int = input[input[address]] fun assign(input: MutableList<Int>, address: In...
0
HTML
0
1
bb19fda33ac6e91a27dfaea27f9c77c7f1745b9b
2,268
aoc-2019
MIT License
src/main/kotlin/g2201_2300/s2280_minimum_lines_to_represent_a_line_chart/Solution.kt
javadev
190,711,550
false
{"Kotlin": 4420233, "TypeScript": 50437, "Python": 3646, "Shell": 994}
package g2201_2300.s2280_minimum_lines_to_represent_a_line_chart // #Medium #Array #Math #Sorting #Geometry #Number_Theory // #2023_06_28_Time_765_ms_(100.00%)_Space_98.8_MB_(100.00%) import java.util.Arrays class Solution { fun minimumLines(stockPrices: Array<IntArray>): Int { if (stockPrices.size == 1)...
0
Kotlin
14
24
fc95a0f4e1d629b71574909754ca216e7e1110d2
1,275
LeetCode-in-Kotlin
MIT License
src/aoc2023/Day09.kt
dayanruben
433,250,590
false
{"Kotlin": 79134}
package aoc2023 import checkValue import readInput fun main() { val (year, day) = "2023" to "Day09" fun extrapolate(seq: List<Long>, backguard: Boolean): Long { var value = 0L var factor = 1 var current = seq while (current.any { it != 0L }) { if (backguard) { ...
1
Kotlin
2
30
df1f04b90e81fbb9078a30f528d52295689f7de7
1,151
aoc-kotlin
Apache License 2.0
src/Day09.kt
vjgarciag96
572,719,091
false
{"Kotlin": 44399}
import kotlin.math.absoluteValue private data class Point( val x: Int, val y: Int, ) private fun part1(input: List<String>): Int { val pointsVisitedByTail = HashSet<Point>() var headPosition = Point(x = 0, y = 0) var tailPosition = Point(x = 0, y = 0) pointsVisitedByTail.add(tailPosition) ...
0
Kotlin
0
0
ee53877877b21166b8f7dc63c15cc929c8c20430
7,453
advent-of-code-2022
Apache License 2.0
src/Day06.kt
polbins
573,082,325
false
{"Kotlin": 9981}
fun main() { fun part1(input: List<String>, size: Int = 4): List<Int> { val result = mutableListOf<Int>() input.forEach { s -> val chars = mutableListOf<Char>() s.toCharArray().forEachIndexed { index, c -> chars.add(c) if (chars.size == size) { if (chars.toSet().size == s...
0
Kotlin
0
0
fb9438d78fed7509a4a2cf6c9ea9e2eb9d059f14
945
AoC-2022
Apache License 2.0
src/main/kotlin/cloud/dqn/leetcode/DeleteNodeInABSTKt.kt
aviuswen
112,305,062
false
null
package cloud.dqn.leetcode /** * https://leetcode.com/problems/delete-node-in-a-bst/description/ Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST. Basically, the deletion can be divided into two stages: ...
0
Kotlin
0
0
23458b98104fa5d32efe811c3d2d4c1578b67f4b
3,159
cloud-dqn-leetcode
No Limit Public License
src/Day06.kt
vi-quang
573,647,667
false
{"Kotlin": 49703}
/** * Main ------------------------------------------------------------------- */ fun main() { class Bin(val name: String) { var content: Char = '-' } class CharacterWindow(var capacity: Int) { val binList = mutableListOf<Bin>() init { for (i in 1..capacity) { ...
0
Kotlin
0
2
ae153c99b58ba3749f16b3fe53f06a4b557105d3
2,465
aoc-2022
Apache License 2.0
src/chapter08/_8_1_2/_8_1_6_去除重复代码.kt
xu33liang33
252,216,839
false
null
package chapter08._8_1_2 data class SiteVisit( val path: String, val dutation: Double, val os: OS ) //函数类型和lambda 一起去除重复代码 enum class OS { WINDOWS, LINUX, MAC, IOS, ANDROID } fun main(args: Array<String>) { val log = listOf( SiteVisit("/", 34.0, OS.WINDOWS), SiteVi...
0
Kotlin
0
1
cdc74e445c8c487023fbc7917183d47e73ff4bc8
1,934
actioninkotlin
Apache License 2.0
src/main/kotlin/adventofcode2018/Day07TheSumOfItsParts.kt
n81ur3
484,801,748
false
{"Kotlin": 476844, "Java": 275}
package adventofcode2018 class Day07TheSumOfItsParts enum class Step { A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z } data class Instruction(val step: Step, val preSteps: MutableSet<Step> = mutableSetOf()) data class ConcurrentWorker(var executionTime: Int = 0, var busy: Boolean ...
0
Kotlin
0
0
fdc59410c717ac4876d53d8688d03b9b044c1b7e
2,650
kotlin-coding-challenges
MIT License
year2020/src/main/kotlin/net/olegg/aoc/year2020/day12/Day12.kt
0legg
110,665,187
false
{"Kotlin": 511989}
package net.olegg.aoc.year2020.day12 import net.olegg.aoc.someday.SomeDay 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.utils.Directions.R import net.olegg.aoc.u...
0
Kotlin
1
7
e4a356079eb3a7f616f4c710fe1dfe781fc78b1a
2,025
adventofcode
MIT License
src/Day01.kt
zuevmaxim
572,255,617
false
{"Kotlin": 17901}
fun main() { fun part1(input: List<String>): Int { var current = 0 var result = 0 fun updateMax() { if (result < current) result = current current = 0 } for (s in input) { if (s.isEmpty()) { updateMax() } else { ...
0
Kotlin
0
0
34356dd1f6e27cc45c8b4f0d9849f89604af0dfd
1,053
AOC2022
Apache License 2.0
src/main/java/dev/haenara/mailprogramming/solution/y2019/m12/d15/Solution191215.kt
HaenaraShin
226,032,186
false
null
package dev.haenara.mailprogramming.solution.y2019.m12.d15 import dev.haenara.mailprogramming.solution.Solution /** * 매일프로그래밍 2019. 12. 15 * 정수 배열이 주어졌을 때, 왼쪽과 오른쪽의 합이 같은 값이 되는 위치를 찾으시오. * 즉, A라는 배열이 있다면 A[0] + … + A[i - 1]과 A[i + 1] + … + A[n]이 같은 값이 되는 i의 위치가 답이 됩니다. * 만약 A[1] + … + A[n]이 0이라면 0도 답이 됩니다. * * ...
0
Kotlin
0
7
b5e50907b8a7af5db2055a99461bff9cc0268293
1,262
MailProgramming
MIT License
src/Day08.kt
ixtryl
575,312,836
false
null
import java.lang.IllegalArgumentException import java.util.* object DAY08 { fun run(fileName: String): Int { val lines = readInput(fileName) val forest: List<List<Int>> = createForest(lines) val matrix: List<List<Int>> = createVisibilityMatrix(forest) return calculateVisableTrees(m...
0
Kotlin
0
0
78fa5f6f85bebe085a26333e3f4d0888e510689c
5,562
advent-of-code-kotlin-2022
Apache License 2.0
2023/src/main/kotlin/net/daams/solutions/10a.kt
Michiel-Daams
573,040,288
false
{"Kotlin": 39925, "Nim": 34690}
package net.daams.solutions import net.daams.Solution import java.util.Stack class `10a`(input: String): Solution(input) { private val pipes = mutableListOf<MutableList<Pipe?>>() private lateinit var startingLocation: Pair<Int, Int> override fun run() { input.split("\n").forEachIndexed { y, pipeR...
0
Kotlin
0
0
f7b2e020f23ec0e5ecaeb97885f6521f7a903238
4,464
advent-of-code
MIT License
src/main/kotlin/day6/solver.kt
derekaspaulding
317,756,568
false
null
package day6 import java.io.File fun solveProblemOne(groups: List<List<String>>): Int = groups.fold(0, {sum, group -> val charSet = mutableSetOf<Char>() for (answer in group) { for (char in answer) { charSet.add(char) } } sum + charSet.size }) fun solveProblemTwo(groups...
0
Kotlin
0
0
0e26fdbb3415fac413ea833bc7579c09561b49e5
928
advent-of-code-2020
MIT License
src/main/kotlin/puzzle13/OrigamiSolver.kt
tpoujol
436,532,129
false
{"Kotlin": 47470}
package puzzle13 import kotlin.system.measureTimeMillis fun main() { val origamiSolver = OrigamiSolver() val time = measureTimeMillis { println("number of dots after one fold: ${origamiSolver.countDotsAfterFirstFold()}") println("Final Layout is:\n${origamiSolver.foldLayoutEntirely()}") }...
0
Kotlin
0
1
6d474b30e5204d3bd9c86b50ed657f756a638b2b
3,596
aoc-2021
Apache License 2.0
src/main/kotlin/com/github/javadev/select/QuickSelect.kt
javadev
156,964,261
false
null
package com.github.javadev.select /** * Quickselect is a selection algorithm to find the kth smallest element * in an unordered list. It is related to the quicksort sorting algorithm */ /* public class QuickSelect { public Integer quickSelect(int[] array, int k) { return quickSelect(array, 0, array.length - ...
0
Kotlin
0
5
3f71122f1d88ee1d83acc049f9f5d44179c34147
3,142
classic-cherries-kotlin
Apache License 2.0
src/main/kotlin/com/zachjones/languageclassifier/core/DecisionTree.kt
zachtjones
184,465,284
false
{"Kotlin": 73431}
package com.zachjones.languageclassifier.core import com.zachjones.languageclassifier.attribute.Attribute import com.zachjones.languageclassifier.core.AbsoluteDecider.Companion.fromLanguage import com.zachjones.languageclassifier.entities.InputRow import com.zachjones.languageclassifier.entities.LanguageDecision impor...
0
Kotlin
0
1
dfe8710fcf8daa1bc57ad90f7fa3c07a228b819f
8,352
Multi-Language-Classifier
Apache License 2.0
src/main/Day08.kt
lifeofchrome
574,709,665
false
{"Kotlin": 19233}
package main import readInput fun main() { val input = readInput("Day08") val day08 = Day08(input) println("Part 1: " + day08.part1()) println("Part 2: " + day08.part2()) } class Day08(input: List<String>) { private var map: List<List<Int>> init { val tmp = mutableListOf<MutableList<...
0
Kotlin
0
0
6c50ea2ed47ec6e4ff8f6f65690b261a37c00f1e
3,126
aoc2022
Apache License 2.0
src/main/kotlin/day4/Aoc.kt
widarlein
225,589,345
false
null
package day4 fun main(args: Array<String>) { if (args.isEmpty()) { println("Must provide input program") System.exit(0) } val (rangeStart, rangeStop) = args[0].split("-") val validPasswords = countValidPart1Passwords(rangeStart, rangeStop) println("Number of valid part1 passwords ...
0
Kotlin
0
0
b4977e4a97ad61177977b8eeb1dcf298067e8ab4
4,166
AdventOfCode2019
MIT License
src/main/kotlin/io/github/lawseff/aoc2023/matrix/MatrixProblemSolver.kt
lawseff
573,226,851
false
{"Kotlin": 37196}
package io.github.lawseff.aoc2023.matrix import io.github.lawseff.aoclib.Day import io.github.lawseff.aoclib.PartOne import io.github.lawseff.aoclib.PartTwo import java.util.LinkedList import java.util.Queue data class Gear(val partNumbers: List<Int>) @Day(3) // TODO split into classes and refactor the spaghetti cod...
0
Kotlin
0
0
b60ab611aec7bb332b8aa918aa7c23a43a3e61c8
3,929
advent-of-code-2023
MIT License
src/year2015/day23/Day23.kt
lukaslebo
573,423,392
false
{"Kotlin": 222221}
package year2015.day23 import readInput fun main() { // test if implementation meets criteria from the description, like: val input = readInput("2015", "Day23") println(part1(input)) println(part2(input)) } private fun part1(input: List<String>): Int { val computer = Computer(input.toInstructions...
0
Kotlin
0
1
f3cc3e935bfb49b6e121713dd558e11824b9465b
3,347
AdventOfCode
Apache License 2.0
src/day24/day24.kt
kacperhreniak
572,835,614
false
{"Kotlin": 85244}
package day24 import readInput private fun parse(input: List<String>): Array<Array<Item>> { val board = Array(input.size) { Array<Item>(input[0].length) { Item.Free } } // first line for ((index, item) in input[0].withIndex()) { board[0][index] = if (item == '#') { Item.Wall }...
0
Kotlin
1
0
03368ffeffa7690677c3099ec84f1c512e2f96eb
6,440
aoc-2022
Apache License 2.0
src/main/kotlin/days/Day14.kt
jgrgt
575,475,683
false
{"Kotlin": 94368}
package days import util.Line import util.MutableMatrix import util.Point class Day14Game2(input: List<String>) { val lines = input.flatMap { line -> line.split("->").map { it.trim() }.map { pointString -> val (x, y) = pointString.split(",").map { it.trim().toInt() } Point(x, y) ...
0
Kotlin
0
0
5174262b5a9fc0ee4c1da9f8fca6fb86860188f4
6,102
aoc2022
Creative Commons Zero v1.0 Universal
src/main/kotlin/engine/pathfinding/algorithms/AStarPathFinder.kt
CozmicGames
580,563,255
false
{"Kotlin": 612441}
package engine.pathfinding.algorithms import com.cozmicgames.utils.collections.Array2D import com.cozmicgames.utils.collections.PriorityList import com.cozmicgames.utils.concurrency.threadLocal import engine.pathfinding.* import engine.pathfinding.algorithms.heurisitcs.ClosestHeuristic import kotlin.math.max class AS...
0
Kotlin
0
0
d85d016431fb0490dcb6b125be5fd285e409bfc4
6,254
Sandbox2D
MIT License
Algorithm/src/main/kotlin/programmers/level1/personalInfoCollectionValidityPeriod.kt
getupminaaa
740,836,169
false
{"Kotlin": 28293}
import java.util.* fun main() { val solution = Solution() val terms: Array<String> = arrayOf("A 6", "B 12", "C 3") val privacies: Array<String> = arrayOf("2021.05.02 A", "2021.07.01 B", "2022.02.19 C", "2022.02.20 C") solution.solution(today = "2022.05.19", terms, privacies) } class Solution { fu...
0
Kotlin
0
0
01187e280c375dca95ba26d80368f8a162610568
1,443
Algorithm
MIT License
year2020/day01/part1/src/main/kotlin/com/curtislb/adventofcode/year2020/day01/part1/Year2020Day01Part1.kt
curtislb
226,797,689
false
{"Kotlin": 2146738}
/* --- Day 1: Report Repair --- After saving Christmas five years in a row, you've decided to take a vacation at a nice resort on a tropical island. Surely, Christmas will go on without you. The tropical island has its own currency and is entirely cash-only. The gold coins used there have a little picture of a starfi...
0
Kotlin
1
1
6b64c9eb181fab97bc518ac78e14cd586d64499e
2,125
AdventOfCode
MIT License
src/main/kotlin/com/lucaszeta/adventofcode2020/day03/day03.kt
LucasZeta
317,600,635
false
null
package com.lucaszeta.adventofcode2020.day03 import com.lucaszeta.adventofcode2020.ext.getResourceAsText fun findTreesForSlope( mountain: Mountain, slope: Slope ) = mountain.countTrees(slope) fun multiplyTreeForAllSlopes( mountain: Mountain, slopes: List<Slope> ) = slopes .map { mountain.countTre...
0
Kotlin
0
1
9c19513814da34e623f2bec63024af8324388025
946
advent-of-code-2020
MIT License
app/src/main/java/com/benjaminearley/droidbot/Omni.kt
BenjaminEarley
96,455,906
false
null
package com.benjaminearley.droidbot import java.lang.Math.PI import java.lang.Math.abs import java.lang.Math.cos import java.lang.Math.sin import java.lang.Math.sqrt val tau = PI.toFloat() * 2.0f val numWheels = 3 val xUnit = Vector3(1.0f, 0.0f, 0.0f) val yUnit = Vector3(0.0f, 1.0f, 0.0f) val zUnit = Vector3(0.0f, 0...
0
Kotlin
0
1
bb76a3e6f91c092a3915bd27aca90431df4463f2
3,651
DroidBot
MIT License
src/Day01.kt
AlaricLightin
572,897,551
false
{"Kotlin": 87366}
fun main() { fun part1(inputFilename: String): Int { var result = 0 var currentSum = 0 getInputFile(inputFilename).forEachLine { if (it.isNotBlank()) { currentSum += it.toInt() } else { if (currentSum > result) ...
0
Kotlin
0
0
ee991f6932b038ce5e96739855df7807c6e06258
1,214
AdventOfCode2022
Apache License 2.0
src/main/kotlin/day22/Day22.kt
daniilsjb
572,664,294
false
{"Kotlin": 69004}
package day22 import java.io.File fun main() { val data = parse("src/main/kotlin/day22/Day22.txt") val answer1 = part1(data) val answer2 = part2(data) println("🎄 Day 22 🎄") println() println("[Part 1]") println("Answer: $answer1") println() println("[Part 2]") println("...
0
Kotlin
0
0
6f0d373bdbbcf6536608464a17a34363ea343036
12,075
advent-of-code-2022
MIT License
src/main/kotlin/adventofcode/y2021/Day06.kt
Tasaio
433,879,637
false
{"Kotlin": 117806}
import adventofcode.* import java.math.BigInteger fun main() { val testInput = "3,4,3,1,2" val test = Day06(testInput) println("TEST: " + test.part1()) val day = Day06() println(day.part1()) day.reset() println(day.part2()) } open class Day06(staticInput: String? = null) : Y2021Day(6, sta...
0
Kotlin
0
0
cc72684e862a782fad78b8ef0d1929b21300ced8
1,454
adventofcode2021
The Unlicense
src/day19/day19.kt
kacperhreniak
572,835,614
false
{"Kotlin": 85244}
package day19 import readInput import java.lang.Math.ceil import java.lang.Math.max private fun parse(input: List<String>): List<Blueprint> { return input.map { line -> val parts = line.split(": ", ". ") val ore = parts[1].split(" ")[4].toInt().let { Item.Ore(it) } val clay = parts[2].spl...
0
Kotlin
1
0
03368ffeffa7690677c3099ec84f1c512e2f96eb
6,385
aoc-2022
Apache License 2.0
puzzles/kotlin/src/surface/surface.kt
charlesfranciscodev
179,561,845
false
{"Python": 141140, "Java": 34848, "Kotlin": 33981, "C++": 27526, "TypeScript": 22844, "C#": 22075, "Go": 12617, "JavaScript": 11282, "Ruby": 6255, "Swift": 3911, "Shell": 3090, "Haskell": 1375, "PHP": 1126, "Perl": 667, "C": 493}
import java.util.Scanner import java.util.ArrayDeque const val LAND = '#' const val WATER = 'O' const val DEFAULT_INDEX = -1 fun main(args : Array<String>) { val grid = Grid() grid.readGameInput() grid.test() } data class Square(val x: Int, val y: Int, val terrain: Char, var lakeIndex: Int = DEFAULT_INDEX) cl...
0
Python
19
45
3ec80602e58572a0b7baf3a2829a97e24ca3460c
2,433
codingame
MIT License
src/Day04.kt
zoidfirz
572,839,149
false
{"Kotlin": 15878}
fun main() { partOneSolution() partTwoSolution() } private fun partOneSolution() { val data = readInput("main/resources/Day04_input") var counter = 0 data.forEach { chunk -> // separate the input into separate arrays val (one, two) = chunk.split(",") val (groupOneStart, grou...
0
Kotlin
0
0
e955c1c08696f15929aaf53731f2ae926c585ff3
1,381
kotlin-advent-2022
Apache License 2.0
src/main/kotlin/adventOfCode2023/Day17.kt
TetraTsunami
726,140,343
false
{"Kotlin": 80024}
package adventOfCode2023 import util.* import util.templates.Grid2D import util.templates.Vector2D import java.util.* @Suppress("unused") class Day17(input: String, context: RunContext = RunContext.PROD) : Day(input, context) { override fun solve() { // we're going to come back to this later a(0, 0...
0
Kotlin
0
0
78d1b5d1c17122fed4f4e0a25fdacf1e62c17bfd
2,825
AdventOfCode2023
Apache License 2.0
app/src/main/java/com/betulnecanli/kotlindatastructuresalgorithms/Complexity/SpaceComplexity/SpaceComplexity.kt
betulnecanli
568,477,911
false
{"Kotlin": 167849}
package com.betulnecanli.kotlindatastructuresalgorithms.Complexity.SpaceComplexity fun main(){ //The time complexity of an algorithm isn't the only performance metric against which //algorithms are ranked. Another important metric is its space complexity, which is a //measure of the amount of memory it use...
2
Kotlin
2
40
70a4a311f0c57928a32d7b4d795f98db3bdbeb02
2,543
Kotlin-Data-Structures-Algorithms
Apache License 2.0
src/main/kotlin/Lambdas+HigherOrderFunctions.kt
Muhammad-Shayan-Haider
611,615,684
false
null
import kotlin.math.pow fun main() { // Function stored in variable. Can be passed as argument as well. var fn: (a: Double, b: Double) -> Double = ::sum println(fn(2.0, 3.0)) fn = ::power println(fn(2.0, 3.0)) calculator(2.0, 4.0, fn) // Lambda functions are anonymous functions, which don...
0
Kotlin
0
0
676c8698e8a910534f0d43ed4ab5e7231b83ab60
1,544
kotlin-learning
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/BeautifulArray.kt
ashtanko
203,993,092
false
{"Kotlin": 5856223, "Shell": 1168, "Makefile": 917}
/* * Copyright 2020 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
4
Kotlin
0
19
776159de0b80f0bdc92a9d057c852b8b80147c11
1,842
kotlab
Apache License 2.0
core/src/main/java/com/facebook/ktfmt/TypeNameClassifier.kt
cortinico
327,287,787
true
{"Kotlin": 284311, "Java": 30226, "Shell": 1655}
/* * Copyright 2015 Google Inc. * * 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 ...
2
null
1
1
3b168867acbd34aeb55f83f51416969bc87ac3ed
4,485
ktfmt
Apache License 2.0
neuro/src/main/java/com/bukalapak/neuro/AxonBranch.kt
bukalapak
167,192,746
false
null
package com.bukalapak.neuro class AxonBranch private constructor( private val id: String?, private val priority: Int, val expression: String, val action: SignalAction ) : Comparable<AxonBranch> { constructor( expression: String, action: SignalAction ) : this(null, DEFAULT_PRIOR...
0
Kotlin
6
24
b6707ad6f682bbd929febdd39054f10c57b1b12d
2,392
neuro
Apache License 2.0
src/main/kotlin/com/polydus/aoc18/Day11.kt
Polydus
160,193,832
false
null
package com.polydus.aoc18 class Day11: Day(11){ //https://adventofcode.com/2018/day/11 val map = Array(300) {IntArray(300)} init { val input = input[0].toInt() for(y in 1 until map.size + 1){ for(x in 1 until map.size + 1){ //map[y][x] = -1 i...
0
Kotlin
0
0
e510e4a9801c228057cb107e3e7463d4a946bdae
3,217
advent-of-code-2018
MIT License
src/main/kotlin/Main.kt
BrightOS
618,267,574
false
null
import java.io.File fun parseInputFile(file: File): Pair<ArrayList<Process>, Int> { var resultNumberOfTicks = 0 val list = arrayListOf<Process>().apply { file.forEachLine { it.split(" ").let { add( Process( name = it[0], ...
0
Kotlin
0
0
7f4a263277becf1a86392369d83a6a48f81cf7c4
2,382
os_3
Apache License 2.0
2022/Day05/problems.kt
moozzyk
317,429,068
false
{"Rust": 102403, "C++": 88189, "Python": 75787, "Kotlin": 72672, "OCaml": 60373, "Haskell": 53307, "JavaScript": 51984, "Go": 49768, "Scala": 46794}
import java.io.File import java.util.ArrayDeque import kotlin.collections.indexOf fun main(args: Array<String>) { val lines = File(args[0]).readLines() val separatorIdx = lines.indexOf("") val stackLines = lines.subList(0, separatorIdx) val moveLines = lines.subList(separatorIdx + 1, lines.size) pr...
0
Rust
0
0
c265f4c0bddb0357fe90b6a9e6abdc3bee59f585
1,842
AdventOfCode
MIT License