class Solution {
    fun longestPalindrome(s: String): String {
        if (s.length <= 1)
            return s
        val size = 2 * s.length + 1;
        val t = CharArray(size)
        for (i in 0..(s.length - 1))
            t[2 * i + 1] = s[i]
        val pLens = IntArray(size)
        var c = 0
        var r = 0
        var maxPLen = 0
        var idx = 0
        for (i in 0..(size - 1)) {
            val j = 2 * c - i;
            var pLen = if (r > i) Math.min(r - i, pLens[j])
                       else 0
            var posLeft = i - (pLen + 1)
            var posRight = i + (pLen + 1)
            while (0 <= posLeft && posRight < size &&
                    t[posLeft] == t[posRight]) {
                ++pLen
                --posLeft
                ++posRight
            }
            pLens[i] = pLen
            val newR = i + pLen
            if (newR > r) {
                c = i
                r = newR
            }
            if (pLen > maxPLen) {
                maxPLen = pLen
                idx = i
            }
        }
        val start = (idx - maxPLen) / 2
        return s.substring(start, start + maxPLen)
    }
}

Compiled from "Solution.kt"
public final class Solution {
  public Solution();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final java.lang.String longestPalindrome(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String s
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokevirtual #27                 // Method java/lang/String.length:()I
      10: iconst_1
      11: if_icmpgt     16
      14: aload_1
      15: areturn
      16: iconst_2
      17: aload_1
      18: invokevirtual #27                 // Method java/lang/String.length:()I
      21: imul
      22: iconst_1
      23: iadd
      24: istore_2
      25: iload_2
      26: newarray       char
      28: astore_3
      29: iconst_0
      30: istore        4
      32: aload_1
      33: invokevirtual #27                 // Method java/lang/String.length:()I
      36: istore        5
      38: iload         4
      40: iload         5
      42: if_icmpge     65
      45: aload_3
      46: iconst_2
      47: iload         4
      49: imul
      50: iconst_1
      51: iadd
      52: aload_1
      53: iload         4
      55: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
      58: castore
      59: iinc          4, 1
      62: goto          38
      65: iload_2
      66: newarray       int
      68: astore        4
      70: iconst_0
      71: istore        5
      73: iconst_0
      74: istore        6
      76: iconst_0
      77: istore        7
      79: iconst_0
      80: istore        8
      82: iconst_0
      83: istore        9
      85: iload_2
      86: iconst_1
      87: isub
      88: istore        10
      90: iload         9
      92: iload         10
      94: if_icmpgt     242
      97: iconst_2
      98: iload         5
     100: imul
     101: iload         9
     103: isub
     104: istore        11
     106: iload         6
     108: iload         9
     110: if_icmple     129
     113: iload         6
     115: iload         9
     117: isub
     118: aload         4
     120: iload         11
     122: iaload
     123: invokestatic  #37                 // Method java/lang/Math.min:(II)I
     126: goto          130
     129: iconst_0
     130: istore        12
     132: iload         9
     134: iload         12
     136: iconst_1
     137: iadd
     138: isub
     139: istore        13
     141: iload         9
     143: iload         12
     145: iconst_1
     146: iadd
     147: iadd
     148: istore        14
     150: iconst_0
     151: iload         13
     153: if_icmpgt     185
     156: iload         14
     158: iload_2
     159: if_icmpge     185
     162: aload_3
     163: iload         13
     165: caload
     166: aload_3
     167: iload         14
     169: caload
     170: if_icmpne     185
     173: iinc          12, 1
     176: iinc          13, -1
     179: iinc          14, 1
     182: goto          150
     185: aload         4
     187: iload         9
     189: iload         12
     191: iastore
     192: iload         9
     194: iload         12
     196: iadd
     197: istore        15
     199: iload         15
     201: iload         6
     203: if_icmple     214
     206: iload         9
     208: istore        5
     210: iload         15
     212: istore        6
     214: iload         12
     216: iload         7
     218: if_icmple     229
     221: iload         12
     223: istore        7
     225: iload         9
     227: istore        8
     229: iload         9
     231: iload         10
     233: if_icmpeq     242
     236: iinc          9, 1
     239: goto          97
     242: iload         8
     244: iload         7
     246: isub
     247: iconst_2
     248: idiv
     249: istore        9
     251: aload_1
     252: iload         9
     254: iload         9
     256: iload         7
     258: iadd
     259: invokevirtual #41                 // Method java/lang/String.substring:(II)Ljava/lang/String;
     262: dup
     263: ldc           #43                 // String substring(...)
     265: invokestatic  #46                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     268: areturn
}


/**
 * Idea: Go through the vector, analyzing each position i. If A[i].key equals K, then it found the
 * position and returns i. If you went through the entire vector and no element equal to K exists,
 * then return -1.
 *
 * Linear search is an algorithm which finds the position of a target value within an array (Usually
 * unsorted)
 *
 * Worst-case performance O(n) Best-case performance O(1) Average performance O(n) Worst-case space
 * complexity O(1)
 */
fun main() {
    val array = intArrayOf(-6, -1, 3, 7, 10, 27, 35, 37, 52)
    val k1 = 27
    val k2 = 2
    println("Result for k1 ${linearSearch(array,  k1)}")
    println("Result for k2 ${linearSearch(array,  k2)}")
}

/**
 * @param array is an array where the element should be found
 * @param k is an element which should be found
 * @return index of the element
 */
fun linearSearch(array: IntArray, k: Int): Int {
    for (i in array.indices) {
        if (array[i].compareTo(k) == 0) {
            return i
        }
    }

    return -1
}

Compiled from "LinearSearchAlgorithms.kt"
public final class LinearSearchAlgorithmsKt {
  public static final void main();
    Code:
       0: bipush        9
       2: newarray       int
       4: astore_1
       5: aload_1
       6: iconst_0
       7: bipush        -6
       9: iastore
      10: aload_1
      11: iconst_1
      12: iconst_m1
      13: iastore
      14: aload_1
      15: iconst_2
      16: iconst_3
      17: iastore
      18: aload_1
      19: iconst_3
      20: bipush        7
      22: iastore
      23: aload_1
      24: iconst_4
      25: bipush        10
      27: iastore
      28: aload_1
      29: iconst_5
      30: bipush        27
      32: iastore
      33: aload_1
      34: bipush        6
      36: bipush        35
      38: iastore
      39: aload_1
      40: bipush        7
      42: bipush        37
      44: iastore
      45: aload_1
      46: bipush        8
      48: bipush        52
      50: iastore
      51: aload_1
      52: astore_0
      53: bipush        27
      55: istore_1
      56: iconst_2
      57: istore_2
      58: new           #8                  // class java/lang/StringBuilder
      61: dup
      62: invokespecial #11                 // Method java/lang/StringBuilder."<init>":()V
      65: ldc           #13                 // String Result for k1
      67: invokevirtual #17                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      70: aload_0
      71: iload_1
      72: invokestatic  #21                 // Method linearSearch:([II)I
      75: invokevirtual #24                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      78: invokevirtual #28                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      81: getstatic     #34                 // Field java/lang/System.out:Ljava/io/PrintStream;
      84: swap
      85: invokevirtual #40                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      88: new           #8                  // class java/lang/StringBuilder
      91: dup
      92: invokespecial #11                 // Method java/lang/StringBuilder."<init>":()V
      95: ldc           #42                 // String Result for k2
      97: invokevirtual #17                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     100: aload_0
     101: iload_2
     102: invokestatic  #21                 // Method linearSearch:([II)I
     105: invokevirtual #24                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     108: invokevirtual #28                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     111: getstatic     #34                 // Field java/lang/System.out:Ljava/io/PrintStream;
     114: swap
     115: invokevirtual #40                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     118: return

  public static final int linearSearch(int[], int);
    Code:
       0: aload_0
       1: ldc           #49                 // String array
       3: invokestatic  #55                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_2
       8: aload_0
       9: arraylength
      10: istore_3
      11: iload_2
      12: iload_3
      13: if_icmpge     34
      16: aload_0
      17: iload_2
      18: iaload
      19: iload_1
      20: invokestatic  #59                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      23: ifne          28
      26: iload_2
      27: ireturn
      28: iinc          2, 1
      31: goto          11
      34: iconst_m1
      35: ireturn

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #64                 // Method main:()V
       3: return
}


class BinarySearchSolution

fun main() {
    print(binarySearch(arrayOf(12, 3, 24, 5, 10, 23, 9), 23))
}
/**
 * @param array is an array where the element should be found
 * @param key is an element which should be found
 * @return index of the element
 */
fun <T : Comparable<T>> binarySearch(array: Array<T>, key: T): Int {
    return binarySearchHelper(array, key, 0, array.size - 1)
}

/**
 * @param array The array to search
 * @param key The element you are looking for
 * @param left is the index of the first element at array.
 * @param is the index of the last element at array.
 * @return the location of the key or -1 if the element is not found
 */
fun <T : Comparable<T>> binarySearchHelper(array: Array<T>, key: T, start: Int, end: Int): Int {
    if (start > end) {
        return -1
    }

    val mid = start + (end - start) / 2

    return when {
        array[mid].compareTo(key) == 0 -> mid
        array[mid].compareTo(key) > 0 -> binarySearchHelper(array, key, start, mid - 1)
        else -> binarySearchHelper(array, key, mid + 1, end)
    }
}

Compiled from "BinarySearch.kt"
public final class BinarySearchKt {
  public static final void main();
    Code:
       0: bipush        7
       2: anewarray     #8                  // class java/lang/Integer
       5: astore_0
       6: aload_0
       7: iconst_0
       8: bipush        12
      10: invokestatic  #12                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      13: aastore
      14: aload_0
      15: iconst_1
      16: iconst_3
      17: invokestatic  #12                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      20: aastore
      21: aload_0
      22: iconst_2
      23: bipush        24
      25: invokestatic  #12                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      28: aastore
      29: aload_0
      30: iconst_3
      31: iconst_5
      32: invokestatic  #12                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      35: aastore
      36: aload_0
      37: iconst_4
      38: bipush        10
      40: invokestatic  #12                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      43: aastore
      44: aload_0
      45: iconst_5
      46: bipush        23
      48: invokestatic  #12                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      51: aastore
      52: aload_0
      53: bipush        6
      55: bipush        9
      57: invokestatic  #12                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      60: aastore
      61: aload_0
      62: checkcast     #14                 // class "[Ljava/lang/Comparable;"
      65: bipush        23
      67: invokestatic  #12                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      70: checkcast     #16                 // class java/lang/Comparable
      73: invokestatic  #20                 // Method binarySearch:([Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      76: istore_0
      77: getstatic     #26                 // Field java/lang/System.out:Ljava/io/PrintStream;
      80: iload_0
      81: invokevirtual #32                 // Method java/io/PrintStream.print:(I)V
      84: return

