kt_path stringlengths 35 167 | kt_source stringlengths 626 28.9k | classes listlengths 1 17 |
|---|---|---|
AnushaSankara__icfp-2019__93fb25e/kotlin/src/main/kotlin/icfp2019/app.kt | package icfp2019
import java.io.File
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
fun main() {
val workingDir: Path = Paths.get("")
val solutions = mutableListOf<Solution>()
readZipFile(File("problems.zip"))
.filter { it.file.isFile }
.forEach {
val proble... | [
{
"class_path": "AnushaSankara__icfp-2019__93fb25e/icfp2019/AppKt.class",
"javap": "Compiled from \"app.kt\"\npublic final class icfp2019.AppKt {\n public static final void main();\n Code:\n 0: ldc #8 // String\n 2: iconst_0\n 3: anewarray #10 ... |
toukovk__24-solver__2c87897/src/main/kotlin/solver/model.kt | package solver
import java.lang.RuntimeException
import kotlin.math.abs
interface ExpressionItem
enum class Operator : ExpressionItem {
ADD { override fun apply(a1: Double, a2: Double) = a1 + a2 },
MINUS { override fun apply(a1: Double, a2: Double) = a1 - a2 },
TIMES { override fun apply(a1: Double, a2: ... | [
{
"class_path": "toukovk__24-solver__2c87897/solver/ModelKt.class",
"javap": "Compiled from \"model.kt\"\npublic final class solver.ModelKt {\n public static final double evalPrefixExpression(java.util.List<? extends solver.ExpressionItem>);\n Code:\n 0: aload_0\n 1: ldc #10 ... |
hairyOwl__AndroidStudy__278c8d7/Kotlin/code/FirstAPP/app/src/main/java/com/example/firstapp/lesson/Caculator.kt | package com.example.firstapp.lesson
import java.lang.Exception
/**
*@author: hairly owl
*@time:2021/10/13 21:22
*@version: 1.00
*@description: 一次四则运算计算机器
*/
fun main() {
while(true){
println("==========请输入你的表达式==========")
//接受控制台输入数据
val input:String? = readLine() //判空的校验
tr... | [
{
"class_path": "hairyOwl__AndroidStudy__278c8d7/com/example/firstapp/lesson/CaculatorKt.class",
"javap": "Compiled from \"Caculator.kt\"\npublic final class com.example.firstapp.lesson.CaculatorKt {\n public static final void main();\n Code:\n 0: nop\n 1: ldc #10 /... |
pope__advent-of-code-2023-kotlin__cb2862a/day01/src/main/kotlin/com/shifteleven/adventofcode2023/day01/App.kt | package com.shifteleven.adventofcode2023.day01
import kotlin.math.min
fun main() {
part1()
part2()
}
fun part1() {
val lines = object {}.javaClass.getResourceAsStream("/input.txt")!!.bufferedReader().readLines()
val sum =
lines
.stream()
.mapToInt({ line ->
var tens: Int? = null
var ones = 0
... | [
{
"class_path": "pope__advent-of-code-2023-kotlin__cb2862a/com/shifteleven/adventofcode2023/day01/AppKt.class",
"javap": "Compiled from \"App.kt\"\npublic final class com.shifteleven.adventofcode2023.day01.AppKt {\n public static final void main();\n Code:\n 0: invokestatic #9 //... |
pope__advent-of-code-2023-kotlin__cb2862a/day02/src/main/kotlin/com/shifteleven/adventofcode2023/day02/App.kt | package com.shifteleven.adventofcode2023.day02
import java.io.StreamTokenizer
import java.io.StringReader
import kotlin.assert
import kotlin.math.max
data class Game(val id: Int, val views: List<IntArray>)
fun main() {
val lines = object {}.javaClass.getResourceAsStream("/input.txt")!!.bufferedReader().readLines()
... | [
{
"class_path": "pope__advent-of-code-2023-kotlin__cb2862a/com/shifteleven/adventofcode2023/day02/AppKt.class",
"javap": "Compiled from \"App.kt\"\npublic final class com.shifteleven.adventofcode2023.day02.AppKt {\n public static final void main();\n Code:\n 0: new #8 //... |
tpoujol__aoc-2021__6d474b3/src/main/kotlin/puzzle13/OrigamiSolver.kt | 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()}")
}... | [
{
"class_path": "tpoujol__aoc-2021__6d474b3/puzzle13/OrigamiSolverKt.class",
"javap": "Compiled from \"OrigamiSolver.kt\"\npublic final class puzzle13.OrigamiSolverKt {\n public static final void main();\n Code:\n 0: new #8 // class puzzle13/OrigamiSolver\n 3: dup\... |
tpoujol__aoc-2021__6d474b3/src/main/kotlin/puzzle3/BinaryDiagnostic.kt | package puzzle3
import kotlin.math.pow
import kotlin.math.roundToInt
fun main() {
println("Hello World!")
val binaryDiagnostic = BinaryDiagnostic()
println("Power consumption is: ${binaryDiagnostic.findPowerConsumption()}, ${binaryDiagnostic.findLifeSupportRating()}")
}
class BinaryDiagnostic {
pri... | [
{
"class_path": "tpoujol__aoc-2021__6d474b3/puzzle3/BinaryDiagnosticKt.class",
"javap": "Compiled from \"BinaryDiagnostic.kt\"\npublic final class puzzle3.BinaryDiagnosticKt {\n public static final void main();\n Code:\n 0: ldc #8 // String Hello World!\n 2: getsta... |
tpoujol__aoc-2021__6d474b3/src/main/kotlin/puzzle2/SubCommand.kt | package puzzle2
fun main() {
println("Hello World!")
val subCommand = SubCommand()
println("Result is: ${subCommand.pilotSub()}, ${subCommand.pilotSubWithAim()}")
}
enum class Command {
forward,
down,
up
}
data class Position (val horizontal: Int, val depth: Int, val aim: Int = 0)
class Sub... | [
{
"class_path": "tpoujol__aoc-2021__6d474b3/puzzle2/SubCommandKt.class",
"javap": "Compiled from \"SubCommand.kt\"\npublic final class puzzle2.SubCommandKt {\n public static final void main();\n Code:\n 0: ldc #8 // String Hello World!\n 2: getstatic #14 ... |
tpoujol__aoc-2021__6d474b3/src/main/kotlin/puzzle10/SyntaxScorer.kt | package puzzle10
import java.lang.IllegalStateException
import kotlin.system.measureTimeMillis
fun main() {
val syntaxScorer = SyntaxScorer()
val time = measureTimeMillis {
println("Bad line scoring: ${syntaxScorer.fixBrokenLines()}")
println("Incomplete line scoring: ${syntaxScorer.fixIncomp... | [
{
"class_path": "tpoujol__aoc-2021__6d474b3/puzzle10/SyntaxScorer$Companion$LineProblem$IncompleteLineProblem.class",
"javap": "Compiled from \"SyntaxScorer.kt\"\npublic final class puzzle10.SyntaxScorer$Companion$LineProblem$IncompleteLineProblem extends puzzle10.SyntaxScorer$Companion$LineProblem {\n pri... |
tpoujol__aoc-2021__6d474b3/src/main/kotlin/puzzle7/WhaleBuster.kt | package puzzle7
import kotlin.math.abs
import kotlin.math.floor
import kotlin.math.roundToInt
import kotlin.system.measureTimeMillis
fun main() {
val whaleBuster = WhaleBuster()
val time = measureTimeMillis {
println("Minimal fuel consumption is: ${whaleBuster.findCrabAlignment()}")
println("T... | [
{
"class_path": "tpoujol__aoc-2021__6d474b3/puzzle7/WhaleBusterKt.class",
"javap": "Compiled from \"WhaleBuster.kt\"\npublic final class puzzle7.WhaleBusterKt {\n public static final void main();\n Code:\n 0: new #8 // class puzzle7/WhaleBuster\n 3: dup\n 4: ... |
tpoujol__aoc-2021__6d474b3/src/main/kotlin/puzzle8/SevenSegmentsDemystifier.kt | package puzzle8
import kotlin.math.pow
import kotlin.system.measureTimeMillis
fun main() {
val sevenSegmentsDemystifier = SevenSegmentsDemystifier()
val basicDigitWiring = DigitWiring()
val time = measureTimeMillis {
println("test: ${basicDigitWiring.findNumber("acf")}")
println("Part 1 so... | [
{
"class_path": "tpoujol__aoc-2021__6d474b3/puzzle8/SevenSegmentsDemystifier.class",
"javap": "Compiled from \"SevenSegmentsDemystifier.kt\"\npublic final class puzzle8.SevenSegmentsDemystifier {\n private final java.util.List<puzzle8.InputEntry> input;\n\n public puzzle8.SevenSegmentsDemystifier();\n ... |
hudsonb__turf.kt__e39bf4f/src/main/kotlin/turfkt/Conversions.kt | package turfkt
/**
* Earth Radius used with the Harvesine formula and approximates using a spherical (non-ellipsoid) Earth.
*/
const val EARTH_RADIUS = 6371008.8
/**
* Unit of measurement factors using a spherical (non-ellipsoid) earth radius.
*/
private val factors = mapOf(
"centimeters" to EARTH_RADIUS * 10... | [
{
"class_path": "hudsonb__turf.kt__e39bf4f/turfkt/ConversionsKt.class",
"javap": "Compiled from \"Conversions.kt\"\npublic final class turfkt.ConversionsKt {\n public static final double EARTH_RADIUS;\n\n private static final java.util.Map<java.lang.String, java.lang.Double> factors;\n\n public static fi... |
aesdeef__kotlin-basics-projects__1475a20/simple-tic-tac-toe/Main.kt | package tictactoe
import kotlin.math.abs
typealias Board = List<List<Char>>
enum class GameState {
IMPOSSIBLE,
X_WINS,
O_WINS,
DRAW,
NOT_FINISHED,
}
fun main() {
val input = "_________"
var board = input.chunked(3).map { it.toList() }
printBoard(board)
for (player in "XOXOXOXOX"... | [
{
"class_path": "aesdeef__kotlin-basics-projects__1475a20/tictactoe/MainKt$WhenMappings.class",
"javap": "Compiled from \"Main.kt\"\npublic final class tictactoe.MainKt$WhenMappings {\n public static final int[] $EnumSwitchMapping$0;\n\n static {};\n Code:\n 0: invokestatic #14 /... |
Onuchin-Artem__k-Loops__ee076b3/src/main/kotlin/kLoops/examples/island.kt | package kLoops.examples
typealias Point = Pair<Int, Int>
data class World(val landPoints: Set<Point>, val height: Int, val width: Int) {
fun print() {
(0 until height).forEach { row ->
(0 until width).forEach { column ->
val value = if (landPoints.contains(Point(row, column))) ... | [
{
"class_path": "Onuchin-Artem__k-Loops__ee076b3/kLoops/examples/IslandKt.class",
"javap": "Compiled from \"island.kt\"\npublic final class kLoops.examples.IslandKt {\n private static final java.util.Map<kLoops.examples.World, java.lang.Integer> memmoization;\n\n public static final boolean isPerfectIslan... |
ghonix__Problems__25d4ba0/src/main/kotlin/graph/Graph.kt | package graph
import java.util.*
import kotlin.collections.HashMap
import kotlin.collections.HashSet
class Graph {
companion object {
@JvmStatic
fun createAdjacencyList(edges: Array<Pair<String, String>>): Map<String, Set<String>> {
val graph = HashMap<String, MutableSet<String>>()
... | [
{
"class_path": "ghonix__Problems__25d4ba0/graph/Graph$Companion.class",
"javap": "Compiled from \"Graph.kt\"\npublic final class graph.Graph$Companion {\n private graph.Graph$Companion();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n... |
ghonix__Problems__25d4ba0/src/main/kotlin/arrays/NumberOfIslands.kt | package arrays
import java.util.LinkedList
import java.util.Queue
class NumberOfIslands {
data class Coordinate(val row: Int, val col: Int)
fun numIslands(grid: Array<CharArray>): Int {
val visited = HashSet<Coordinate>()
var islandsFound = 0
for (row in grid.indices) {
... | [
{
"class_path": "ghonix__Problems__25d4ba0/arrays/NumberOfIslands.class",
"javap": "Compiled from \"NumberOfIslands.kt\"\npublic final class arrays.NumberOfIslands {\n public arrays.NumberOfIslands();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<i... |
ghonix__Problems__25d4ba0/src/main/kotlin/string/IsNumer.kt | package string
/**
* https://leetcode.com/problems/valid-number/description/
*/
class IsNumer {
enum class TokenType {
DIGIT,
SIGN,
DOT,
EXPONENT,
INVALID
}
private val dfa = hashMapOf(
Pair(0, hashMapOf(Pair(TokenType.DIGIT, 1), Pair(TokenType.SIGN, 2), P... | [
{
"class_path": "ghonix__Problems__25d4ba0/string/IsNumerKt.class",
"javap": "Compiled from \"IsNumer.kt\"\npublic final class string.IsNumerKt {\n public static final void main();\n Code:\n 0: new #8 // class string/IsNumer\n 3: dup\n 4: invokespecial #11 ... |
ghonix__Problems__25d4ba0/src/main/kotlin/string/MinimumWindowSubstring.kt | package string
/*
https://leetcode.com/problems/minimum-window-substring/
*/
class MinimumWindowSubstring {
val tMap = HashMap<Char, Int>()
private fun isAcceptable(map: HashMap<Char, Int>): Boolean {
for (key in map.keys) {
if (map[key]!! > 0) {
return false
}... | [
{
"class_path": "ghonix__Problems__25d4ba0/string/MinimumWindowSubstring.class",
"javap": "Compiled from \"MinimumWindowSubstring.kt\"\npublic final class string.MinimumWindowSubstring {\n private final java.util.HashMap<java.lang.Character, java.lang.Integer> tMap;\n\n public string.MinimumWindowSubstrin... |
ghonix__Problems__25d4ba0/src/main/kotlin/prefixSum/MinSubArrayLen.kt | package prefixSum
import kotlin.math.min
/*
https://leetcode.com/problems/minimum-size-subarray-sum/
*/
class MinSubArrayLen {
fun minSubArrayLen(target: Int, nums: IntArray): Int {
if (nums.isEmpty()) {
return 0
}
var minSize = Int.MAX_VALUE
val prefixSums = IntArray(n... | [
{
"class_path": "ghonix__Problems__25d4ba0/prefixSum/MinSubArrayLenKt.class",
"javap": "Compiled from \"MinSubArrayLen.kt\"\npublic final class prefixSum.MinSubArrayLenKt {\n public static final void main();\n Code:\n 0: new #8 // class prefixSum/MinSubArrayLen\n 3... |
ghonix__Problems__25d4ba0/src/main/kotlin/tree/segmentTree/SubsetSum.kt | package tree.segmentTree
import kotlin.math.*
class SubsetSum(list: Array<Int>) {
private var segmentTree: IntArray
override fun toString(): String {
return segmentTree.contentToString()
}
init {
val height = ceil(log(list.size.toDouble(), 2.0))
val maxSize = (height + 1).pow... | [
{
"class_path": "ghonix__Problems__25d4ba0/tree/segmentTree/SubsetSum.class",
"javap": "Compiled from \"SubsetSum.kt\"\npublic final class tree.segmentTree.SubsetSum {\n public static final tree.segmentTree.SubsetSum$Companion Companion;\n\n private int[] segmentTree;\n\n public tree.segmentTree.SubsetSu... |
jabrena__advent-of-code-2019__60f2e41/src/main/kotlin/day1/RocketEquation.kt | package day1
import kotlin.math.floor
/**
*
* --- Day 1: The Tyranny of the Rocket Equation ---
* Santa has become stranded at the edge of the Solar System while delivering presents to other planets! To accurately calculate his position in space, safely align his warp drive, and return to Earth in time to save Chr... | [
{
"class_path": "jabrena__advent-of-code-2019__60f2e41/day1/RocketEquation.class",
"javap": "Compiled from \"RocketEquation.kt\"\npublic final class day1.RocketEquation {\n private final java.lang.String FUEL_INPUT_FILE;\n\n private final java.util.List<java.lang.String> readInputFile;\n\n private final ... |
leokash__neuralnet__d243588/src/main/kotlin/com/nlkprojects/neuralnet/math/rational/Rational.kt | package com.nlkprojects.neuralnet.math.rational
import java.lang.RuntimeException
data class Rational(val numerator: Long, val denominator: Long): Number(), Comparable<Rational> {
constructor(num: Int): this(num, num)
constructor(num: Long): this(num, num)
constructor(num: Int, den: Int): this(num.toLong(... | [
{
"class_path": "leokash__neuralnet__d243588/com/nlkprojects/neuralnet/math/rational/RationalKt.class",
"javap": "Compiled from \"Rational.kt\"\npublic final class com.nlkprojects.neuralnet.math.rational.RationalKt {\n public static final void main();\n Code:\n 0: getstatic #12 ... |
BenjiDayan__hello_kotlin__cde700c/src/pj_euler/pj57.kt | package pj_euler
import kotlin.math.floor
import kotlin.math.sqrt
import kotlin.comparisons.minOf
import kotlin.comparisons.maxOf
import java.math.BigInteger
import kotlin.Boolean
//TODO pj 64
fun main(args: Array<String>) {
val frac = Fraction(BigInteger.valueOf(6), BigInteger.valueOf(4))
println(frac)
fr... | [
{
"class_path": "BenjiDayan__hello_kotlin__cde700c/pj_euler/Pj57Kt.class",
"javap": "Compiled from \"pj57.kt\"\npublic final class pj_euler.Pj57Kt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invo... |
intresrl__kata-pulta__0531086/kotlin/src/Wardrobe/sal/SalWardrobe.kt | package wardrobe.sal
typealias Width = Int
typealias Price = Int
fun combinations(
goal: Width = 250,
availableSizes: List<Width> = listOf(50, 75, 100, 120)
): Set<List<Width>> =
if (goal == 0)
setOf(emptyList())
else
availableSizes
.filter { it <= goal }
.flatM... | [
{
"class_path": "intresrl__kata-pulta__0531086/wardrobe/sal/SalWardrobeKt$main$$inlined$sortedByDescending$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class wardrobe.sal.SalWardrobeKt$main$$inlined$sortedByDescending$1<T> implements java.util.Comparator {\n public wardrobe.sal.SalWar... |
vubogovich__kickstart__fc694f8/src/kickstart2022/g/CuteLittleButterfly.kt | 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() }
... | [
{
"class_path": "vubogovich__kickstart__fc694f8/kickstart2022/g/CuteLittleButterflyKt.class",
"javap": "Compiled from \"CuteLittleButterfly.kt\"\npublic final class kickstart2022.g.CuteLittleButterflyKt {\n public static final void main();\n Code:\n 0: ldc #8 // String s... |
vubogovich__kickstart__fc694f8/src/kickstart2022/c/AntsOnStick.kt | package kickstart2022.c
// TODO test set 2
fun main() {
val inputFileName = "src/kickstart2022/c/AntsOnStick.in"
java.io.File(inputFileName).takeIf { it.exists() }?.also { System.setIn(it.inputStream()) }
for (case in 1..readLine()!!.toInt()) {
val (n, len) = readLine()!!.split(' ').map { it.toInt... | [
{
"class_path": "vubogovich__kickstart__fc694f8/kickstart2022/c/AntsOnStickKt$main$$inlined$sortedBy$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class kickstart2022.c.AntsOnStickKt$main$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public kickstart2022.c.AntsOnStickKt$ma... |
vubogovich__kickstart__fc694f8/src/kickstart2020/h/BoringNumbers.kt | package kickstart2020.h
import kotlin.math.max
private val power5 = Array(20) { 1L }
fun main() {
val inputFileName = "src/kickstart2020/h/BoringNumbers.in"
java.io.File(inputFileName).takeIf { it.exists() }?.also { System.setIn(it.inputStream()) }
for (i in 1 until power5.size) power5[i] = power5[i - 1... | [
{
"class_path": "vubogovich__kickstart__fc694f8/kickstart2020/h/BoringNumbersKt.class",
"javap": "Compiled from \"BoringNumbers.kt\"\npublic final class kickstart2020.h.BoringNumbersKt {\n private static final java.lang.Long[] power5;\n\n public static final void main();\n Code:\n 0: ldc ... |
vubogovich__kickstart__fc694f8/src/kickstart2020/c/Candies.kt | package kickstart2020.c
// TODO still slow
fun main() {
val inputFileName = "src/kickstart2020/c/Candies.in"
java.io.File(inputFileName).takeIf { it.exists() }?.also { System.setIn(it.inputStream()) }
for (case in 1..readLine()!!.toInt()) {
val (_, q) = readLine()!!.split(' ').map { it.toInt() }
... | [
{
"class_path": "vubogovich__kickstart__fc694f8/kickstart2020/c/CandiesKt.class",
"javap": "Compiled from \"Candies.kt\"\npublic final class kickstart2020.c.CandiesKt {\n public static final void main();\n Code:\n 0: ldc #8 // String src/kickstart2020/c/Candies.in\n ... |
wrabot__competitive-tools__fd2da26/src/main/kotlin/tools/graph/FloydWarshall.kt | package tools.graph
class FloydWarshall(size: Int, weights: Map<Pair<Int, Int>, Double>) {
val indices = 0 until size
val dist = Array(size) { DoubleArray(size) { Double.POSITIVE_INFINITY } }
val prev = Array(size) { Array<Int?>(size) { null } }
override fun toString() = dist.toList().map { it.toList(... | [
{
"class_path": "wrabot__competitive-tools__fd2da26/tools/graph/FloydWarshall.class",
"javap": "Compiled from \"FloydWarshall.kt\"\npublic final class tools.graph.FloydWarshall {\n private final kotlin.ranges.IntRange indices;\n\n private final double[][] dist;\n\n private final java.lang.Integer[][] pre... |
wrabot__competitive-tools__fd2da26/src/main/kotlin/tools/graph/ShortPath.kt | package tools.graph
fun <Node : Any> shortPath(
start: Node,
end: Node,
cost: (origin: Node, destination: Node) -> Double = { _, _ -> 1.0 },
estimatedEndCost: (Node) -> Double = { 0.0 }, // A*
neighbors: (Node) -> List<Node>
) = shortPath(start, isEnd = { this == end }, cost, estimatedEndCost, neig... | [
{
"class_path": "wrabot__competitive-tools__fd2da26/tools/graph/ShortPathKt.class",
"javap": "Compiled from \"ShortPath.kt\"\npublic final class tools.graph.ShortPathKt {\n public static final <Node> java.util.List<Node> shortPath(Node, Node, kotlin.jvm.functions.Function2<? super Node, ? super Node, java.... |
wrabot__competitive-tools__fd2da26/src/main/kotlin/tools/math/Modulo.kt | package tools.math
fun Long.times(multiplier: Long, modulo: Long): Long {
if (this < 0) error("negative multiplicand")
if (multiplier < 0) error("negative multiplier")
if (modulo < 0) error("negative modulo")
var res = 0L
var a = this % modulo
var b = multiplier % modulo
while (true) {
... | [
{
"class_path": "wrabot__competitive-tools__fd2da26/tools/math/ModuloKt.class",
"javap": "Compiled from \"Modulo.kt\"\npublic final class tools.math.ModuloKt {\n public static final long times(long, long, long);\n Code:\n 0: lload_0\n 1: lconst_0\n 2: lcmp\n 3: ifge 19\n... |
age-series__ElectricalAge2__86d843f/src/main/kotlin/org/eln2/mc/data/SegmentTree.kt | package org.eln2.mc.data
/**
* Represents the numeric range of a segment.
* @param min The lower boundary of this segment.
* @param max The upper boundary of this segment.
* [min] must be smaller than [max].
* */
data class ClosedInterval(val min: Double, val max: Double) {
val range get() = min..max
ini... | [
{
"class_path": "age-series__ElectricalAge2__86d843f/org/eln2/mc/data/SegmentTree.class",
"javap": "Compiled from \"SegmentTree.kt\"\npublic final class org.eln2.mc.data.SegmentTree<T> {\n private final org.eln2.mc.data.SegmentTreeNode<T> root;\n\n public org.eln2.mc.data.SegmentTree(org.eln2.mc.data.Segm... |
ldk123456__Introduction__8dc6bff/3/src/symbol/Symbol.kt | package symbol
fun main(args: Array<String>) {
val list = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
//总数操作符
println("=====总数操作符=====")
println("list.any{it > 10}: ${list.any { it > 10 }}")
println("list.all{it in 1..10}: ${list.all { it in 1..10 }}")
println("list.none { it > 10 }: ${list.none { i... | [
{
"class_path": "ldk123456__Introduction__8dc6bff/symbol/SymbolKt.class",
"javap": "Compiled from \"Symbol.kt\"\npublic final class symbol.SymbolKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: inv... |
DinaTuesta27__kotlin__ef8ce29/TallerRecursion/src/ean/estructuradedatos/taller/TallerRecursion.kt | package ean.estructuradedatos.taller
/**
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Universidad EAN (Bogotá - Colombia)
* Departamento de Sistemas
* Faculta de Ingeniería
*
* Taller Funciones Recursivas
* Fecha: 18 de abril de 2023
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | [
{
"class_path": "DinaTuesta27__kotlin__ef8ce29/ean/estructuradedatos/taller/TallerRecursionKt.class",
"javap": "Compiled from \"TallerRecursion.kt\"\npublic final class ean.estructuradedatos.taller.TallerRecursionKt {\n public static final int factorial(int);\n Code:\n 0: iload_0\n 1: iconst... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2013.kt | package leetcode
import kotlin.math.abs
/**
* https://leetcode.com/problems/detect-squares/
*/
class Problem2013 {
class DetectSquares() {
private val map = mutableMapOf<Int, MutableMap<Int, Int>>()
fun add(point: IntArray) {
val x = point[0]
val y = point[1]
... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2013.class",
"javap": "Compiled from \"Problem2013.kt\"\npublic final class leetcode.Problem2013 {\n public leetcode.Problem2013();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem1718.kt | package leetcode
/**
* https://leetcode.com/problems/construct-the-lexicographically-largest-valid-sequence/
*/
class Problem1718 {
fun constructDistancedSequence(n: Int): IntArray {
return constructDistancedSequence(n, 0, HashSet(), IntArray(n * 2 - 1)).array
}
private class Answer(val found: B... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem1718$Answer.class",
"javap": "Compiled from \"Problem1718.kt\"\nfinal class leetcode.Problem1718$Answer {\n private final boolean found;\n\n private final int[] array;\n\n public leetcode.Problem1718$Answer(boolean, int[]);\n Code:\n 0: ... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2192.kt | package leetcode
import java.util.*
/**
* https://leetcode.com/problems/all-ancestors-of-a-node-in-a-directed-acyclic-graph/
*/
class Problem2192 {
fun getAncestors(n: Int, edges: Array<IntArray>): List<List<Int>> {
val adjList = reverse(n, edges)
val answer = mutableListOf<List<Int>>()
... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2192.class",
"javap": "Compiled from \"Problem2192.kt\"\npublic final class leetcode.Problem2192 {\n public leetcode.Problem2192();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem1514.kt | package leetcode
import java.util.PriorityQueue
/**
* https://leetcode.com/problems/path-with-maximum-probability/
*/
class Problem1514 {
fun maxProbability(n: Int, edges: Array<IntArray>, succProb: DoubleArray, start: Int,
end: Int): Double {
val adjList = buildAdjList(n, edges, ... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem1514$Node.class",
"javap": "Compiled from \"Problem1514.kt\"\nfinal class leetcode.Problem1514$Node implements java.lang.Comparable<leetcode.Problem1514$Node> {\n private final int n;\n\n private final double prob;\n\n public leetcode.Problem1514... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2115.kt | package leetcode
/**
* https://leetcode.com/problems/find-all-possible-recipes-from-given-supplies/
*/
class Problem2115 {
fun findAllRecipes(recipes: Array<String>, ingredients: List<List<String>>, supplies: Array<String>): List<String> {
val recipeToIngredients = mutableMapOf<String, List<String>>()
... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2115.class",
"javap": "Compiled from \"Problem2115.kt\"\npublic final class leetcode.Problem2115 {\n public leetcode.Problem2115();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem1801.kt | package leetcode
import java.util.*
/**
* https://leetcode.com/problems/number-of-orders-in-the-backlog/
*/
class Problem1801 {
fun getNumberOfBacklogOrders(orders: Array<IntArray>): Int {
val buyMap = TreeMap<Int, Long> { a, b -> b.compareTo(a) }
val sellMap = TreeMap<Int, Long> { a, b -> a.com... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem1801.class",
"javap": "Compiled from \"Problem1801.kt\"\npublic final class leetcode.Problem1801 {\n public leetcode.Problem1801();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2049.kt | package leetcode
/**
* https://leetcode.com/problems/count-nodes-with-the-highest-score/
*/
class Problem2049 {
fun countHighestScoreNodes(parents: IntArray): Int {
val root = buildTree(parents)
val scores = mutableMapOf<Long, Int>()
countHighestScore(parents.size, root, scores)
v... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2049.class",
"javap": "Compiled from \"Problem2049.kt\"\npublic final class leetcode.Problem2049 {\n public leetcode.Problem2049();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2212.kt | package leetcode
/**
* https://leetcode.com/problems/maximum-points-in-an-archery-competition/
*/
class Problem2212 {
fun maximumBobPoints(numArrows: Int, aliceArrows: IntArray): IntArray {
val answer = Answer()
maximumBobPoints(numArrows, aliceArrows, IntArray(12), 0, 0, answer)
return a... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2212.class",
"javap": "Compiled from \"Problem2212.kt\"\npublic final class leetcode.Problem2212 {\n public leetcode.Problem2212();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2257.kt | package leetcode
/**
* https://leetcode.com/problems/count-unguarded-cells-in-the-grid/
*/
class Problem2257 {
fun countUnguarded(m: Int, n: Int, guards: Array<IntArray>, walls: Array<IntArray>): Int {
val grid = Array(m) { IntArray(n) { UNGUARDED } }
for ((r, c) in guards) {
grid[r][... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2257.class",
"javap": "Compiled from \"Problem2257.kt\"\npublic final class leetcode.Problem2257 {\n public static final leetcode.Problem2257$Companion Companion;\n\n private static final int GUARD;\n\n private static final int WALL;\n\n private... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem1878.kt | package leetcode
import java.util.TreeSet
/**
* https://leetcode.com/problems/get-biggest-three-rhombus-sums-in-a-grid/
*/
class Problem1878 {
fun getBiggestThree(grid: Array<IntArray>): IntArray {
val rightDiagonalSums = mutableMapOf<RowCol, Int>()
val maxRow = grid.size
val maxCol = if... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem1878$RowCol.class",
"javap": "Compiled from \"Problem1878.kt\"\nfinal class leetcode.Problem1878$RowCol {\n private final int row;\n\n private final int col;\n\n public leetcode.Problem1878$RowCol(int, int);\n Code:\n 0: aload_0\n ... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2231.kt | package leetcode
/**
* https://leetcode.com/problems/largest-number-after-digit-swaps-by-parity/
*/
class Problem2231 {
fun largestInteger(num: Int): Int {
val oddIndexes = mutableListOf<Int>()
val evenIndexes = mutableListOf<Int>()
val numString = num.toString()
for ((i, n) in nu... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2231.class",
"javap": "Compiled from \"Problem2231.kt\"\npublic final class leetcode.Problem2231 {\n public leetcode.Problem2231();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2055.kt | package leetcode
/**
* https://leetcode.com/problems/plates-between-candles/
*/
class Problem2055 {
fun platesBetweenCandles(s: String, queries: Array<IntArray>): IntArray {
val answer = IntArray(queries.size)
var startIndex = 0
while (startIndex < s.length && s[startIndex] != '|') {
... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2055.class",
"javap": "Compiled from \"Problem2055.kt\"\npublic final class leetcode.Problem2055 {\n public leetcode.Problem2055();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem1824.kt | package leetcode
import kotlin.math.min
/**
* https://leetcode.com/problems/minimum-sideway-jumps/
*/
class Problem1824 {
fun minSideJumps(obstacles: IntArray): Int {
return minSideJumps(obstacles, lane = 2, index = 0,
memo = Array(obstacles.size) { IntArray(4) { -1 } })
}
private f... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem1824.class",
"javap": "Compiled from \"Problem1824.kt\"\npublic final class leetcode.Problem1824 {\n public leetcode.Problem1824();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2012.kt | package leetcode
import kotlin.math.max
import kotlin.math.min
/**
* https://leetcode.com/problems/sum-of-beauty-in-the-array/
*/
class Problem2012 {
fun sumOfBeauties(nums: IntArray): Int {
val left = IntArray(nums.size)
for ((i, n) in nums.withIndex()) {
left[i] = if (i == 0) n els... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2012.class",
"javap": "Compiled from \"Problem2012.kt\"\npublic final class leetcode.Problem2012 {\n public leetcode.Problem2012();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2048.kt | package leetcode
import kotlin.math.min
/**
* https://leetcode.com/problems/next-greater-numerically-balanced-number/
*/
class Problem2048 {
fun nextBeautifulNumber(n: Int): Int {
var answer = Answer()
val s = n.toString()
val numbers = arrayOf("1", "22", "122", "333", "1333", "4444", "1... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2048$Answer.class",
"javap": "Compiled from \"Problem2048.kt\"\nfinal class leetcode.Problem2048$Answer {\n private int value;\n\n public leetcode.Problem2048$Answer(int);\n Code:\n 0: aload_0\n 1: invokespecial #9 ... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2182.kt | package leetcode
import java.util.PriorityQueue
/**
* https://leetcode.com/problems/construct-string-with-repeat-limit/
*/
class Problem2182 {
fun repeatLimitedString(s: String, repeatLimit: Int): String {
data class CharCount(val char: Char, val count: Int)
val array = IntArray(26)
for ... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2182$repeatLimitedString$CharCount.class",
"javap": "Compiled from \"Problem2182.kt\"\npublic final class leetcode.Problem2182$repeatLimitedString$CharCount {\n private final char char;\n\n private final int count;\n\n public leetcode.Problem2182... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2044.kt | package leetcode
/**
* https://leetcode.com/problems/count-number-of-maximum-bitwise-or-subsets/
*/
class Problem2044 {
fun countMaxOrSubsets(nums: IntArray): Int {
var max = 0
for (num in nums) {
max = max or num
}
var answer = 0
for (i in nums.indices) {
... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2044.class",
"javap": "Compiled from \"Problem2044.kt\"\npublic final class leetcode.Problem2044 {\n public leetcode.Problem2044();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2222.kt | package leetcode
/**
* https://leetcode.com/problems/number-of-ways-to-select-buildings/
*/
class Problem2222 {
fun numberOfWays(s: String): Long {
data class Binary(val zero: Int = 0, val one: Int = 0)
val left = Array(s.length) { Binary() }
for (i in s.indices) {
val zero = ... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2222.class",
"javap": "Compiled from \"Problem2222.kt\"\npublic final class leetcode.Problem2222 {\n public leetcode.Problem2222();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem1402.kt | package leetcode
import kotlin.math.max
/**
* https://leetcode.com/problems/reducing-dishes/
*/
class Problem1402 {
fun maxSatisfaction(satisfaction: IntArray): Int {
satisfaction.sort()
return maxSatisfaction(satisfaction, 0, 1, Array(satisfaction.size) {
IntArray(
s... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem1402.class",
"javap": "Compiled from \"Problem1402.kt\"\npublic final class leetcode.Problem1402 {\n public leetcode.Problem1402();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2064.kt | package leetcode
import kotlin.math.max
/**
* https://leetcode.com/problems/minimized-maximum-of-products-distributed-to-any-store/
*/
class Problem2064 {
fun minimizedMaximum(n: Int, quantities: IntArray): Int {
var min = 1
var max = quantities[0]
for (i in 1 until quantities.size) {
... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2064.class",
"javap": "Compiled from \"Problem2064.kt\"\npublic final class leetcode.Problem2064 {\n public leetcode.Problem2064();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem1438.kt | package leetcode
import java.util.*
import kotlin.math.max
/**
* https://leetcode.com/problems/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit/
*/
class Problem1438 {
fun longestSubarray(nums: IntArray, limit: Int): Int {
var answer = 1
val minDeque = LinkedList<Int>()... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem1438.class",
"javap": "Compiled from \"Problem1438.kt\"\npublic final class leetcode.Problem1438 {\n public leetcode.Problem1438();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2002.kt | package leetcode
import kotlin.math.max
/**
* https://leetcode.com/problems/maximum-product-of-the-length-of-two-palindromic-subsequences/
*/
class Problem2002 {
fun maxProduct(s: String): Int {
return maxProduct(s, 0, "", "")
}
private fun maxProduct(s: String, i: Int, word1: String, word2: St... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2002.class",
"javap": "Compiled from \"Problem2002.kt\"\npublic final class leetcode.Problem2002 {\n public leetcode.Problem2002();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2266.kt | package leetcode
/**
* https://leetcode.com/problems/count-number-of-texts/
*/
class Problem2266 {
fun countTexts(pressedKeys: String): Int {
if (pressedKeys.length == 1) {
return 1
}
var answer = 1L
var i = 0
var length = 1
val memo3 = IntArray(pressed... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2266.class",
"javap": "Compiled from \"Problem2266.kt\"\npublic final class leetcode.Problem2266 {\n public leetcode.Problem2266();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem1914.kt | package leetcode
/**
* https://leetcode.com/problems/cyclically-rotating-a-grid/
*/
class Problem1914 {
fun rotateGrid(grid: Array<IntArray>, k: Int): Array<IntArray> {
val maxRows: Int = grid.size
val maxCols: Int = if (grid.isNotEmpty()) grid[0].size else 0
var row = 0
var col =... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem1914.class",
"javap": "Compiled from \"Problem1914.kt\"\npublic final class leetcode.Problem1914 {\n public leetcode.Problem1914();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem1482.kt | package leetcode
import kotlin.math.max
import kotlin.math.min
/**
* https://leetcode.com/problems/minimum-number-of-days-to-make-m-bouquets/
*/
class Problem1482 {
fun minDays(bloomDay: IntArray, m: Int, k: Int): Int {
if (bloomDay.size < m * k) {
return -1
}
var min = Int.M... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem1482.class",
"javap": "Compiled from \"Problem1482.kt\"\npublic final class leetcode.Problem1482 {\n public leetcode.Problem1482();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem1895.kt | package leetcode
import kotlin.math.max
/**
* https://leetcode.com/problems/largest-magic-square/
*/
class Problem1895 {
fun largestMagicSquare(grid: Array<IntArray>): Int {
val maxRow = grid.size
val maxCol = if (maxRow > 0) grid[0].size else 0
val rowSums = Array(maxRow) { IntArray(max... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem1895.class",
"javap": "Compiled from \"Problem1895.kt\"\npublic final class leetcode.Problem1895 {\n public leetcode.Problem1895();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem2039.kt | package leetcode
import java.lang.Integer.max
import java.util.*
/**
* https://leetcode.com/problems/the-time-when-the-network-becomes-idle/
*/
class Problem2039 {
fun networkBecomesIdle(edges: Array<IntArray>, patience: IntArray): Int {
val adjList = buildAdjList(edges)
val queue = LinkedList<I... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem2039.class",
"javap": "Compiled from \"Problem2039.kt\"\npublic final class leetcode.Problem2039 {\n public leetcode.Problem2039();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem1462.kt | package leetcode
/**
* https://leetcode.com/problems/course-schedule-iv/
*/
class Problem1462 {
fun checkIfPrerequisite(numCourses: Int, prerequisites: Array<IntArray>,
queries: Array<IntArray>): List<Boolean> {
val adjList = buildAdjList(prerequisites)
val dependencyM... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem1462.class",
"javap": "Compiled from \"Problem1462.kt\"\npublic final class leetcode.Problem1462 {\n public leetcode.Problem1462();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem1604.kt | package leetcode
/**
* https://leetcode.com/problems/alert-using-same-key-card-three-or-more-times-in-a-one-hour-period/
*/
class Problem1604 {
fun alertNames(keyName: Array<String>, keyTime: Array<String>): List<String> {
val map = mutableMapOf<String, MutableList<String>>()
for (i in keyName.in... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem1604.class",
"javap": "Compiled from \"Problem1604.kt\"\npublic final class leetcode.Problem1604 {\n public leetcode.Problem1604();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
fredyw__leetcode__a59d77c/src/main/kotlin/leetcode/Problem1559.kt | package leetcode
/**
* https://leetcode.com/problems/detect-cycles-in-2d-grid/
*/
class Problem1559 {
fun containsCycle(grid: Array<CharArray>): Boolean {
val maxRow = grid.size
val maxCol = if (maxRow == 0) 0 else grid[0].size
val visited = Array(grid.size) { BooleanArray(maxCol) }
... | [
{
"class_path": "fredyw__leetcode__a59d77c/leetcode/Problem1559.class",
"javap": "Compiled from \"Problem1559.kt\"\npublic final class leetcode.Problem1559 {\n public leetcode.Problem1559();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V... |
EugenIvanushkin__kotlin-koans__321e41c/src/iii_conventions/MyDate.kt | package iii_conventions
import java.time.Month
data class MyDate(val year: Int, val month: Int, val dayOfMonth: Int) : Comparable<MyDate> {
override fun compareTo(date: MyDate): Int {
if (this.year.compareTo(date.year) == 0) {
if (this.month.compareTo(date.month) == 0) {
if (th... | [
{
"class_path": "EugenIvanushkin__kotlin-koans__321e41c/iii_conventions/MyDate.class",
"javap": "Compiled from \"MyDate.kt\"\npublic final class iii_conventions.MyDate implements java.lang.Comparable<iii_conventions.MyDate> {\n private final int year;\n\n private final int month;\n\n private final int da... |
quincy__euler-kotlin__01d96f6/src/main/kotlin/com/quakbo/euler/Euler9.kt | package com.quakbo.euler
/*
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a^2 + b^2 = c^2
For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
According to Wikipedia, every Pythagorean triplet is ... | [
{
"class_path": "quincy__euler-kotlin__01d96f6/com/quakbo/euler/Euler9Kt.class",
"javap": "Compiled from \"Euler9.kt\"\npublic final class com.quakbo.euler.Euler9Kt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String ar... |
quincy__euler-kotlin__01d96f6/src/main/kotlin/com/quakbo/euler/Euler6.kt | package com.quakbo.euler
/*
The sum of the squares of the first ten natural numbers is,
1^2 + 2^2 + ... + 10^2 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)^2 = 55^2 = 3025
Hence the difference between the sum of the squares of the first ten natural numbers and the square of t... | [
{
"class_path": "quincy__euler-kotlin__01d96f6/com/quakbo/euler/Euler6Kt.class",
"javap": "Compiled from \"Euler6.kt\"\npublic final class com.quakbo.euler.Euler6Kt {\n private static final int sumOfSquares(kotlin.sequences.Sequence<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: invokedynami... |
quincy__euler-kotlin__01d96f6/src/main/kotlin/com/quakbo/euler/Euler4.kt | package com.quakbo.euler
/*
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
*/
internal fun isPalindrome(n: Int): Boolean {
val s = n.toString()
ret... | [
{
"class_path": "quincy__euler-kotlin__01d96f6/com/quakbo/euler/Euler4Kt.class",
"javap": "Compiled from \"Euler4.kt\"\npublic final class com.quakbo.euler.Euler4Kt {\n public static final boolean isPalindrome(int);\n Code:\n 0: iload_0\n 1: invokestatic #12 // Method java/l... |
HLQ-Struggle__LeetCodePro__76922f4/src/com/hlq/leetcode/array/Question26.kt | package com.hlq.leetcode.array
/**
* @author HLQ_Struggle
* @date 2020/11/30
* @desc LeetCode 26. 删除排序数组中的重复项 https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/
*/
fun main() {
val nums = intArrayOf(0,0,1,1,1,2,2,3,3,4)
println("----> ${removeDuplicates(nums)}")
}
/**
* 双指针解法
*/
fun... | [
{
"class_path": "HLQ-Struggle__LeetCodePro__76922f4/com/hlq/leetcode/array/Question26Kt.class",
"javap": "Compiled from \"Question26.kt\"\npublic final class com.hlq.leetcode.array.Question26Kt {\n public static final void main();\n Code:\n 0: bipush 10\n 2: newarray int\n ... |
HLQ-Struggle__LeetCodePro__76922f4/src/com/hlq/leetcode/array/Question349.kt | package com.hlq.leetcode.array
/**
* @author HLQ_Struggle
* @date 2020/11/08
* @desc LeetCode 349. 两个数组的交集 https://leetcode-cn.com/problems/intersection-of-two-arrays/
*/
fun main() {
val nums1 = IntArray(4)
nums1[0] = 1
nums1[1] = 2
nums1[2] = 2
nums1[3] = 1
val nums2 = IntArray(2)
nu... | [
{
"class_path": "HLQ-Struggle__LeetCodePro__76922f4/com/hlq/leetcode/array/Question349Kt.class",
"javap": "Compiled from \"Question349.kt\"\npublic final class com.hlq.leetcode.array.Question349Kt {\n public static final void main();\n Code:\n 0: iconst_4\n 1: newarray int\n 3: a... |
HLQ-Struggle__LeetCodePro__76922f4/src/com/hlq/leetcode/array/Question1.kt | package com.hlq.leetcode.array
/**
* @author HLQ_Struggle
* @date 2020/11/09
* @desc LeetCode 1. 两数之和 https://leetcode-cn.com/problems/two-sum/
*/
fun main() {
val nums = intArrayOf(3, 2, 4)
val target = 6
// 暴力解法 一
twoSum(nums, target)
// 优化
twoSum2(nums, target)
twoSum3(nums, targe... | [
{
"class_path": "HLQ-Struggle__LeetCodePro__76922f4/com/hlq/leetcode/array/Question1Kt.class",
"javap": "Compiled from \"Question1.kt\"\npublic final class com.hlq.leetcode.array.Question1Kt {\n public static final void main();\n Code:\n 0: iconst_3\n 1: newarray int\n 3: astore_... |
HLQ-Struggle__LeetCodePro__76922f4/src/com/hlq/leetcode/array/Question14.kt | package com.hlq.leetcode.array
import java.util.*
/**
* @author HLQ_Struggle
* @date 2020/11/09
* @desc LeetCode 14. 最长公共前缀 https://leetcode-cn.com/problems/longest-common-prefix/
*/
fun main() {
val strs = arrayOf("flower", "flow", "flight")
val strs1 = arrayOf("flower", "flower", "flower", "flower")
... | [
{
"class_path": "HLQ-Struggle__LeetCodePro__76922f4/com/hlq/leetcode/array/Question14Kt.class",
"javap": "Compiled from \"Question14.kt\"\npublic final class com.hlq.leetcode.array.Question14Kt {\n public static final void main();\n Code:\n 0: iconst_3\n 1: anewarray #8 ... |
elenavuceljic__advent-of-code-2022__c5093b1/src/day04/Day04.kt | package day04
import java.io.File
fun main() {
fun String.asIntRange() =
substringBefore('-').toInt()..substringAfter('-').toInt()
infix fun IntRange.contains(other: IntRange) = first <= other.first && last >= other.last
infix fun IntRange.overlaps(other: IntRange) = first <= other.last && last... | [
{
"class_path": "elenavuceljic__advent-of-code-2022__c5093b1/day04/Day04Kt.class",
"javap": "Compiled from \"Day04.kt\"\npublic final class day04.Day04Kt {\n public static final void main();\n Code:\n 0: new #8 // class java/io/File\n 3: dup\n 4: ldc ... |
elenavuceljic__advent-of-code-2022__c5093b1/src/day03/Day03.kt | package day03
import java.io.File
fun main() {
fun prioritiseItem(it: Char) = if (it.isUpperCase())
(it - 'A' + 27)
else
(it - 'a' + 1)
fun part1(input: String): Int {
val rucksacks = input.lines()
val duplicateItems = rucksacks.flatMap {
val (first, second) =... | [
{
"class_path": "elenavuceljic__advent-of-code-2022__c5093b1/day03/Day03Kt.class",
"javap": "Compiled from \"Day03.kt\"\npublic final class day03.Day03Kt {\n public static final void main();\n Code:\n 0: new #8 // class java/io/File\n 3: dup\n 4: ldc ... |
elenavuceljic__advent-of-code-2022__c5093b1/src/day02/Day02.kt | package day02
import java.io.File
enum class MyHand(val hand: Char, val scoreWorth: Int) {
X('R', 1), Y('P', 2), Z('S', 3);
}
enum class OpponentHand(val hand: Char) {
A('R'), B('P'), C('S');
}
fun scoreGame(theirs: OpponentHand, mine: MyHand): Int = when {
mine.hand == theirs.hand -> 3
(mine == MyH... | [
{
"class_path": "elenavuceljic__advent-of-code-2022__c5093b1/day02/Day02Kt.class",
"javap": "Compiled from \"Day02.kt\"\npublic final class day02.Day02Kt {\n public static final int scoreGame(day02.OpponentHand, day02.MyHand);\n Code:\n 0: aload_0\n 1: ldc #9 // St... |
nicolegeorgieva__kotlin-practice__c96a023/kotlin-practice/src/main/kotlin/function/CalculateHoursOfStudying.kt | package function
fun main() {
var calculatedTime: Double = 2.08
val currentStudyMins = try {
calculateCurrentTimeOfStudyingInMin("18:43", "")
} catch (e: Exception) {
0
}
val currentStudy = try {
calculateCurrentTimeOfStudying(currentStudyMins)
} catch (e: Exception) {... | [
{
"class_path": "nicolegeorgieva__kotlin-practice__c96a023/function/CalculateHoursOfStudyingKt.class",
"javap": "Compiled from \"CalculateHoursOfStudying.kt\"\npublic final class function.CalculateHoursOfStudyingKt {\n public static final void main();\n Code:\n 0: ldc2_w #9 ... |
nicolegeorgieva__kotlin-practice__c96a023/kotlin-practice/src/main/kotlin/practice/Reservation.kt | package practice
//reserve a table
//input 1: peopleCount
//input 2: each person first name
//input 3: each person spending
//min consumation: 10 BGN/person (one can pay for the other). 10bgn is okay for 1 person
//reservation failed/successful (? advance need to pay && ? total)
//program says ? expense(all), advance ... | [
{
"class_path": "nicolegeorgieva__kotlin-practice__c96a023/practice/ReservationKt.class",
"javap": "Compiled from \"Reservation.kt\"\npublic final class practice.ReservationKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method tableReserve:()Lpractice/Res... |
nicolegeorgieva__kotlin-practice__c96a023/kotlin-practice/src/main/kotlin/algorithms/old/WordsCount.kt | package algorithms.old
fun main() {
val text = "Hi, I'm Nicole. I've been diving deep into Software Development for about 2 years, particularly into " +
"Android Development with Kotlin and Jetpack Compose. I'm proficient in mobile UI/UX and have worked on " +
"projects related to productiv... | [
{
"class_path": "nicolegeorgieva__kotlin-practice__c96a023/algorithms/old/WordsCountKt.class",
"javap": "Compiled from \"WordsCount.kt\"\npublic final class algorithms.old.WordsCountKt {\n public static final void main();\n Code:\n 0: ldc #8 // String Hi, I\\'m Nicole. I... |
nicolegeorgieva__kotlin-practice__c96a023/kotlin-practice/src/main/kotlin/algorithms/new/SumOfCalibrationValues.kt | package algorithms.new
import java.io.File
fun main() {
val input = File("day1.txt").readText()
val input2 = File("new.txt").readText()
println(finalSum("www3two"))
println(finalSum(input))
println(finalSum(input2))
}
val numbers = mapOf(
Pair("one", 1),
Pair("two", 2),
Pair("three",... | [
{
"class_path": "nicolegeorgieva__kotlin-practice__c96a023/algorithms/new/SumOfCalibrationValuesKt.class",
"javap": "Compiled from \"SumOfCalibrationValues.kt\"\npublic final class algorithms.new.SumOfCalibrationValuesKt {\n private static final java.util.Map<java.lang.String, java.lang.Integer> numbers;\n... |
nicolegeorgieva__kotlin-practice__c96a023/kotlin-practice/src/main/kotlin/algorithms/new/CubeConundrum.kt | package algorithms.new
import java.io.File
fun main() {
val input = File("cubes.txt").readText()
val sets =
parseSets("Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green")
println(sumOfGamePowers(input))
}
val bag = Set(
redCubesCount = 12,
greenCubesCount = 13,
blueCubesCount = ... | [
{
"class_path": "nicolegeorgieva__kotlin-practice__c96a023/algorithms/new/CubeConundrumKt.class",
"javap": "Compiled from \"CubeConundrum.kt\"\npublic final class algorithms.new.CubeConundrumKt {\n private static final algorithms.new.Set bag;\n\n public static final void main();\n Code:\n 0: new ... |
nicolegeorgieva__kotlin-practice__c96a023/kotlin-practice/src/main/kotlin/exercise/collection/CollectionOperators3.kt | package exercise.collection
fun main() {
val employees = listOf(
Employee(
employeeId = 124,
name = "Kayla",
department = "HR",
salary = 2000.00
),
Employee(
employeeId = 125,
name = "Lulu",
department = "IT... | [
{
"class_path": "nicolegeorgieva__kotlin-practice__c96a023/exercise/collection/CollectionOperators3Kt$findTopNSalaries$$inlined$sortedByDescending$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class exercise.collection.CollectionOperators3Kt$findTopNSalaries$$inlined$sortedByDescending$... |
nicolegeorgieva__kotlin-practice__c96a023/kotlin-practice/src/main/kotlin/exercise/collection/CollectionOperators.kt | package exercise.collection
fun main() {
val students = listOf<Student>(
Student("John", 20, 3.5),
Student("Jane", 21, 3.8),
Student("Jack", 22, 3.2),
Student("J", 20, 6.0),
Student("JC", 20, 4.5)
)
println(studentsInfo(students))
}
data class Student(
val name... | [
{
"class_path": "nicolegeorgieva__kotlin-practice__c96a023/exercise/collection/CollectionOperatorsKt$findTopStudents$$inlined$sortedByDescending$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class exercise.collection.CollectionOperatorsKt$findTopStudents$$inlined$sortedByDescending$1<T>... |
nicolegeorgieva__kotlin-practice__c96a023/kotlin-practice/src/main/kotlin/exercise/collection/CollectionOperators2.kt | package exercise.collection
fun main() {
val salesData = listOf<Sale>(
Sale("Meat", 7.0, 10),
Sale("Fish", 5.0, 5),
Sale("Snack", 3.0, 2),
Sale("Bread", 1.0, 5),
Sale("Nuts", 2.0, 9),
Sale("Chocolate", 3.0, 5)
)
println(calculateTotalProfit(salesData, 1.0))
... | [
{
"class_path": "nicolegeorgieva__kotlin-practice__c96a023/exercise/collection/CollectionOperators2Kt.class",
"javap": "Compiled from \"CollectionOperators2.kt\"\npublic final class exercise.collection.CollectionOperators2Kt {\n public static final void main();\n Code:\n 0: bipush 6\n ... |
ModestosV__Simple-Calculator-DreamTeam__3b7b7eb/app/src/main/kotlin/com/simplemobiletools/calculator/helpers/StatFunctions.kt | package com.simplemobiletools.calculator.helpers
fun updateStats(results: ArrayList<String>){
getMean(results)
getMedian(results)
getMode(results)
getRange(results)
}
fun getMean(results: ArrayList<String>): String{
var avg = 0.0
for(r in results) {
if(r.isEmpty())
return "... | [
{
"class_path": "ModestosV__Simple-Calculator-DreamTeam__3b7b7eb/com/simplemobiletools/calculator/helpers/StatFunctionsKt.class",
"javap": "Compiled from \"StatFunctions.kt\"\npublic final class com.simplemobiletools.calculator.helpers.StatFunctionsKt {\n public static final void updateStats(java.util.Arra... |
dzirbel__robopower__6c6f0a1/lib/src/main/kotlin/com/dzirbel/robopower/util/MapExtensions.kt | package com.dzirbel.robopower.util
/**
* Returns the key(s) whose associated values are the largest according to [comparator].
*/
internal fun <K, V> Map<K, V>.maxKeysBy(comparator: Comparator<V>): Set<K> {
val iterator = iterator()
if (!iterator.hasNext()) throw NoSuchElementException()
val first = ite... | [
{
"class_path": "dzirbel__robopower__6c6f0a1/com/dzirbel/robopower/util/MapExtensionsKt.class",
"javap": "Compiled from \"MapExtensions.kt\"\npublic final class com.dzirbel.robopower.util.MapExtensionsKt {\n public static final <K, V> java.util.Set<K> maxKeysBy(java.util.Map<K, ? extends V>, java.util.Comp... |
igorakkerman__maxtableprod-challenge__c8d705f/src/main/kotlin/de/igorakkerman/challenge/maxtableprod/MaxTableProd.kt | package de.igorakkerman.challenge.maxtableprod
import java.lang.Integer.max
class MaxTableProd(val prodSize: Int, numbersTable: String) {
val numbers: List<List<Int>>
val width: Int
val height: Int
init {
numbers = numbersTable
.lines()
.map { it.trim() }
... | [
{
"class_path": "igorakkerman__maxtableprod-challenge__c8d705f/de/igorakkerman/challenge/maxtableprod/MaxTableProd.class",
"javap": "Compiled from \"MaxTableProd.kt\"\npublic final class de.igorakkerman.challenge.maxtableprod.MaxTableProd {\n private final int prodSize;\n\n private final java.util.List<ja... |
aesean__TwentyFour__666ae03/app/src/main/java/com/aesean/twentyfour/CalculateImpl.kt | package com.aesean.twentyfour
import java.math.BigDecimal
import java.util.*
interface CalculateRule {
fun size(): Int
fun calculate(a: String, index: Int, b: String): String
fun symbol(index: Int): String
fun deviation(): String
}
fun main(args: Array<String>) {
test("8,8,3,3")
test("5,5,5,... | [
{
"class_path": "aesean__TwentyFour__666ae03/com/aesean/twentyfour/CalculateImplKt.class",
"javap": "Compiled from \"CalculateImpl.kt\"\npublic final class com.aesean.twentyfour.CalculateImplKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 ... |
danielkr__adventofcode2017__366bacf/src/main/kotlin/dk/aoc/day13.kt | package dk.aoc.day13
import java.io.File
import java.util.*
val LAYER_PATTERN = Regex("""(\d+): (\d+)""")
fun main(args: Array<String>) {
val inputFile = File("src/main/resources/inputs/day13.txt")
val lines = inputFile.readLines()
val layers = parseLayers(lines)
val severity = calculateSeverity(laye... | [
{
"class_path": "danielkr__adventofcode2017__366bacf/dk/aoc/day13/Day13Kt.class",
"javap": "Compiled from \"day13.kt\"\npublic final class dk.aoc.day13.Day13Kt {\n private static final kotlin.text.Regex LAYER_PATTERN;\n\n public static final kotlin.text.Regex getLAYER_PATTERN();\n Code:\n 0: gets... |
grine4ka__samokatas__c967e89/codeforces/round573/TokitsukazeMadjong.kt | package codeforces.round573
// https://codeforces.com/contest/1191/problem/B
fun main(args: Array<String>) {
val listM = arrayOf(0, 0, 0, 0, 0, 0, 0, 0, 0)
val listP = arrayOf(0, 0, 0, 0, 0, 0, 0, 0, 0)
val listS = arrayOf(0, 0, 0, 0, 0, 0, 0, 0, 0)
val input = readLine()!!.split(" ").map {
Ca... | [
{
"class_path": "grine4ka__samokatas__c967e89/codeforces/round573/TokitsukazeMadjongKt.class",
"javap": "Compiled from \"TokitsukazeMadjong.kt\"\npublic final class codeforces.round573.TokitsukazeMadjongKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc ... |
grine4ka__samokatas__c967e89/codeforces/eduround68/YetAnotherCrossesProblem.kt | package codeforces.eduround68
import java.io.PrintWriter
import kotlin.math.min
// https://codeforces.com/contest/1194/problem/B
// this is mine
//fun eduround68.eduround68.eduround68.round567.round567.round573.codeforces.codeforces.codeforces.eduround69.kotlinheroes.kotlinheroes.main(args: Array<String>) {
// val... | [
{
"class_path": "grine4ka__samokatas__c967e89/codeforces/eduround68/YetAnotherCrossesProblemKt.class",
"javap": "Compiled from \"YetAnotherCrossesProblem.kt\"\npublic final class codeforces.eduround68.YetAnotherCrossesProblemKt {\n public static final void main();\n Code:\n 0: invokestatic #10 ... |
grine4ka__samokatas__c967e89/stepik/sportprogramming/UnlimitedAudienceApplicationsGreedyAlgorithm.kt | package stepik.sportprogramming
import java.io.File
fun main() {
val rooms = IntArray(33000) { 0 }
val applications = readFromFile()
println("Max of applications is ${count(rooms, applications)}")
}
private fun readFromFile(): MutableList<AudienceApplication> {
val applications = mutableListOf<Audien... | [
{
"class_path": "grine4ka__samokatas__c967e89/stepik/sportprogramming/UnlimitedAudienceApplicationsGreedyAlgorithmKt.class",
"javap": "Compiled from \"UnlimitedAudienceApplicationsGreedyAlgorithm.kt\"\npublic final class stepik.sportprogramming.UnlimitedAudienceApplicationsGreedyAlgorithmKt {\n public stat... |
grine4ka__samokatas__c967e89/stepik/sportprogramming/ScheduleGreedyAlgorithm.kt | package stepik.sportprogramming
private const val MAX_DAYS = 5000
private val used: BooleanArray = BooleanArray(MAX_DAYS) { false }
private val orders = mutableListOf<Order>()
fun main() {
val n = readInt()
repeat(n) {
orders.add(readOrder())
}
val sortedByDeadlineOrders = orders.sortedDescen... | [
{
"class_path": "grine4ka__samokatas__c967e89/stepik/sportprogramming/ScheduleGreedyAlgorithmKt.class",
"javap": "Compiled from \"ScheduleGreedyAlgorithm.kt\"\npublic final class stepik.sportprogramming.ScheduleGreedyAlgorithmKt {\n private static final int MAX_DAYS;\n\n private static final boolean[] use... |
grine4ka__samokatas__c967e89/stepik/sportprogramming/ContuneousBagProblemGreedyAlgorithm.kt | package stepik.sportprogramming
private val things = mutableListOf<Thing>()
fun main() {
val (n, maxWeight) = readPair()
repeat(n) {
things.add(readThing())
}
println("Maximum value of all things is ${solution(maxWeight)}")
}
private fun solution(maxWeight: Int): Int {
val sortedByValue =... | [
{
"class_path": "grine4ka__samokatas__c967e89/stepik/sportprogramming/ContuneousBagProblemGreedyAlgorithmKt.class",
"javap": "Compiled from \"ContuneousBagProblemGreedyAlgorithm.kt\"\npublic final class stepik.sportprogramming.ContuneousBagProblemGreedyAlgorithmKt {\n private static final java.util.List<st... |
grine4ka__samokatas__c967e89/stepik/sportprogramming/RecursiveComivoigerSolution.kt | package stepik.sportprogramming
private var a: Array<IntArray> = emptyArray()
private var ans: Int = Int.MAX_VALUE
private var ansPerm: String = ""
private var p: IntArray = intArrayOf()
private var used: BooleanArray = booleanArrayOf()
private var n: Int = 0
fun main() {
n = readInt()
a = Array(n) {
... | [
{
"class_path": "grine4ka__samokatas__c967e89/stepik/sportprogramming/RecursiveComivoigerSolutionKt.class",
"javap": "Compiled from \"RecursiveComivoigerSolution.kt\"\npublic final class stepik.sportprogramming.RecursiveComivoigerSolutionKt {\n private static int[][] a;\n\n private static int ans;\n\n pr... |
grine4ka__samokatas__c967e89/stepik/sportprogramming/LongestCommonSubsequenceDynamicProgramming.kt | package stepik.sportprogramming
import java.io.File
import java.io.PrintWriter
import java.util.*
import kotlin.math.max
fun main() {
output {
val n = readInt()
val a = readIntArray(n)
val m = readInt()
val b = readIntArray(m)
val d = Array(n + 1) {
IntArray(m +... | [
{
"class_path": "grine4ka__samokatas__c967e89/stepik/sportprogramming/LongestCommonSubsequenceDynamicProgrammingKt.class",
"javap": "Compiled from \"LongestCommonSubsequenceDynamicProgramming.kt\"\npublic final class stepik.sportprogramming.LongestCommonSubsequenceDynamicProgrammingKt {\n private static fi... |
remisultan__multiarm-bandit-algorithm-kotlin__ead934d/core-bandit/src/main/kotlin/org/rsultan/bandit/algorithms/BanditAlgorithm.kt | package org.rsultan.bandit.algorithms
import java.security.SecureRandom
interface BanditAlgorithm {
fun selectArm(): Int
fun update(chosenArm: Int, reward: Float)
}
abstract class AbstractBanditAlgorithm(nbArms: Int) : BanditAlgorithm {
protected val random = SecureRandom()
protected val counts = ... | [
{
"class_path": "remisultan__multiarm-bandit-algorithm-kotlin__ead934d/org/rsultan/bandit/algorithms/BanditAlgorithm.class",
"javap": "Compiled from \"BanditAlgorithm.kt\"\npublic interface org.rsultan.bandit.algorithms.BanditAlgorithm {\n public abstract int selectArm();\n\n public abstract void update(i... |
waploaj__Masomo__6a44d60/src/main/kotlin/complexity/Complexity.kt | package complexity
// ------------------------------ Time complexity ----------------------------------
//Big O notation for the different level of scalability in two dimension
//-- Execution time
//-- Memory Usage
//Time complexity - is the time it take for algorithm to run compare with data size.
//Constant Time ... | [
{
"class_path": "waploaj__Masomo__6a44d60/complexity/ComplexityKt.class",
"javap": "Compiled from \"Complexity.kt\"\npublic final class complexity.ComplexityKt {\n public static final void checkFirst(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: ldc #10 ... |
moosolutions__advent-of-code-2022__6ef815d/src/main/kotlin/aoc/day5/SupplyStacks.kt | package aoc.day5
class SupplyStacks(private val input: List<String>) {
val stacks = mutableListOf<Stack>()
init {
val rawStacks = input.slice(0..input.indexOf(""))
.filter { line -> line.isNotEmpty() }
.map {
it.split(",")
}
.flatten()
... | [
{
"class_path": "moosolutions__advent-of-code-2022__6ef815d/aoc/day5/SupplyStacks.class",
"javap": "Compiled from \"SupplyStacks.kt\"\npublic final class aoc.day5.SupplyStacks {\n private final java.util.List<java.lang.String> input;\n\n private final java.util.List<aoc.day5.Stack> stacks;\n\n public aoc... |
victorYghor__Kotlin-Problems__0d30e37/simpleCalculator/Main.kt | package calculator
val numbers = mutableListOf<Int>()
fun Char.isOperator(): Boolean {
return this == '+' || this == '-'
}
fun start() {
val input = readln().split(' ').joinToString("")
when (input) {
"" -> start()
"/exit" -> throw Exception()
"/help" -> println(
"""Th... | [
{
"class_path": "victorYghor__Kotlin-Problems__0d30e37/calculator/MainKt.class",
"javap": "Compiled from \"Main.kt\"\npublic final class calculator.MainKt {\n private static final java.util.List<java.lang.Integer> numbers;\n\n public static final java.util.List<java.lang.Integer> getNumbers();\n Code:\... |
Laomedeia__Java8InAction__0dcd843/src/main/java/leetcode/a350_intersectTwoArrays/Solution.kt | package leetcode.a350_intersectTwoArrays
import java.util.*
import kotlin.math.min
/**
* 给定两个数组,编写一个函数来计算它们的交集。
*
* 示例 1:
* 输入:nums1 = [1,2,2,1], nums2 = [2,2]
* 输出:[2,2]
*
* 示例 2:
* 输入:nums1 = [4,9,5], nums2 = [9,4,9,8,4]
* 输出:[4,9]
*
*
* 说明:
* 输出结果中每个元素出现的次数,应与元素在两个数组中出现次数的最小值一致。
* 我们可以不考虑输出结果的顺序。
... | [
{
"class_path": "Laomedeia__Java8InAction__0dcd843/leetcode/a350_intersectTwoArrays/Solution.class",
"javap": "Compiled from \"Solution.kt\"\npublic final class leetcode.a350_intersectTwoArrays.Solution {\n public leetcode.a350_intersectTwoArrays.Solution();\n Code:\n 0: aload_0\n 1: invokes... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.