  public static final <T extends java.lang.Comparable<? super T>> int binarySearch(T[], T);
    Code:
       0: aload_0
       1: ldc           #36                 // String array
       3: invokestatic  #42                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #44                 // String key
       9: invokestatic  #42                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_1
      14: iconst_0
      15: aload_0
      16: arraylength
      17: iconst_1
      18: isub
      19: invokestatic  #48                 // Method binarySearchHelper:([Ljava/lang/Comparable;Ljava/lang/Comparable;II)I
      22: ireturn

  public static final <T extends java.lang.Comparable<? super T>> int binarySearchHelper(T[], T, int, int);
    Code:
       0: aload_0
       1: ldc           #36                 // String array
       3: invokestatic  #42                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #44                 // String key
       9: invokestatic  #42                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: iload_2
      13: iload_3
      14: if_icmple     19
      17: iconst_m1
      18: ireturn
      19: iload_2
      20: iload_3
      21: iload_2
      22: isub
      23: iconst_2
      24: idiv
      25: iadd
      26: istore        4
      28: nop
      29: aload_0
      30: iload         4
      32: aaload
      33: aload_1
      34: invokeinterface #54,  2           // InterfaceMethod java/lang/Comparable.compareTo:(Ljava/lang/Object;)I
      39: ifne          47
      42: iload         4
      44: goto          83
      47: aload_0
      48: iload         4
      50: aaload
      51: aload_1
      52: invokeinterface #54,  2           // InterfaceMethod java/lang/Comparable.compareTo:(Ljava/lang/Object;)I
      57: ifle          73
      60: aload_0
      61: aload_1
      62: iload_2
      63: iload         4
      65: iconst_1
      66: isub
      67: invokestatic  #48                 // Method binarySearchHelper:([Ljava/lang/Comparable;Ljava/lang/Comparable;II)I
      70: goto          83
      73: aload_0
      74: aload_1
      75: iload         4
      77: iconst_1
      78: iadd
      79: iload_3
      80: invokestatic  #48                 // Method binarySearchHelper:([Ljava/lang/Comparable;Ljava/lang/Comparable;II)I
      83: ireturn

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #61                 // Method main:()V
       3: return
}


/**
 * Given a string s, sort it in decreasing order based on the frequency of the characters.
 * The frequency of a character is the number of times it appears in the string.
 *
 * Return the sorted string. If there are multiple answers, return any of them.
 *
 *
 *
 * Example 1:
 *
 * Input: s = "tree"
 * Output: "eert"
 * Explanation: 'e' appears twice while 'r' and 't' both appear once.
 * So 'e' must appear before both 'r' and 't'. Therefore "eetr" is also a valid answer.
 * Example 2:
 *
 * Input: s = "cccaaa"
 * Output: "aaaccc"
 * Explanation: Both 'c' and 'a' appear three times, so both "cccaaa" and "aaaccc" are valid answers.
 * Note that "cacaca" is incorrect, as the same characters must be together.
 * Example 3:
 *
 * Input: s = "Aabb"
 * Output: "bbAa"
 * Explanation: "bbaA" is also a valid answer, but "Aabb" is incorrect.
 * Note that 'A' and 'a' are treated as two different characters.
 *
 *
 * Constraints:
 *
 * 1 <= s.length <= 5 * 10^5
 * s consists of uppercase and lowercase English letters and digits.
 * @see LeetCode
 */
fun frequencySort(s: String): String {
    val frequencyMap = mutableMapOf<Char, Int>()
    s.forEach { char ->
        frequencyMap[char] = 1 + frequencyMap.getOrDefault(char, 0)
    }
    val charsByFrequencyMap = mutableMapOf<Int, MutableList<Char>>()
    frequencyMap.forEach { char, frequency ->
        if (!charsByFrequencyMap.contains(frequency)) {
            charsByFrequencyMap[frequency] = mutableListOf(char)
        } else {
            charsByFrequencyMap[frequency]?.add(char)
        }
    }
    val result = StringBuilder()
    for (frequency in s.length downTo 1) {
        charsByFrequencyMap[frequency]?.forEach { char ->
            repeat(frequency) {
                result.append(char)
            }
        }
    }
    return result.toString()
}

Compiled from "SortCharactersByFrequency.kt"
public final class SortCharactersByFrequencyKt {
  public static final java.lang.String frequencySort(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #9                  // String s
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #17                 // class java/util/LinkedHashMap
       9: dup
      10: invokespecial #21                 // Method java/util/LinkedHashMap."<init>":()V
      13: checkcast     #23                 // class java/util/Map
      16: astore_1
      17: aload_0
      18: checkcast     #25                 // class java/lang/CharSequence
      21: astore_2
      22: iconst_0
      23: istore_3
      24: iconst_0
      25: istore        4
      27: iload         4
      29: aload_2
      30: invokeinterface #29,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      35: if_icmpge     105
      38: aload_2
      39: iload         4
      41: invokeinterface #33,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      46: istore        5
      48: iload         5
      50: istore        6
      52: iconst_0
      53: istore        7
      55: iload         6
      57: invokestatic  #39                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      60: astore        8
      62: aload_1
      63: aload         8
      65: iconst_1
      66: aload_1
      67: iload         6
      69: invokestatic  #39                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      72: iconst_0
      73: invokestatic  #44                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      76: invokeinterface #48,  3           // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      81: checkcast     #50                 // class java/lang/Number
      84: invokevirtual #53                 // Method java/lang/Number.intValue:()I
      87: iadd
      88: invokestatic  #44                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      91: invokeinterface #56,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      96: pop
      97: nop
      98: nop
      99: iinc          4, 1
     102: goto          27
     105: nop
     106: new           #17                 // class java/util/LinkedHashMap
     109: dup
     110: invokespecial #21                 // Method java/util/LinkedHashMap."<init>":()V
     113: checkcast     #23                 // class java/util/Map
     116: astore_2
     117: aload_1
     118: aload_2
     119: invokedynamic #75,  0             // InvokeDynamic #0:invoke:(Ljava/util/Map;)Lkotlin/jvm/functions/Function2;
     124: invokedynamic #86,  0             // InvokeDynamic #1:accept:(Lkotlin/jvm/functions/Function2;)Ljava/util/function/BiConsumer;
     129: invokeinterface #90,  2           // InterfaceMethod java/util/Map.forEach:(Ljava/util/function/BiConsumer;)V
     134: new           #92                 // class java/lang/StringBuilder
     137: dup
     138: invokespecial #93                 // Method java/lang/StringBuilder."<init>":()V
     141: astore_3
     142: aload_0
     143: invokevirtual #96                 // Method java/lang/String.length:()I
     146: istore        4
     148: iconst_0
     149: iload         4
     151: if_icmpge     269
     154: aload_2
     155: iload         4
     157: invokestatic  #44                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     160: invokeinterface #100,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     165: checkcast     #102                // class java/util/List
     168: dup
     169: ifnull        261
     172: checkcast     #104                // class java/lang/Iterable
     175: astore        6
     177: iconst_0
     178: istore        7
     180: aload         6
     182: invokeinterface #108,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     187: astore        8
     189: aload         8
     191: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     196: ifeq          257
     199: aload         8
     201: invokeinterface #118,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     206: astore        9
     208: aload         9
     210: checkcast     #35                 // class java/lang/Character
     213: invokevirtual #122                // Method java/lang/Character.charValue:()C
     216: istore        10
     218: iconst_0
     219: istore        11
     221: iconst_0
     222: istore        12
     224: iload         12
     226: iload         4
     228: if_icmpge     252
     231: iload         12
     233: istore        13
     235: iconst_0
     236: istore        14
     238: aload_3
     239: iload         10
     241: invokevirtual #126                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     244: pop
     245: nop
     246: iinc          12, 1
     249: goto          224
     252: nop
     253: nop
     254: goto          189
     257: nop
     258: goto          263
     261: pop
     262: nop
     263: iinc          4, -1
     266: goto          148
     269: aload_3
     270: invokevirtual #130                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     273: dup
     274: ldc           #132                // String toString(...)
     276: invokestatic  #135                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     279: areturn

  private static final kotlin.Unit frequencySort$lambda$1(java.util.Map, java.lang.Character, java.lang.Integer);
    Code:
       0: aload_1
       1: ldc           #156                // String char
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #157                // String frequency
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_2
      14: invokeinterface #161,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
      19: ifne          55
      22: aload_0
      23: astore_3
      24: iconst_1
      25: anewarray     #35                 // class java/lang/Character
      28: astore        4
      30: aload         4
      32: iconst_0
      33: aload_1
      34: aastore
      35: aload         4
      37: invokestatic  #167                // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;
      40: astore        4
      42: aload_3
      43: aload_2
      44: aload         4
      46: invokeinterface #56,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      51: pop
      52: goto          80
      55: aload_0
      56: aload_2
      57: invokeinterface #100,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      62: checkcast     #102                // class java/util/List
      65: dup
      66: ifnull        79
      69: aload_1
      70: invokeinterface #170,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
      75: pop
      76: goto          80
      79: pop
      80: getstatic     #176                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      83: areturn

  private static final void frequencySort$lambda$2(kotlin.jvm.functions.Function2, java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokeinterface #183,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
       8: pop
       9: return
}


/**
 * Given an integer array arr, partition the array into (contiguous) subarrays of length at most k.
 * After partitioning, each subarray has their values changed to become the maximum value of that subarray.
 *
 * Return the largest sum of the given array after partitioning.
 * Test cases are generated so that the answer fits in a 32-bit integer.
 *
 *
 *
 * Example 1:
 *
 * Input: arr = [1,15,7,9,2,5,10], k = 3
 * Output: 84
 * Explanation: arr becomes [15,15,15,9,10,10,10]
 * Example 2:
 *
 * Input: arr = [1,4,1,5,7,3,6,1,9,9,3], k = 4
 * Output: 83
 * Example 3:
 *
 * Input: arr = [1], k = 1
 * Output: 1
 *
 *
 * Constraints:
 *
 * 1 <= arr.length <= 500
 * 0 <= arr[i] <= 10^9
 * 1 <= k <= arr.length
 * @see <a https://leetcode.com/problems/partition-array-for-maximum-sum/">LeetCode</a>
 */
fun maxSumAfterPartitioning(arr: IntArray, k: Int): Int {
    val arraySize = arr.size
    // memoryArray[i] will hold the maximum sum we can get for the first i elements of arr, with memoryArray[0] = 0
    val memoryArray = IntArray(arraySize + 1)

    for (index in 1..arraySize) {
        var subarrayMaxElement = 0
        for (subarraySize in 1..minOf(k, index)) {
            subarrayMaxElement = subarrayMaxElement.coerceAtLeast(arr[index - subarraySize])
            val sum = memoryArray[index - subarraySize] + subarraySize * subarrayMaxElement
            memoryArray[index] = memoryArray[index].coerceAtLeast(sum)
        }
    }
    return memoryArray[arraySize]
}

Compiled from "PartitionArrayForMaximumSum.kt"
public final class PartitionArrayForMaximumSumKt {
  public static final int maxSumAfterPartitioning(int[], int);
    Code:
       0: aload_0
       1: ldc           #9                  // String arr
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: arraylength
       8: istore_2
       9: iload_2
      10: iconst_1
      11: iadd
      12: newarray       int
      14: astore_3
      15: iconst_1
      16: istore        4
      18: iload         4
      20: iload_2
      21: if_icmpgt     112
      24: iconst_0
      25: istore        5
      27: iconst_1
      28: istore        6
      30: iload_1
      31: iload         4
      33: invokestatic  #21                 // Method java/lang/Math.min:(II)I
      36: istore        7
      38: iload         6
      40: iload         7
      42: if_icmpgt     100
      45: iload         5
      47: aload_0
      48: iload         4
      50: iload         6
      52: isub
      53: iaload
      54: invokestatic  #26                 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
      57: istore        5
      59: aload_3
      60: iload         4
      62: iload         6
      64: isub
      65: iaload
      66: iload         6
      68: iload         5
      70: imul
      71: iadd
      72: istore        8
      74: aload_3
      75: iload         4
      77: aload_3
      78: iload         4
      80: iaload
      81: iload         8
      83: invokestatic  #26                 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
      86: iastore
      87: iload         6
      89: iload         7
      91: if_icmpeq     100
      94: iinc          6, 1
      97: goto          45
     100: iload         4
     102: iload_2
     103: if_icmpeq     112
     106: iinc          4, 1
     109: goto          24
     112: aload_3
     113: iload_2
     114: iaload
     115: ireturn
}


/**
 * An integer has sequential digits if and only if each digit in the number is one more than the previous digit.
 *
 * Return a sorted list of all the integers in the range [low, high] inclusive that have sequential digits.
 *
 *
 *
 * Example 1:
 *
 * Input: low = 100, high = 300
 * Output: [123,234]
 * Example 2:
 *
 * Input: low = 1000, high = 13000
 * Output: [1234,2345,3456,4567,5678,6789,12345]
 *
 *
 * Constraints:
 *
 * 10 <= low <= high <= 10^9
 * @see LeetCode
 */
fun sequentialDigits(low: Int, high: Int): List<Int> {
    val result = mutableListOf<Int>()
    val lengthOfLow = low.toString().length
    val maxStartDigit = 10 - lengthOfLow
    val numbersQueue = ArrayDeque<Int>()

    for (startDigit in 1..maxStartDigit) {
        var number = startDigit
        for (index in 1 until lengthOfLow) {
            number = number * 10 + startDigit + index
        }
        numbersQueue.add(number)
    }

    while (numbersQueue.isNotEmpty()) {
        val currentNumber = numbersQueue.removeFirst()
        if (currentNumber > high) {
            return result
        }
        if (currentNumber >= low) {
            result.add(currentNumber)
        }
        currentNumber.rem(10).let { lastDigit ->
            if (lastDigit != 9) {
                numbersQueue.add(currentNumber * 10 + lastDigit + 1)
            }
        }
    }
    return result
}

Compiled from "SequentialDigits.kt"
public final class SequentialDigitsKt {
  public static final java.util.List<java.lang.Integer> sequentialDigits(int, int);
    Code:
       0: new           #10                 // class java/util/ArrayList
       3: dup
       4: invokespecial #14                 // Method java/util/ArrayList."<init>":()V
       7: checkcast     #16                 // class java/util/List
      10: astore_2
      11: iload_0
      12: invokestatic  #22                 // Method java/lang/String.valueOf:(I)Ljava/lang/String;
      15: invokevirtual #26                 // Method java/lang/String.length:()I
      18: istore_3
      19: bipush        10
      21: iload_3
      22: isub
      23: istore        4
      25: new           #28                 // class kotlin/collections/ArrayDeque
      28: dup
      29: invokespecial #29                 // Method kotlin/collections/ArrayDeque."<init>":()V
      32: astore        5
      34: iconst_1
      35: istore        6
      37: iload         6
      39: iload         4
      41: if_icmpgt     100
      44: iload         6
      46: istore        7
      48: iconst_1
      49: istore        8
      51: iload         8
      53: iload_3
      54: if_icmpge     76
      57: iload         7
      59: bipush        10
      61: imul
      62: iload         6
      64: iadd
      65: iload         8
      67: iadd
      68: istore        7
      70: iinc          8, 1
      73: goto          51
      76: aload         5
      78: iload         7
      80: invokestatic  #34                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      83: invokevirtual #38                 // Method kotlin/collections/ArrayDeque.add:(Ljava/lang/Object;)Z
      86: pop
      87: iload         6
      89: iload         4
      91: if_icmpeq     100
      94: iinc          6, 1
      97: goto          44
     100: aload         5
     102: checkcast     #40                 // class java/util/Collection
     105: invokeinterface #44,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
     110: ifne          117
     113: iconst_1
     114: goto          118
     117: iconst_0
     118: ifeq          201
     121: aload         5
     123: invokevirtual #48                 // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;
     126: checkcast     #50                 // class java/lang/Number
     129: invokevirtual #53                 // Method java/lang/Number.intValue:()I
     132: istore        6
     134: iload         6
     136: iload_1
     137: if_icmple     142
     140: aload_2
     141: areturn
     142: iload         6
     144: iload_0
     145: if_icmplt     160
     148: aload_2
     149: iload         6
     151: invokestatic  #34                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     154: invokeinterface #54,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     159: pop
     160: iload         6
     162: bipush        10
     164: irem
     165: istore        8
     167: iconst_0
     168: istore        9
     170: iload         8
     172: bipush        9
     174: if_icmpeq     196
     177: aload         5
     179: iload         6
     181: bipush        10
     183: imul
     184: iload         8
     186: iadd
     187: iconst_1
     188: iadd
     189: invokestatic  #34                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     192: invokevirtual #38                 // Method kotlin/collections/ArrayDeque.add:(Ljava/lang/Object;)Z
     195: pop
     196: nop
     197: nop
     198: goto          100
     201: aload_2
     202: areturn
}


/**
 * Given an array of integers temperatures represents the daily temperatures,
 * return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer temperature.
 * If there is no future day for which this is possible, keep answer[i] == 0 instead.
 *
 *
 *
 * Example 1:
 *
 * Input: temperatures = [73,74,75,71,69,72,76,73]
 * Output: [1,1,4,2,1,1,0,0]
 * Example 2:
 *
 * Input: temperatures = [30,40,50,60]
 * Output: [1,1,1,0]
 * Example 3:
 *
 * Input: temperatures = [30,60,90]
 * Output: [1,1,0]
 *
 *
 * Constraints:
 *
 * 1 <= temperatures.length <= 10^5
 * 30 <= temperatures[i] <= 100
 * @see LeetCode
 */
fun dailyTemperatures(temperatures: IntArray): IntArray {
    val stack = ArrayDeque<Pair<Int, Int>>()
    val answer = IntArray(temperatures.size)

    for (index in (0 until temperatures.size).reversed()) {
        while (stack.isNotEmpty() && temperatures[index] >= stack.last().first) {
            stack.removeLast()
        }
        answer[index] = if (stack.isEmpty()) 0 else stack.last().second - index
        stack.add(Pair(temperatures[index], index))
    }
    return answer
}

Compiled from "DailyTemperatures.kt"
public final class DailyTemperaturesKt {
  public static final int[] dailyTemperatures(int[]);
    Code:
       0: aload_0
       1: ldc           #9                  // String temperatures
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #17                 // class kotlin/collections/ArrayDeque
       9: dup
      10: invokespecial #21                 // Method kotlin/collections/ArrayDeque."<init>":()V
      13: astore_1
      14: aload_0
      15: arraylength
      16: newarray       int
      18: astore_2
      19: iconst_0
      20: aload_0
      21: arraylength
      22: invokestatic  #27                 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
      25: checkcast     #29                 // class kotlin/ranges/IntProgression
      28: invokestatic  #33                 // Method kotlin/ranges/RangesKt.reversed:(Lkotlin/ranges/IntProgression;)Lkotlin/ranges/IntProgression;
      31: astore_3
      32: aload_3
      33: invokevirtual #37                 // Method kotlin/ranges/IntProgression.getFirst:()I
      36: istore        4
      38: aload_3
      39: invokevirtual #40                 // Method kotlin/ranges/IntProgression.getLast:()I
      42: istore        5
      44: aload_3
      45: invokevirtual #43                 // Method kotlin/ranges/IntProgression.getStep:()I
      48: istore        6
      50: iload         6
      52: ifle          62
      55: iload         4
      57: iload         5
      59: if_icmple     74
      62: iload         6
      64: ifge          200
      67: iload         5
      69: iload         4
      71: if_icmpgt     200
      74: aload_1
      75: checkcast     #45                 // class java/util/Collection
      78: invokeinterface #49,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
      83: ifne          90
      86: iconst_1
      87: goto          91
      90: iconst_0
      91: ifeq          125
      94: aload_0
      95: iload         4
      97: iaload
      98: aload_1
      99: invokevirtual #53                 // Method kotlin/collections/ArrayDeque.last:()Ljava/lang/Object;
     102: checkcast     #55                 // class kotlin/Pair
     105: invokevirtual #57                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     108: checkcast     #59                 // class java/lang/Number
     111: invokevirtual #62                 // Method java/lang/Number.intValue:()I
     114: if_icmplt     125
     117: aload_1
     118: invokevirtual #65                 // Method kotlin/collections/ArrayDeque.removeLast:()Ljava/lang/Object;
     121: pop
     122: goto          74
     125: aload_2
     126: iload         4
     128: aload_1
     129: invokevirtual #66                 // Method kotlin/collections/ArrayDeque.isEmpty:()Z
     132: ifeq          139
     135: iconst_0
     136: goto          158
     139: aload_1
     140: invokevirtual #53                 // Method kotlin/collections/ArrayDeque.last:()Ljava/lang/Object;
     143: checkcast     #55                 // class kotlin/Pair
     146: invokevirtual #69                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     149: checkcast     #59                 // class java/lang/Number
     152: invokevirtual #62                 // Method java/lang/Number.intValue:()I
     155: iload         4
     157: isub
     158: iastore
     159: aload_1
     160: new           #55                 // class kotlin/Pair
     163: dup
     164: aload_0
     165: iload         4
     167: iaload
     168: invokestatic  #75                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     171: iload         4
     173: invokestatic  #75                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     176: invokespecial #78                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     179: invokevirtual #82                 // Method kotlin/collections/ArrayDeque.add:(Ljava/lang/Object;)Z
     182: pop
     183: iload         4
     185: iload         5
     187: if_icmpeq     200
     190: iload         4
     192: iload         6
     194: iadd
     195: istore        4
     197: goto          74
     200: aload_2
     201: areturn
}


/**
 * Swap two elements in an array.
 */
private fun swap(arr: Array<Int>, i: Int, j: Int) {
    val temp = arr[i]
    arr[i] = arr[j]
    arr[j] = temp
}

/**
 * Partition the array around two pivots.
 * Return the indices of the pivots.
 */
private fun partition(arr: Array<Int>, left: Int, right: Int): Pair<Int, Int> {
    if (arr[left] > arr[right]) swap(arr, left, right)
    val leftPivot = arr[left]
    val rightPivot = arr[right]

    var leftPivotIndex = left
    var rightPivotIndex = right

    for (index in leftPivotIndex+1 until rightPivotIndex) {
        if (arr[index] < leftPivot) {
            leftPivotIndex++
            swap(arr, leftPivotIndex, index)
        } else if (arr[index] >= rightPivot) {
            while (arr[rightPivotIndex-1] > rightPivot && index < rightPivotIndex-1) rightPivotIndex--

            rightPivotIndex--
            swap(arr, rightPivotIndex, index)

            if (arr[index] < leftPivot) {
                leftPivotIndex++
                swap(arr, leftPivotIndex, index)
            }
        }
    }

    swap(arr, left, leftPivotIndex)
    swap(arr, right, rightPivotIndex)

    return Pair(leftPivotIndex, rightPivotIndex)
}

/**
 * Quick sort the array using two pivots.
 */
private fun quickSortDualPivot(arr: Array<Int>, left: Int, right: Int) {
    if (left < right) {
        val pivotIndices = partition(arr, left, right)
        quickSortDualPivot(arr, left, pivotIndices.first - 1)
        quickSortDualPivot(arr, pivotIndices.first + 1, pivotIndices.second - 1)
        quickSortDualPivot(arr, pivotIndices.second + 1, right)
    }
}

fun main() {

    val arrayOfIntegers = readLine()?.trimEnd()?.split(" ")?.map { it.toInt() }?.toTypedArray() ?: return

    quickSortDualPivot(arrayOfIntegers, 0, arrayOfIntegers.size-1)

    arrayOfIntegers.forEach { print("$it ") }
}

Compiled from "QuicksortDualPivot.kt"
public final class QuicksortDualPivotKt {
  private static final void swap(java.lang.Integer[], int, int);
    Code:
       0: aload_0
       1: iload_1
       2: aaload
       3: invokevirtual #12                 // Method java/lang/Integer.intValue:()I
       6: istore_3
       7: aload_0
       8: iload_1
       9: aload_0
      10: iload_2
      11: aaload
      12: aastore
      13: aload_0
      14: iload_2
      15: iload_3
      16: invokestatic  #16                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      19: aastore
      20: return

  private static final kotlin.Pair<java.lang.Integer, java.lang.Integer> partition(java.lang.Integer[], int, int);
    Code:
       0: aload_0
       1: iload_1
       2: aaload
       3: invokevirtual #12                 // Method java/lang/Integer.intValue:()I
       6: aload_0
       7: iload_2
       8: aaload
       9: invokevirtual #12                 // Method java/lang/Integer.intValue:()I
      12: if_icmple     21
      15: aload_0
      16: iload_1
      17: iload_2
      18: invokestatic  #27                 // Method swap:([Ljava/lang/Integer;II)V
      21: aload_0
      22: iload_1
      23: aaload
      24: invokevirtual #12                 // Method java/lang/Integer.intValue:()I
      27: istore_3
      28: aload_0
      29: iload_2
      30: aaload
      31: invokevirtual #12                 // Method java/lang/Integer.intValue:()I
      34: istore        4
      36: iload_1
      37: istore        5
      39: iload_2
      40: istore        6
      42: iload         5
      44: iconst_1
      45: iadd
      46: istore        7
      48: iload         6
      50: istore        8
      52: iload         7
      54: iload         8
      56: if_icmpge     164
      59: aload_0
      60: iload         7
      62: aaload
      63: invokevirtual #12                 // Method java/lang/Integer.intValue:()I
      66: iload_3
      67: if_icmpge     84
      70: iinc          5, 1
      73: aload_0
      74: iload         5
      76: iload         7
      78: invokestatic  #27                 // Method swap:([Ljava/lang/Integer;II)V
      81: goto          158
      84: aload_0
      85: iload         7
      87: aaload
      88: invokevirtual #12                 // Method java/lang/Integer.intValue:()I
      91: iload         4
      93: if_icmplt     158
      96: aload_0
      97: iload         6
      99: iconst_1
     100: isub
     101: aaload
     102: invokevirtual #12                 // Method java/lang/Integer.intValue:()I
     105: iload         4
     107: if_icmple     125
     110: iload         7
     112: iload         6
     114: iconst_1
     115: isub
     116: if_icmpge     125
     119: iinc          6, -1
     122: goto          96
     125: iinc          6, -1
     128: aload_0
     129: iload         6
     131: iload         7
     133: invokestatic  #27                 // Method swap:([Ljava/lang/Integer;II)V
     136: aload_0
     137: iload         7
     139: aaload
     140: invokevirtual #12                 // Method java/lang/Integer.intValue:()I
     143: iload_3
     144: if_icmpge     158
     147: iinc          5, 1
     150: aload_0
     151: iload         5
     153: iload         7
     155: invokestatic  #27                 // Method swap:([Ljava/lang/Integer;II)V
     158: iinc          7, 1
     161: goto          52
     164: aload_0
     165: iload_1
     166: iload         5
     168: invokestatic  #27                 // Method swap:([Ljava/lang/Integer;II)V
     171: aload_0
     172: iload_2
     173: iload         6
     175: invokestatic  #27                 // Method swap:([Ljava/lang/Integer;II)V
     178: new           #29                 // class kotlin/Pair
     181: dup
     182: iload         5
     184: invokestatic  #16                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     187: iload         6
     189: invokestatic  #16                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     192: invokespecial #33                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     195: areturn

  private static final void quickSortDualPivot(java.lang.Integer[], int, int);
    Code:
       0: iload_1
       1: iload_2
       2: if_icmpge     74
       5: aload_0
       6: iload_1
       7: iload_2
       8: invokestatic  #44                 // Method partition:([Ljava/lang/Integer;II)Lkotlin/Pair;
      11: astore_3
      12: aload_0
      13: iload_1
      14: aload_3
      15: invokevirtual #48                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      18: checkcast     #50                 // class java/lang/Number
      21: invokevirtual #51                 // Method java/lang/Number.intValue:()I
      24: iconst_1
      25: isub
      26: invokestatic  #53                 // Method quickSortDualPivot:([Ljava/lang/Integer;II)V
      29: aload_0
      30: aload_3
      31: invokevirtual #48                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      34: checkcast     #50                 // class java/lang/Number
      37: invokevirtual #51                 // Method java/lang/Number.intValue:()I
      40: iconst_1
      41: iadd
      42: aload_3
      43: invokevirtual #56                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      46: checkcast     #50                 // class java/lang/Number
      49: invokevirtual #51                 // Method java/lang/Number.intValue:()I
      52: iconst_1
      53: isub
      54: invokestatic  #53                 // Method quickSortDualPivot:([Ljava/lang/Integer;II)V
      57: aload_0
      58: aload_3
      59: invokevirtual #56                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      62: checkcast     #50                 // class java/lang/Number
      65: invokevirtual #51                 // Method java/lang/Number.intValue:()I
      68: iconst_1
      69: iadd
      70: iload_2
      71: invokestatic  #53                 // Method quickSortDualPivot:([Ljava/lang/Integer;II)V
      74: return

  public static final void main();
    Code:
       0: invokestatic  #66                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       3: dup
       4: ifnull        182
       7: checkcast     #68                 // class java/lang/CharSequence
      10: invokestatic  #74                 // Method kotlin/text/StringsKt.trimEnd:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      13: invokevirtual #77                 // Method java/lang/Object.toString:()Ljava/lang/String;
      16: dup
      17: ifnull        182
      20: checkcast     #68                 // class java/lang/CharSequence
      23: iconst_1
      24: anewarray     #79                 // class java/lang/String
      27: astore        4
      29: aload         4
      31: iconst_0
      32: ldc           #81                 // String
      34: aastore
      35: aload         4
      37: iconst_0
      38: iconst_0
      39: bipush        6
      41: aconst_null
      42: invokestatic  #85                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      45: dup
      46: ifnull        182
      49: checkcast     #87                 // class java/lang/Iterable
      52: astore        5
      54: iconst_0
      55: istore        6
      57: aload         5
      59: astore        7
      61: new           #89                 // class java/util/ArrayList
      64: dup
      65: aload         5
      67: bipush        10
      69: invokestatic  #95                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      72: invokespecial #98                 // Method java/util/ArrayList."<init>":(I)V
      75: checkcast     #100                // class java/util/Collection
      78: astore        8
      80: iconst_0
      81: istore        9
      83: aload         7
      85: invokeinterface #104,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      90: astore        10
      92: aload         10
      94: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      99: ifeq          146
     102: aload         10
     104: invokeinterface #113,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     109: astore        11
     111: aload         8
     113: aload         11
     115: checkcast     #79                 // class java/lang/String
     118: astore        12
     120: astore        14
     122: iconst_0
     123: istore        13
     125: aload         12
     127: invokestatic  #117                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     130: nop
     131: invokestatic  #16                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     134: aload         14
     136: swap
     137: invokeinterface #121,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     142: pop
     143: goto          92
     146: aload         8
     148: checkcast     #123                // class java/util/List
     151: nop
     152: checkcast     #100                // class java/util/Collection
     155: astore        6
     157: iconst_0
     158: istore        7
     160: aload         6
     162: astore        8
     164: aload         8
     166: iconst_0
     167: anewarray     #8                  // class java/lang/Integer
     170: invokeinterface #127,  2          // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     175: checkcast     #41                 // class "[Ljava/lang/Integer;"
     178: dup
     179: ifnonnull     184
     182: pop
     183: return
     184: astore_0
     185: aload_0
     186: iconst_0
     187: aload_0
     188: arraylength
     189: iconst_1
     190: isub
     191: invokestatic  #53                 // Method quickSortDualPivot:([Ljava/lang/Integer;II)V
     194: aload_0
     195: astore_1
     196: iconst_0
     197: istore_2
     198: iconst_0
     199: istore_3
     200: aload_1
     201: arraylength
     202: istore        4
     204: iload_3
     205: iload         4
     207: if_icmpge     263
     210: aload_1
     211: iload_3
     212: aaload
     213: astore        5
     215: aload         5
     217: checkcast     #50                 // class java/lang/Number
     220: invokevirtual #51                 // Method java/lang/Number.intValue:()I
     223: istore        6
     225: iconst_0
     226: istore        7
     228: new           #129                // class java/lang/StringBuilder
     231: dup
     232: invokespecial #131                // Method java/lang/StringBuilder."<init>":()V
     235: iload         6
     237: invokevirtual #135                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     240: bipush        32
     242: invokevirtual #138                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     245: invokevirtual #139                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     248: getstatic     #145                // Field java/lang/System.out:Ljava/io/PrintStream;
     251: swap
     252: invokevirtual #151                // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
     255: nop
     256: nop
     257: iinc          3, 1
     260: goto          204
     263: nop
     264: return

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #177                // Method main:()V
       3: return
}


/**
 * Given a set of distinct positive integers nums,
 * return the largest subset answer such that every pair (answer[i], answer[j]) of elements in this subset satisfies:
 *
 * answer[i] % answer[j] == 0, or
 * answer[j] % answer[i] == 0
 * If there are multiple solutions, return any of them.
 *
 *
 *
 * Example 1:
 *
 * Input: nums = [1,2,3]
 * Output: [1,2]
 * Explanation: [1,3] is also accepted.
 * Example 2:
 *
 * Input: nums = [1,2,4,8]
 * Output: [1,2,4,8]
 *
 *
 * Constraints:
 *
 * 1 <= nums.length <= 1000
 * 1 <= nums[i] <= 2 * 10^9
 * All the integers in nums are unique.
 * @see LeetCode
 */
fun largestDivisibleSubset(nums: IntArray): List<Int> {
    val sortedNums = nums.sorted()
    val subsets = MutableList(sortedNums.size) { listOf<Int>() }
    var largestSubsetIndex = 0

    for ((index, num) in sortedNums.withIndex()) {
        var currentSubset = listOf(num)
        for (previousIndex in 0 until index) {
            val previousSubset = subsets[previousIndex]
            if (num % previousSubset.last() == 0 && previousSubset.size >= currentSubset.size) {
                currentSubset = previousSubset + num
            }
        }
        subsets[index] = currentSubset
        if (subsets[index].size > subsets[largestSubsetIndex].size) {
            largestSubsetIndex = index
        }
    }

    return subsets[largestSubsetIndex]
}

Compiled from "LargestDivisibleSubset.kt"
public final class LargestDivisibleSubsetKt {
  public static final java.util.List<java.lang.Integer> largestDivisibleSubset(int[]);
    Code:
       0: aload_0
       1: ldc           #10                 // String nums
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokestatic  #21                 // Method kotlin/collections/ArraysKt.sorted:([I)Ljava/util/List;
      10: astore_1
      11: aload_1
      12: invokeinterface #27,  1           // InterfaceMethod java/util/List.size:()I
      17: istore_3
      18: new           #29                 // class java/util/ArrayList
      21: dup
      22: iload_3
      23: invokespecial #33                 // Method java/util/ArrayList."<init>":(I)V
      26: astore        4
      28: iconst_0
      29: istore        5
      31: iload         5
      33: iload_3
      34: if_icmpge     69
      37: iload         5
      39: istore        6
      41: aload         4
      43: iload         6
      45: istore        7
      47: astore        11
      49: iconst_0
      50: istore        8
      52: invokestatic  #39                 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
      55: nop
      56: aload         11
      58: swap
      59: invokevirtual #43                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      62: pop
      63: iinc          5, 1
      66: goto          31
      69: aload         4
      71: checkcast     #23                 // class java/util/List
      74: astore_2
      75: iconst_0
      76: istore_3
      77: aload_1
      78: checkcast     #45                 // class java/lang/Iterable
      81: invokeinterface #49,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      86: astore        4
      88: iconst_0
      89: istore        5
      91: aload         4
      93: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      98: ifeq          265
     101: iload         5
     103: istore        6
     105: iload         5
     107: iconst_1
     108: iadd
     109: istore        5
     111: aload         4
     113: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     118: checkcast     #61                 // class java/lang/Number
     121: invokevirtual #64                 // Method java/lang/Number.intValue:()I
     124: istore        7
     126: iload         7
     128: invokestatic  #70                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     131: invokestatic  #74                 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     134: astore        8
     136: iconst_0
     137: istore        9
     139: iload         9
     141: iload         6
     143: if_icmpge     214
     146: aload_2
     147: iload         9
     149: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     154: checkcast     #23                 // class java/util/List
     157: astore        10
     159: iload         7
     161: aload         10
     163: invokestatic  #82                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     166: checkcast     #61                 // class java/lang/Number
     169: invokevirtual #64                 // Method java/lang/Number.intValue:()I
     172: irem
     173: ifne          208
     176: aload         10
     178: invokeinterface #27,  1           // InterfaceMethod java/util/List.size:()I
     183: aload         8
     185: invokeinterface #27,  1           // InterfaceMethod java/util/List.size:()I
     190: if_icmplt     208
     193: aload         10
     195: checkcast     #84                 // class java/util/Collection
     198: iload         7
     200: invokestatic  #70                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     203: invokestatic  #88                 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;
     206: astore        8
     208: iinc          9, 1
     211: goto          139
     214: aload_2
     215: iload         6
     217: aload         8
     219: invokeinterface #92,  3           // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
     224: pop
     225: aload_2
     226: iload         6
     228: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     233: checkcast     #23                 // class java/util/List
     236: invokeinterface #27,  1           // InterfaceMethod java/util/List.size:()I
     241: aload_2
     242: iload_3
     243: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     248: checkcast     #23                 // class java/util/List
     251: invokeinterface #27,  1           // InterfaceMethod java/util/List.size:()I
     256: if_icmple     91
     259: iload         6
     261: istore_3
     262: goto          91
     265: aload_2
     266: iload_3
     267: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     272: checkcast     #23                 // class java/util/List
     275: areturn
}


/**
 * You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation.
 *
 * Evaluate the expression. Return an integer that represents the value of the expression.
 *
 * Note that:
 *
 * The valid operators are '+', '-', '*', and '/'.
 * Each operand may be an integer or another expression.
 * The division between two integers always truncates toward zero.
 * There will not be any division by zero.
 * The input represents a valid arithmetic expression in a reverse polish notation.
 * The answer and all the intermediate calculations can be represented in a 32-bit integer.
 *
 *
 * Example 1:
 *
 * Input: tokens = ["2","1","+","3","*"]
 * Output: 9
 * Explanation: ((2 + 1) * 3) = 9
 * Example 2:
 *
 * Input: tokens = ["4","13","5","/","+"]
 * Output: 6
 * Explanation: (4 + (13 / 5)) = 6
 * Example 3:
 *
 * Input: tokens = ["10","6","9","3","+","-11","*","/","*","17","+","5","+"]
 * Output: 22
 * Explanation: ((10 * (6 / ((9 + 3) * -11))) + 17) + 5
 * = ((10 * (6 / (12 * -11))) + 17) + 5
 * = ((10 * (6 / -132)) + 17) + 5
 * = ((10 * 0) + 17) + 5
 * = (0 + 17) + 5
 * = 17 + 5
 * = 22
 *
 *
 * Constraints:
 *
 * 1 <= tokens.length <= 104
 * tokens[i] is either an operator: "+", "-", "*", or "/", or an integer in the range [-200, 200].
 * @see LeetCode
 */
fun evalRPN(tokens: Array<String>): Int {
    val listOfOperators = listOf("+", "-", "*", "/")

    val stack = ArrayDeque<Int>()
    tokens.forEach { token ->
        if (token in listOfOperators) {
            val operand2 = stack.removeLast()
            val operand1 = stack.removeLast()
            val result = operate(operand1, operand2, token)
            stack.addLast(result)
        } else {
            stack.addLast(token.toInt())
        }
    }
    return stack.last()
}

private fun operate(operand1: Int, operand2: Int, operator: String) = when (operator) {
    "+" -> operand1 + operand2
    "-" -> operand1 - operand2
    "*" -> operand1 * operand2
    "/" -> operand1 / operand2
    else -> 0
}

Compiled from "EvaluateReversePolishNotation.kt"
public final class EvaluateReversePolishNotationKt {
  public static final int evalRPN(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #9                  // String tokens
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_4
       7: anewarray     #17                 // class java/lang/String
      10: astore_2
      11: aload_2
      12: iconst_0
      13: ldc           #19                 // String +
      15: aastore
      16: aload_2
      17: iconst_1
      18: ldc           #21                 // String -
      20: aastore
      21: aload_2
      22: iconst_2
      23: ldc           #23                 // String *
      25: aastore
      26: aload_2
      27: iconst_3
      28: ldc           #25                 // String /
      30: aastore
      31: aload_2
      32: invokestatic  #31                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      35: astore_1
      36: new           #33                 // class kotlin/collections/ArrayDeque
      39: dup
      40: invokespecial #37                 // Method kotlin/collections/ArrayDeque."<init>":()V
      43: astore_2
      44: aload_0
      45: astore_3
      46: iconst_0
      47: istore        4
      49: iconst_0
      50: istore        5
      52: aload_3
      53: arraylength
      54: istore        6
      56: iload         5
      58: iload         6
      60: if_icmpge     154
      63: aload_3
      64: iload         5
      66: aaload
      67: astore        7
      69: aload         7
      71: astore        8
      73: iconst_0
      74: istore        9
      76: aload_1
      77: aload         8
      79: invokeinterface #43,  2           // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
      84: ifeq          134
      87: aload_2
      88: invokevirtual #47                 // Method kotlin/collections/ArrayDeque.removeLast:()Ljava/lang/Object;
      91: checkcast     #49                 // class java/lang/Number
      94: invokevirtual #53                 // Method java/lang/Number.intValue:()I
      97: istore        10
      99: aload_2
     100: invokevirtual #47                 // Method kotlin/collections/ArrayDeque.removeLast:()Ljava/lang/Object;
     103: checkcast     #49                 // class java/lang/Number
     106: invokevirtual #53                 // Method java/lang/Number.intValue:()I
     109: istore        11
     111: iload         11
     113: iload         10
     115: aload         8
     117: invokestatic  #57                 // Method operate:(IILjava/lang/String;)I
     120: istore        12
     122: aload_2
     123: iload         12
     125: invokestatic  #63                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     128: invokevirtual #67                 // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
     131: goto          146
     134: aload_2
     135: aload         8
     137: invokestatic  #71                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     140: invokestatic  #63                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     143: invokevirtual #67                 // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
     146: nop
     147: nop
     148: iinc          5, 1
     151: goto          56
     154: nop
     155: aload_2
     156: invokevirtual #74                 // Method kotlin/collections/ArrayDeque.last:()Ljava/lang/Object;
     159: checkcast     #49                 // class java/lang/Number
     162: invokevirtual #53                 // Method java/lang/Number.intValue:()I
     165: ireturn

  private static final int operate(int, int, java.lang.String);
    Code:
       0: aload_2
       1: astore_3
       2: aload_3
       3: invokevirtual #95                 // Method java/lang/String.hashCode:()I
       6: tableswitch   { // 42 to 47
                    42: 44
                    43: 56
                    44: 116
                    45: 68
                    46: 116
                    47: 80
               default: 116
          }
      44: aload_3
      45: ldc           #23                 // String *
      47: invokevirtual #98                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      50: ifne          104
      53: goto          116
      56: aload_3
      57: ldc           #19                 // String +
      59: invokevirtual #98                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      62: ifne          92
      65: goto          116
      68: aload_3
      69: ldc           #21                 // String -
      71: invokevirtual #98                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      74: ifne          98
      77: goto          116
      80: aload_3
      81: ldc           #25                 // String /
      83: invokevirtual #98                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      86: ifne          110
      89: goto          116
      92: iload_0
      93: iload_1
      94: iadd
      95: goto          117
      98: iload_0
      99: iload_1
     100: isub
     101: goto          117
     104: iload_0
     105: iload_1
     106: imul
     107: goto          117
     110: iload_0
     111: iload_1
     112: idiv
     113: goto          117
     116: iconst_0
     117: ireturn
}


/**
 * For an integer array nums, an inverse pair is a pair of integers [i, j] where 0 <= i < j < nums.length and nums[i] > nums[j].
 *
 * Given two integers n and k, return the number of different arrays consist of numbers from 1 to n such that there are exactly k inverse pairs.
 * Since the answer can be huge, return it modulo 10^9 + 7.
 *
 *
 *
 * Example 1:
 *
 * Input: n = 3, k = 0
 * Output: 1
 * Explanation: Only the array [1,2,3] which consists of numbers from 1 to 3 has exactly 0 inverse pairs.
 * Example 2:
 *
 * Input: n = 3, k = 1
 * Output: 2
 * Explanation: The array [1,3,2] and [2,1,3] have exactly 1 inverse pair.
 *
 *
 * Constraints:
 *
 * 1 <= n <= 1000
 * 0 <= k <= 1000
 * @see LeetCode
 */
fun kInversePairs(n: Int, k: Int): Int {
    val memoryArray = Array<IntArray>(n + 1) { IntArray(k + 1) { -1 } }
    return numberOfArrays(n, k, memoryArray)
}

fun numberOfArrays(numberOfElements: Int, numberOfInversePairsRequired: Int, memoryArray: Array<IntArray>): Int {
    // since 1 <= numberOfElements, numberOfInversePairsRequired = 0 can only be achieved in one way,
    // by arranging the elements of the array in increasing order
    if (numberOfInversePairsRequired == 0) {
        return 1
    }
    // if numberOfInversePairsRequired is non zero, it cannot be achieved with just one element
    if (numberOfElements == 1 || numberOfInversePairsRequired < 0) {
        return 0
    }
    if (memoryArray[numberOfElements][numberOfInversePairsRequired] != -1) {
        return memoryArray[numberOfElements][numberOfInversePairsRequired]
    }
    var totalNumberOfArrays = 0
    for (numberOfInversePairsEncountered in 0 until numberOfElements) {
        totalNumberOfArrays = (
            totalNumberOfArrays +
                numberOfArrays(
                    numberOfElements - 1,
                    numberOfInversePairsRequired - numberOfInversePairsEncountered,
                    memoryArray
                )
            ).mod(1_00_00_00_007)
    }
    memoryArray[numberOfElements][numberOfInversePairsRequired] = totalNumberOfArrays
    return totalNumberOfArrays
}

Compiled from "KInversePairsArray.kt"
public final class KInversePairsArrayKt {
  public static final int kInversePairs(int, int);
    Code:
       0: iconst_0
       1: istore_3
       2: iload_0
       3: iconst_1
       4: iadd
       5: istore        4
       7: iload         4
       9: anewarray     #8                  // class "[I"
      12: astore        5
      14: iload_3
      15: iload         4
      17: if_icmpge     81
      20: iload_3
      21: istore        6
      23: aload         5
      25: iload         6
      27: iconst_0
      28: istore        7
      30: iload_1
      31: iconst_1
      32: iadd
      33: istore        8
      35: iload         8
      37: newarray       int
      39: astore        9
      41: istore        12
      43: astore        11
      45: iload         7
      47: iload         8
      49: if_icmpge     68
      52: iload         7
      54: istore        10
      56: aload         9
      58: iload         10
      60: iconst_m1
      61: iastore
      62: iinc          7, 1
      65: goto          45
      68: aload         11
      70: iload         12
      72: aload         9
      74: aastore
      75: iinc          3, 1
      78: goto          14
      81: aload         5
      83: astore_2
      84: iload_0
      85: iload_1
      86: aload_2
      87: invokestatic  #12                 // Method numberOfArrays:(II[[I)I
      90: ireturn

  public static final int numberOfArrays(int, int, int[][]);
    Code:
       0: aload_2
       1: ldc           #20                 // String memoryArray
       3: invokestatic  #26                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iload_1
       7: ifne          12
      10: iconst_1
      11: ireturn
      12: iload_0
      13: iconst_1
      14: if_icmpeq     21
      17: iload_1
      18: ifge          23
      21: iconst_0
      22: ireturn
      23: aload_2
      24: iload_0
      25: aaload
      26: iload_1
      27: iaload
      28: iconst_m1
      29: if_icmpeq     38
      32: aload_2
      33: iload_0
      34: aaload
      35: iload_1
      36: iaload
      37: ireturn
      38: iconst_0
      39: istore_3
      40: iconst_0
      41: istore        4
      43: iload         4
      45: iload_0
      46: if_icmpge     103
      49: iload_3
      50: iload_0
      51: iconst_1
      52: isub
      53: iload_1
      54: iload         4
      56: isub
      57: aload_2
      58: invokestatic  #12                 // Method numberOfArrays:(II[[I)I
      61: iadd
      62: istore        5
      64: ldc           #27                 // int 1000000007
      66: istore        6
      68: iload         5
      70: iload         6
      72: irem
      73: istore        7
      75: iload         7
      77: iload         6
      79: iload         7
      81: iload         6
      83: ixor
      84: iload         7
      86: iload         7
      88: ineg
      89: ior
      90: iand
      91: bipush        31
      93: ishr
      94: iand
      95: iadd
      96: istore_3
      97: iinc          4, 1
     100: goto          43
     103: aload_2
     104: iload_0
     105: aaload
     106: iload_1
     107: iload_3
     108: iastore
     109: iload_3
     110: ireturn
}


/**
 * Given two strings s and t of lengths m and n respectively, return the minimum window
 * substring
 * of s such that every character in t (including duplicates) is included in the window.
 * If there is no such substring, return the empty string "".
 *
 * The testcases will be generated such that the answer is unique.
 *
 *
 *
 * Example 1:
 *
 * Input: s = "ADOBECODEBANC", t = "ABC"
 * Output: "BANC"
 * Explanation: The minimum window substring "BANC" includes 'A', 'B', and 'C' from string t.
 * Example 2:
 *
 * Input: s = "a", t = "a"
 * Output: "a"
 * Explanation: The entire string s is the minimum window.
 * Example 3:
 *
 * Input: s = "a", t = "aa"
 * Output: ""
 * Explanation: Both 'a's from t must be included in the window.
 * Since the largest window of s only has one 'a', return empty string.
 *
 *
 * Constraints:
 *
 * m == s.length
 * n == t.length
 * 1 <= m, n <= 10^5
 * s and t consist of uppercase and lowercase English letters.
 *
 *
 * Follow up: Could you find an algorithm that runs in O(m + n) time?
 * @see <a https://leetcode.com/problems/minimum-window-substring/">LeetCode</a>
 */
fun minWindow(s: String, t: String): String {
    val sFrequencyMap = mutableMapOf<Char, Int>()
    val tFrequencyMap = mutableMapOf<Char, Int>()

    t.forEach { char ->
        tFrequencyMap[char] = 1 + tFrequencyMap.getOrDefault(char, 0)
    }

    var start = 0
    var end = 0
    var minWindowStart = 0
    var minWindowLength = Int.MAX_VALUE
    var requiredChars = tFrequencyMap.size

    while (start < s.length && end < s.length) {
        while (end < s.length && requiredChars > 0) {
            val endChar = s[end]
            sFrequencyMap[endChar] = 1 + sFrequencyMap.getOrDefault(endChar, 0)
            if (sFrequencyMap[endChar] == tFrequencyMap[endChar]) {
                requiredChars--
            }
            end++
        }
        if (requiredChars > 0) {
            break
        }
        var startChar = s[start]
        while (!tFrequencyMap.containsKey(startChar) || sFrequencyMap[startChar]!! > tFrequencyMap[startChar]!!) {
            sFrequencyMap[startChar] = sFrequencyMap[startChar]!! - 1
            start++
            startChar = s[start]
        }
        if (end - start < minWindowLength) {
            minWindowLength = end - start
            minWindowStart = start
        }
        sFrequencyMap[startChar] = sFrequencyMap[startChar]!! - 1
        requiredChars++
        start++
    }

    return if (minWindowLength == Int.MAX_VALUE) {
        ""
    } else {
        s.substring(minWindowStart until minWindowStart + minWindowLength)
    }
}

Compiled from "MinimumWindowSubstring.kt"
public final class MinimumWindowSubstringKt {
  public static final java.lang.String minWindow(java.lang.String, java.lang.String);
    Code:
       0: aload_0
       1: ldc           #9                  // String s
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #17                 // String t
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #19                 // class java/util/LinkedHashMap
      15: dup
      16: invokespecial #23                 // Method java/util/LinkedHashMap."<init>":()V
      19: checkcast     #25                 // class java/util/Map
      22: astore_2
      23: new           #19                 // class java/util/LinkedHashMap
      26: dup
      27: invokespecial #23                 // Method java/util/LinkedHashMap."<init>":()V
      30: checkcast     #25                 // class java/util/Map
      33: astore_3
      34: aload_1
      35: checkcast     #27                 // class java/lang/CharSequence
      38: astore        4
      40: iconst_0
      41: istore        5
      43: iconst_0
      44: istore        6
      46: iload         6
      48: aload         4
      50: invokeinterface #31,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      55: if_icmpge     126
      58: aload         4
      60: iload         6
      62: invokeinterface #35,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      67: istore        7
      69: iload         7
      71: istore        8
      73: iconst_0
      74: istore        9
      76: iload         8
      78: invokestatic  #41                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      81: astore        10
      83: aload_3
      84: aload         10
      86: iconst_1
      87: aload_3
      88: iload         8
      90: invokestatic  #41                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      93: iconst_0
      94: invokestatic  #46                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      97: invokeinterface #50,  3           // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     102: checkcast     #52                 // class java/lang/Number
     105: invokevirtual #55                 // Method java/lang/Number.intValue:()I
     108: iadd
     109: invokestatic  #46                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     112: invokeinterface #58,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     117: pop
     118: nop
     119: nop
     120: iinc          6, 1
     123: goto          46
     126: nop
     127: iconst_0
     128: istore        4
     130: iconst_0
     131: istore        5
     133: iconst_0
     134: istore        6
     136: ldc           #59                 // int 2147483647
     138: istore        7
     140: aload_3
     141: invokeinterface #62,  1           // InterfaceMethod java/util/Map.size:()I
     146: istore        8
     148: iload         4
     150: aload_0
     151: invokevirtual #65                 // Method java/lang/String.length:()I
     154: if_icmpge     470
     157: iload         5
     159: aload_0
     160: invokevirtual #65                 // Method java/lang/String.length:()I
     163: if_icmpge     470
     166: iload         5
     168: aload_0
     169: invokevirtual #65                 // Method java/lang/String.length:()I
     172: if_icmpge     267
     175: iload         8
     177: ifle          267
     180: aload_0
     181: iload         5
     183: invokevirtual #66                 // Method java/lang/String.charAt:(I)C
     186: istore        9
     188: iload         9
     190: invokestatic  #41                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     193: astore        11
     195: aload_2
     196: aload         11
     198: iconst_1
     199: aload_2
     200: iload         9
     202: invokestatic  #41                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     205: iconst_0
     206: invokestatic  #46                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     209: invokeinterface #50,  3           // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     214: checkcast     #52                 // class java/lang/Number
     217: invokevirtual #55                 // Method java/lang/Number.intValue:()I
     220: iadd
     221: invokestatic  #46                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     224: invokeinterface #58,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     229: pop
     230: aload_2
     231: iload         9
     233: invokestatic  #41                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     236: invokeinterface #70,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     241: aload_3
     242: iload         9
     244: invokestatic  #41                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     247: invokeinterface #70,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     252: invokestatic  #74                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     255: ifeq          261
     258: iinc          8, -1
     261: iinc          5, 1
     264: goto          166
     267: iload         8
     269: ifle          275
     272: goto          470
     275: aload_0
     276: iload         4
     278: invokevirtual #66                 // Method java/lang/String.charAt:(I)C
     281: istore        9
     283: aload_3
     284: iload         9
     286: invokestatic  #41                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     289: invokeinterface #78,  2           // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
     294: ifeq          342
     297: aload_2
     298: iload         9
     300: invokestatic  #41                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     303: invokeinterface #70,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     308: dup
     309: invokestatic  #82                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     312: checkcast     #52                 // class java/lang/Number
     315: invokevirtual #55                 // Method java/lang/Number.intValue:()I
     318: aload_3
     319: iload         9
     321: invokestatic  #41                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     324: invokeinterface #70,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     329: dup
     330: invokestatic  #82                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     333: checkcast     #52                 // class java/lang/Number
     336: invokevirtual #55                 // Method java/lang/Number.intValue:()I
     339: if_icmple     398
     342: iload         9
     344: invokestatic  #41                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     347: astore        11
     349: aload_2
     350: aload         11
     352: aload_2
     353: iload         9
     355: invokestatic  #41                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     358: invokeinterface #70,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     363: dup
     364: invokestatic  #82                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     367: checkcast     #52                 // class java/lang/Number
     370: invokevirtual #55                 // Method java/lang/Number.intValue:()I
     373: iconst_1
     374: isub
     375: invokestatic  #46                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     378: invokeinterface #58,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     383: pop
     384: iinc          4, 1
     387: aload_0
     388: iload         4
     390: invokevirtual #66                 // Method java/lang/String.charAt:(I)C
     393: istore        9
     395: goto          283
     398: iload         5
     400: iload         4
     402: isub
     403: iload         7
     405: if_icmpge     419
     408: iload         5
     410: iload         4
     412: isub
     413: istore        7
     415: iload         4
     417: istore        6
     419: iload         9
     421: invokestatic  #41                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     424: astore        11
     426: aload_2
     427: aload         11
     429: aload_2
     430: iload         9
     432: invokestatic  #41                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     435: invokeinterface #70,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     440: dup
     441: invokestatic  #82                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     444: checkcast     #52                 // class java/lang/Number
     447: invokevirtual #55                 // Method java/lang/Number.intValue:()I
     450: iconst_1
     451: isub
     452: invokestatic  #46                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     455: invokeinterface #58,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     460: pop
     461: iinc          8, 1
     464: iinc          4, 1
     467: goto          148
     470: iload         7
     472: ldc           #59                 // int 2147483647
     474: if_icmpne     482
     477: ldc           #84                 // String
     479: goto          496
     482: aload_0
     483: iload         6
     485: iload         6
     487: iload         7
     489: iadd
     490: invokestatic  #90                 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
     493: invokestatic  #96                 // Method kotlin/text/StringsKt.substring:(Ljava/lang/String;Lkotlin/ranges/IntRange;)Ljava/lang/String;
     496: areturn
}


/**
 * You are given an integer array nums of size n and a positive integer k.
 *
 * Divide the array into one or more arrays of size 3 satisfying the following conditions:
 *
 * Each element of nums should be in exactly one array.
 * The difference between any two elements in one array is less than or equal to k.
 * Return a 2D array containing all the arrays. If it is impossible to satisfy the conditions, return an empty array.
 * And if there are multiple answers, return any of them.
 *
 *
 *
 * Example 1:
 *
 * Input: nums = [1,3,4,8,7,9,3,5,1], k = 2
 * Output: [[1,1,3],[3,4,5],[7,8,9]]
 * Explanation: We can divide the array into the following arrays: [1,1,3], [3,4,5] and [7,8,9].
 * The difference between any two elements in each array is less than or equal to 2.
 * Note that the order of elements is not important.
 * Example 2:
 *
 * Input: nums = [1,3,3,2,7,3], k = 3
 * Output: []
 * Explanation: It is not possible to divide the array satisfying all the conditions.
 *
 *
 * Constraints:
 *
 * n == nums.length
 * 1 <= n <= 10^5
 * n is a multiple of 3.
 * 1 <= nums[i] <= 10^5
 * 1 <= k <= 10^5
 * @see LeetCode
 */
fun divideArray(nums: IntArray, k: Int): Array<IntArray> {
    val numsSize = nums.size
    val dividedArraysColumns = 3
    val dividedArraysRows = numsSize / dividedArraysColumns
    val sortedNums = nums.sorted()
    val dividedArrays = Array<IntArray>(dividedArraysRows) { IntArray(dividedArraysColumns) }
    for (index in 0 until numsSize) {
        val row = index / dividedArraysColumns
        val column = index.rem(dividedArraysColumns)
        if (column == 0) {
            dividedArrays[row][column] = sortedNums[index]
        } else if (column == 1 && sortedNums[index] - sortedNums[index - 1] <= k) {
            dividedArrays[row][column] = sortedNums[index]
        } else if (column == 2 && sortedNums[index] - sortedNums[index - 2] <= k) {
            dividedArrays[row][column] = sortedNums[index]
        } else {
            return arrayOf<IntArray>()
        }
    }
    return dividedArrays
}

Compiled from "DivideArrayIntoArraysWithMaxDifference.kt"
public final class DivideArrayIntoArraysWithMaxDifferenceKt {
  public static final int[][] divideArray(int[], int);
    Code:
       0: aload_0
       1: ldc           #9                  // String nums
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: arraylength
       8: istore_2
       9: iconst_3
      10: istore_3
      11: iload_2
      12: iload_3
      13: idiv
      14: istore        4
      16: aload_0
      17: invokestatic  #21                 // Method kotlin/collections/ArraysKt.sorted:([I)Ljava/util/List;
      20: astore        5
      22: iconst_0
      23: istore        7
      25: iload         4
      27: anewarray     #23                 // class "[I"
      30: astore        8
      32: iload         7
      34: iload         4
      36: if_icmpge     57
      39: iload         7
      41: istore        9
      43: aload         8
      45: iload         9
      47: iload_3
      48: newarray       int
      50: aastore
      51: iinc          7, 1
      54: goto          32
      57: aload         8
      59: astore        6
      61: iconst_0
      62: istore        7
      64: iload         7
      66: iload_2
      67: if_icmpge     262
      70: iload         7
      72: iload_3
      73: idiv
      74: istore        8
      76: iload         7
      78: iload_3
      79: irem
      80: istore        9
      82: iload         9
      84: ifne          113
      87: aload         6
      89: iload         8
      91: aaload
      92: iload         9
      94: aload         5
      96: iload         7
      98: invokeinterface #29,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     103: checkcast     #31                 // class java/lang/Number
     106: invokevirtual #35                 // Method java/lang/Number.intValue:()I
     109: iastore
     110: goto          256
     113: iload         9
     115: iconst_1
     116: if_icmpne     182
     119: aload         5
     121: iload         7
     123: invokeinterface #29,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     128: checkcast     #31                 // class java/lang/Number
     131: invokevirtual #35                 // Method java/lang/Number.intValue:()I
     134: aload         5
     136: iload         7
     138: iconst_1
     139: isub
     140: invokeinterface #29,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     145: checkcast     #31                 // class java/lang/Number
     148: invokevirtual #35                 // Method java/lang/Number.intValue:()I
     151: isub
     152: iload_1
     153: if_icmpgt     182
     156: aload         6
     158: iload         8
     160: aaload
     161: iload         9
     163: aload         5
     165: iload         7
     167: invokeinterface #29,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     172: checkcast     #31                 // class java/lang/Number
     175: invokevirtual #35                 // Method java/lang/Number.intValue:()I
     178: iastore
     179: goto          256
     182: iload         9
     184: iconst_2
     185: if_icmpne     251
     188: aload         5
     190: iload         7
     192: invokeinterface #29,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     197: checkcast     #31                 // class java/lang/Number
     200: invokevirtual #35                 // Method java/lang/Number.intValue:()I
     203: aload         5
     205: iload         7
     207: iconst_2
     208: isub
     209: invokeinterface #29,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     214: checkcast     #31                 // class java/lang/Number
     217: invokevirtual #35                 // Method java/lang/Number.intValue:()I
     220: isub
     221: iload_1
     222: if_icmpgt     251
     225: aload         6
     227: iload         8
     229: aaload
     230: iload         9
     232: aload         5
     234: iload         7
     236: invokeinterface #29,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     241: checkcast     #31                 // class java/lang/Number
     244: invokevirtual #35                 // Method java/lang/Number.intValue:()I
     247: iastore
     248: goto          256
     251: iconst_0
     252: anewarray     #23                 // class "[I"
     255: areturn
     256: iinc          7, 1
     259: goto          64
     262: aload         6
     264: areturn
}