package com.dijkstra.pathfinder.util

class KalmanFilter3D(
    initialState: List<Double>,
    initialCovariance: List<List<Double>>
) {
    private var state = initialState
    private var covariance = initialCovariance
    private val processNoise = listOf(
        listOf(0.1, 0.0, 0.0),
        listOf(0.0, 0.1, 0.0),
        listOf(0.0, 0.0, 0.1)
    )

    fun update(measurement: List<Double>, measurementNoise: List<Double>): List<Double> {
        val kalmanGain = calculateKalmanGain(measurementNoise)
        val innovation = measurement.zip(state) { m, s -> m - s }
        state = state.zip(
            kalmanGain.map { row ->
                row.zip(innovation) { x, y ->
                    x * y
                }.sum()
            }
        ).map { it.first + it.second }
        covariance = updateCovariance(kalmanGain)
        return state
    }

    private fun calculateKalmanGain(measurementNoise: List<Double>): List<List<Double>> {
        val sum = covariance.zip(processNoise) { a, b -> a.zip(b) { x, y -> x + y } }
        val sumDiagonal = sum.indices.map { sum[it][it] }
        val noisePlusSumDiagonal = measurementNoise.zip(sumDiagonal) { x, y -> x + y }
        return covariance.map { row -> row.zip(noisePlusSumDiagonal) { x, y -> x / y } }
    }

    private fun updateCovariance(kalmanGain: List<List<Double>>): List<List<Double>> {
        val gainTimesCovariance =
            kalmanGain.map { row -> row.zip(covariance) { x, col -> x * col.sum() } }
        val identityMinusGain = gainTimesCovariance.indices.map { i ->
            gainTimesCovariance[i].mapIndexed { j, value -> if (i == j) 1.0 - value else -value }
        }
        return identityMinusGain.map { row -> row.zip(covariance) { x, col -> x * col.sum() } }
    }

}

Compiled from "KalmanFilter3D.kt"
public final class com.dijkstra.pathfinder.util.KalmanFilter3D {
  private java.util.List<java.lang.Double> state;

  private java.util.List<? extends java.util.List<java.lang.Double>> covariance;

  private final java.util.List<java.util.List<java.lang.Double>> processNoise;

  public com.dijkstra.pathfinder.util.KalmanFilter3D(java.util.List<java.lang.Double>, java.util.List<? extends java.util.List<java.lang.Double>>);
    Code:
       0: aload_1
       1: ldc           #10                 // String initialState
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #18                 // String initialCovariance
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokespecial #21                 // Method java/lang/Object."<init>":()V
      16: aload_0
      17: aload_1
      18: putfield      #25                 // Field state:Ljava/util/List;
      21: aload_0
      22: aload_2
      23: putfield      #28                 // Field covariance:Ljava/util/List;
      26: aload_0
      27: iconst_3
      28: anewarray     #30                 // class java/util/List
      31: astore_3
      32: aload_3
      33: iconst_0
      34: iconst_3
      35: anewarray     #32                 // class java/lang/Double
      38: astore        4
      40: aload         4
      42: iconst_0
      43: ldc2_w        #33                 // double 0.1d
      46: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
      49: aastore
      50: aload         4
      52: iconst_1
      53: dconst_0
      54: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
      57: aastore
      58: aload         4
      60: iconst_2
      61: dconst_0
      62: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
      65: aastore
      66: aload         4
      68: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      71: aastore
      72: aload_3
      73: iconst_1
      74: iconst_3
      75: anewarray     #32                 // class java/lang/Double
      78: astore        4
      80: aload         4
      82: iconst_0
      83: dconst_0
      84: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
      87: aastore
      88: aload         4
      90: iconst_1
      91: ldc2_w        #33                 // double 0.1d
      94: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
      97: aastore
      98: aload         4
     100: iconst_2
     101: dconst_0
     102: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     105: aastore
     106: aload         4
     108: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     111: aastore
     112: aload_3
     113: iconst_2
     114: iconst_3
     115: anewarray     #32                 // class java/lang/Double
     118: astore        4
     120: aload         4
     122: iconst_0
     123: dconst_0
     124: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     127: aastore
     128: aload         4
     130: iconst_1
     131: dconst_0
     132: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     135: aastore
     136: aload         4
     138: iconst_2
     139: ldc2_w        #33                 // double 0.1d
     142: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     145: aastore
     146: aload         4
     148: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     151: aastore
     152: aload_3
     153: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     156: putfield      #47                 // Field processNoise:Ljava/util/List;
     159: return

  public final java.util.List<java.lang.Double> update(java.util.List<java.lang.Double>, java.util.List<java.lang.Double>);
    Code:
       0: aload_1
       1: ldc           #54                 // String measurement
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #56                 // String measurementNoise
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_2
      14: invokespecial #60                 // Method calculateKalmanGain:(Ljava/util/List;)Ljava/util/List;
      17: astore_3
      18: aload_1
      19: checkcast     #62                 // class java/lang/Iterable
      22: astore        5
      24: aload_0
      25: getfield      #25                 // Field state:Ljava/util/List;
      28: checkcast     #62                 // class java/lang/Iterable
      31: astore        6
      33: iconst_0
      34: istore        7
      36: aload         5
      38: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      43: astore        8
      45: aload         6
      47: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      52: astore        9
      54: new           #68                 // class java/util/ArrayList
      57: dup
      58: aload         5
      60: bipush        10
      62: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      65: aload         6
      67: bipush        10
      69: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      72: invokestatic  #78                 // Method java/lang/Math.min:(II)I
      75: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
      78: astore        10
      80: aload         8
      82: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      87: ifeq          155
      90: aload         9
      92: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      97: ifeq          155
     100: aload         10
     102: aload         8
     104: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     109: aload         9
     111: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     116: checkcast     #93                 // class java/lang/Number
     119: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     122: dstore        11
     124: checkcast     #93                 // class java/lang/Number
     127: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     130: dstore        13
     132: astore        25
     134: iconst_0
     135: istore        15
     137: dload         13
     139: dload         11
     141: dsub
     142: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     145: aload         25
     147: swap
     148: invokevirtual #101                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     151: pop
     152: goto          80
     155: aload         10
     157: checkcast     #30                 // class java/util/List
     160: astore        4
     162: aload_0
     163: aload_0
     164: getfield      #25                 // Field state:Ljava/util/List;
     167: checkcast     #62                 // class java/lang/Iterable
     170: aload_3
     171: checkcast     #62                 // class java/lang/Iterable
     174: astore        5
     176: astore        26
     178: astore        25
     180: iconst_0
     181: istore        6
     183: aload         5
     185: astore        7
     187: new           #68                 // class java/util/ArrayList
     190: dup
     191: aload         5
     193: bipush        10
     195: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     198: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
     201: checkcast     #103                // class java/util/Collection
     204: astore        8
     206: iconst_0
     207: istore        9
     209: aload         7
     211: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     216: astore        10
     218: aload         10
     220: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     225: ifeq          412
     228: aload         10
     230: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     235: astore        11
     237: aload         8
     239: aload         11
     241: checkcast     #30                 // class java/util/List
     244: astore        12
     246: astore        27
     248: iconst_0
     249: istore        13
     251: aload         12
     253: checkcast     #62                 // class java/lang/Iterable
     256: astore        14
     258: iconst_0
     259: istore        15
     261: aload         14
     263: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     268: astore        16
     270: aload         4
     272: checkcast     #62                 // class java/lang/Iterable
     275: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     280: astore        17
     282: new           #68                 // class java/util/ArrayList
     285: dup
     286: aload         14
     288: bipush        10
     290: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     293: aload         4
     295: checkcast     #62                 // class java/lang/Iterable
     298: bipush        10
     300: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     303: invokestatic  #78                 // Method java/lang/Math.min:(II)I
     306: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
     309: astore        18
     311: aload         16
     313: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     318: ifeq          386
     321: aload         17
     323: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     328: ifeq          386
     331: aload         18
     333: aload         16
     335: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     340: aload         17
     342: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     347: checkcast     #93                 // class java/lang/Number
     350: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     353: dstore        19
     355: checkcast     #93                 // class java/lang/Number
     358: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     361: dstore        21
     363: astore        23
     365: iconst_0
     366: istore        24
     368: dload         21
     370: dload         19
     372: dmul
     373: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     376: aload         23
     378: swap
     379: invokevirtual #101                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     382: pop
     383: goto          311
     386: aload         18
     388: checkcast     #30                 // class java/util/List
     391: checkcast     #62                 // class java/lang/Iterable
     394: invokestatic  #107                // Method kotlin/collections/CollectionsKt.sumOfDouble:(Ljava/lang/Iterable;)D
     397: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     400: aload         27
     402: swap
     403: invokeinterface #108,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     408: pop
     409: goto          218
     412: aload         8
     414: checkcast     #30                 // class java/util/List
     417: nop
     418: astore        27
     420: aload         25
     422: aload         26
     424: aload         27
     426: checkcast     #62                 // class java/lang/Iterable
     429: invokestatic  #112                // Method kotlin/collections/CollectionsKt.zip:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/List;
     432: checkcast     #62                 // class java/lang/Iterable
     435: astore        5
     437: astore        25
     439: iconst_0
     440: istore        6
     442: aload         5
     444: astore        7
     446: new           #68                 // class java/util/ArrayList
     449: dup
     450: aload         5
     452: bipush        10
     454: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     457: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
     460: checkcast     #103                // class java/util/Collection
     463: astore        8
     465: iconst_0
     466: istore        9
     468: aload         7
     470: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     475: astore        10
     477: aload         10
     479: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     484: ifeq          548
     487: aload         10
     489: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     494: astore        11
     496: aload         8
     498: aload         11
     500: checkcast     #114                // class kotlin/Pair
     503: astore        12
     505: astore        26
     507: iconst_0
     508: istore        13
     510: aload         12
     512: invokevirtual #117                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     515: checkcast     #93                 // class java/lang/Number
     518: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     521: aload         12
     523: invokevirtual #120                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     526: checkcast     #93                 // class java/lang/Number
     529: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     532: dadd
     533: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     536: aload         26
     538: swap
     539: invokeinterface #108,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     544: pop
     545: goto          477
     548: aload         8
     550: checkcast     #30                 // class java/util/List
     553: nop
     554: aload         25
     556: swap
     557: putfield      #25                 // Field state:Ljava/util/List;
     560: aload_0
     561: aload_0
     562: aload_3
     563: invokespecial #123                // Method updateCovariance:(Ljava/util/List;)Ljava/util/List;
     566: putfield      #28                 // Field covariance:Ljava/util/List;
     569: aload_0
     570: getfield      #25                 // Field state:Ljava/util/List;
     573: areturn

  private final java.util.List<java.util.List<java.lang.Double>> calculateKalmanGain(java.util.List<java.lang.Double>);
    Code:
       0: aload_0
       1: getfield      #28                 // Field covariance:Ljava/util/List;
       4: checkcast     #62                 // class java/lang/Iterable
       7: astore_3
       8: aload_0
       9: getfield      #47                 // Field processNoise:Ljava/util/List;
      12: checkcast     #62                 // class java/lang/Iterable
      15: astore        4
      17: iconst_0
      18: istore        5
      20: aload_3
      21: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      26: astore        6
      28: aload         4
      30: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      35: astore        7
      37: new           #68                 // class java/util/ArrayList
      40: dup
      41: aload_3
      42: bipush        10
      44: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      47: aload         4
      49: bipush        10
      51: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      54: invokestatic  #78                 // Method java/lang/Math.min:(II)I
      57: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
      60: astore        8
      62: aload         6
      64: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      69: ifeq          264
      72: aload         7
      74: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      79: ifeq          264
      82: aload         8
      84: aload         6
      86: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      91: aload         7
      93: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      98: checkcast     #30                 // class java/util/List
     101: astore        9
     103: checkcast     #30                 // class java/util/List
     106: astore        10
     108: astore        25
     110: iconst_0
     111: istore        11
     113: aload         10
     115: checkcast     #62                 // class java/lang/Iterable
     118: astore        12
     120: iconst_0
     121: istore        13
     123: aload         12
     125: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     130: astore        14
     132: aload         9
     134: checkcast     #62                 // class java/lang/Iterable
     137: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     142: astore        15
     144: new           #68                 // class java/util/ArrayList
     147: dup
     148: aload         12
     150: bipush        10
     152: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     155: aload         9
     157: checkcast     #62                 // class java/lang/Iterable
     160: bipush        10
     162: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     165: invokestatic  #78                 // Method java/lang/Math.min:(II)I
     168: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
     171: astore        16
     173: aload         14
     175: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     180: ifeq          248
     183: aload         15
     185: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     190: ifeq          248
     193: aload         16
     195: aload         14
     197: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     202: aload         15
     204: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     209: checkcast     #93                 // class java/lang/Number
     212: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     215: dstore        17
     217: checkcast     #93                 // class java/lang/Number
     220: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     223: dstore        19
     225: astore        21
     227: iconst_0
     228: istore        22
     230: dload         19
     232: dload         17
     234: dadd
     235: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     238: aload         21
     240: swap
     241: invokevirtual #101                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     244: pop
     245: goto          173
     248: aload         16
     250: checkcast     #30                 // class java/util/List
     253: nop
     254: aload         25
     256: swap
     257: invokevirtual #101                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     260: pop
     261: goto          62
     264: aload         8
     266: checkcast     #30                 // class java/util/List
     269: astore_2
     270: aload_2
     271: checkcast     #103                // class java/util/Collection
     274: invokestatic  #160                // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;
     277: checkcast     #62                 // class java/lang/Iterable
     280: astore        4
     282: iconst_0
     283: istore        5
     285: aload         4
     287: astore        6
     289: new           #68                 // class java/util/ArrayList
     292: dup
     293: aload         4
     295: bipush        10
     297: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     300: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
     303: checkcast     #103                // class java/util/Collection
     306: astore        7
     308: iconst_0
     309: istore        8
     311: aload         6
     313: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     318: astore        9
     320: aload         9
     322: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     327: ifeq          390
     330: aload         9
     332: checkcast     #162                // class kotlin/collections/IntIterator
     335: invokevirtual #166                // Method kotlin/collections/IntIterator.nextInt:()I
     338: istore        10
     340: aload         7
     342: iload         10
     344: istore        11
     346: astore        25
     348: iconst_0
     349: istore        12
     351: aload_2
     352: iload         11
     354: invokeinterface #170,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     359: checkcast     #30                 // class java/util/List
     362: iload         11
     364: invokeinterface #170,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     369: checkcast     #93                 // class java/lang/Number
     372: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     375: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     378: aload         25
     380: swap
     381: invokeinterface #108,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     386: pop
     387: goto          320
     390: aload         7
     392: checkcast     #30                 // class java/util/List
     395: nop
     396: astore_3
     397: aload_1
     398: checkcast     #62                 // class java/lang/Iterable
     401: astore        5
     403: iconst_0
     404: istore        6
     406: aload         5
     408: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     413: astore        7
     415: aload_3
     416: checkcast     #62                 // class java/lang/Iterable
     419: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     424: astore        8
     426: new           #68                 // class java/util/ArrayList
     429: dup
     430: aload         5
     432: bipush        10
     434: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     437: aload_3
     438: checkcast     #62                 // class java/lang/Iterable
     441: bipush        10
     443: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     446: invokestatic  #78                 // Method java/lang/Math.min:(II)I
     449: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
     452: astore        9
     454: aload         7
     456: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     461: ifeq          529
     464: aload         8
     466: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     471: ifeq          529
     474: aload         9
     476: aload         7
     478: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     483: aload         8
     485: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     490: checkcast     #93                 // class java/lang/Number
     493: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     496: dstore        10
     498: checkcast     #93                 // class java/lang/Number
     501: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     504: dstore        12
     506: astore        25
     508: iconst_0
     509: istore        14
     511: dload         12
     513: dload         10
     515: dadd
     516: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     519: aload         25
     521: swap
     522: invokevirtual #101                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     525: pop
     526: goto          454
     529: aload         9
     531: checkcast     #30                 // class java/util/List
     534: astore        4
     536: aload_0
     537: getfield      #28                 // Field covariance:Ljava/util/List;
     540: checkcast     #62                 // class java/lang/Iterable
     543: astore        5
     545: iconst_0
     546: istore        6
     548: aload         5
     550: astore        7
     552: new           #68                 // class java/util/ArrayList
     555: dup
     556: aload         5
     558: bipush        10
     560: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     563: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
     566: checkcast     #103                // class java/util/Collection
     569: astore        8
     571: iconst_0
     572: istore        9
     574: aload         7
     576: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     581: astore        10
     583: aload         10
     585: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     590: ifeq          769
     593: aload         10
     595: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     600: astore        11
     602: aload         8
     604: aload         11
     606: checkcast     #30                 // class java/util/List
     609: astore        12
     611: astore        25
     613: iconst_0
     614: istore        13
     616: aload         12
     618: checkcast     #62                 // class java/lang/Iterable
     621: astore        14
     623: iconst_0
     624: istore        15
     626: aload         14
     628: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     633: astore        16
     635: aload         4
     637: checkcast     #62                 // class java/lang/Iterable
     640: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     645: astore        17
     647: new           #68                 // class java/util/ArrayList
     650: dup
     651: aload         14
     653: bipush        10
     655: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     658: aload         4
     660: checkcast     #62                 // class java/lang/Iterable
     663: bipush        10
     665: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     668: invokestatic  #78                 // Method java/lang/Math.min:(II)I
     671: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
     674: astore        18
     676: aload         16
     678: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     683: ifeq          751
     686: aload         17
     688: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     693: ifeq          751
     696: aload         18
     698: aload         16
     700: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     705: aload         17
     707: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     712: checkcast     #93                 // class java/lang/Number
     715: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     718: dstore        19
     720: checkcast     #93                 // class java/lang/Number
     723: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     726: dstore        21
     728: astore        23
     730: iconst_0
     731: istore        24
     733: dload         21
     735: dload         19
     737: ddiv
     738: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     741: aload         23
     743: swap
     744: invokevirtual #101                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     747: pop
     748: goto          676
     751: aload         18
     753: checkcast     #30                 // class java/util/List
     756: nop
     757: aload         25
     759: swap
     760: invokeinterface #108,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     765: pop
     766: goto          583
     769: aload         8
     771: checkcast     #30                 // class java/util/List
     774: nop
     775: areturn

  private final java.util.List<java.util.List<java.lang.Double>> updateCovariance(java.util.List<? extends java.util.List<java.lang.Double>>);
    Code:
       0: aload_1
       1: checkcast     #62                 // class java/lang/Iterable
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: astore        5
      11: new           #68                 // class java/util/ArrayList
      14: dup
      15: aload_3
      16: bipush        10
      18: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      21: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
      24: checkcast     #103                // class java/util/Collection
      27: astore        6
      29: iconst_0
      30: istore        7
      32: aload         5
      34: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      39: astore        8
      41: aload         8
      43: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      48: ifeq          233
      51: aload         8
      53: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      58: astore        9
      60: aload         6
      62: aload         9
      64: checkcast     #30                 // class java/util/List
      67: astore        10
      69: astore        27
      71: iconst_0
      72: istore        11
      74: aload         10
      76: checkcast     #62                 // class java/lang/Iterable
      79: astore        12
      81: aload_0
      82: getfield      #28                 // Field covariance:Ljava/util/List;
      85: checkcast     #62                 // class java/lang/Iterable
      88: astore        13
      90: iconst_0
      91: istore        14
      93: aload         12
      95: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     100: astore        15
     102: aload         13
     104: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     109: astore        16
     111: new           #68                 // class java/util/ArrayList
     114: dup
     115: aload         12
     117: bipush        10
     119: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     122: aload         13
     124: bipush        10
     126: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     129: invokestatic  #78                 // Method java/lang/Math.min:(II)I
     132: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
     135: astore        17
     137: aload         15
     139: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     144: ifeq          215
     147: aload         16
     149: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     154: ifeq          215
     157: aload         17
     159: aload         15
     161: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     166: aload         16
     168: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     173: checkcast     #30                 // class java/util/List
     176: astore        18
     178: checkcast     #93                 // class java/lang/Number
     181: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     184: dstore        19
     186: astore        21
     188: iconst_0
     189: istore        22
     191: dload         19
     193: aload         18
     195: checkcast     #62                 // class java/lang/Iterable
     198: invokestatic  #107                // Method kotlin/collections/CollectionsKt.sumOfDouble:(Ljava/lang/Iterable;)D
     201: dmul
     202: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     205: aload         21
     207: swap
     208: invokevirtual #101                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     211: pop
     212: goto          137
     215: aload         17
     217: checkcast     #30                 // class java/util/List
     220: nop
     221: aload         27
     223: swap
     224: invokeinterface #108,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     229: pop
     230: goto          41
     233: aload         6
     235: checkcast     #30                 // class java/util/List
     238: nop
     239: astore_2
     240: aload_2
     241: checkcast     #103                // class java/util/Collection
     244: invokestatic  #160                // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;
     247: checkcast     #62                 // class java/lang/Iterable
     250: astore        4
     252: iconst_0
     253: istore        5
     255: aload         4
     257: astore        6
     259: new           #68                 // class java/util/ArrayList
     262: dup
     263: aload         4
     265: bipush        10
     267: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     270: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
     273: checkcast     #103                // class java/util/Collection
     276: astore        7
     278: iconst_0
     279: istore        8
     281: aload         6
     283: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     288: astore        9
     290: aload         9
     292: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     297: ifeq          481
     300: aload         9
     302: checkcast     #162                // class kotlin/collections/IntIterator
     305: invokevirtual #166                // Method kotlin/collections/IntIterator.nextInt:()I
     308: istore        10
     310: aload         7
     312: iload         10
     314: istore        11
     316: astore        27
     318: iconst_0
     319: istore        12
     321: aload_2
     322: iload         11
     324: invokeinterface #170,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     329: checkcast     #62                 // class java/lang/Iterable
     332: astore        13
     334: iconst_0
     335: istore        14
     337: aload         13
     339: astore        15
     341: new           #68                 // class java/util/ArrayList
     344: dup
     345: aload         13
     347: bipush        10
     349: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     352: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
     355: checkcast     #103                // class java/util/Collection
     358: astore        16
     360: iconst_0
     361: istore        17
     363: iconst_0
     364: istore        18
     366: aload         15
     368: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     373: astore        19
     375: aload         19
     377: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     382: ifeq          462
     385: aload         19
     387: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     392: astore        20
     394: aload         16
     396: iload         18
     398: iinc          18, 1
     401: istore        21
     403: iload         21
     405: ifge          411
     408: invokestatic  #185                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     411: iload         21
     413: aload         20
     415: checkcast     #93                 // class java/lang/Number
     418: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     421: dstore        22
     423: istore        24
     425: astore        25
     427: iconst_0
     428: istore        26
     430: iload         11
     432: iload         24
     434: if_icmpne     444
     437: dconst_1
     438: dload         22
     440: dsub
     441: goto          447
     444: dload         22
     446: dneg
     447: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     450: aload         25
     452: swap
     453: invokeinterface #108,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     458: pop
     459: goto          375
     462: aload         16
     464: checkcast     #30                 // class java/util/List
     467: nop
     468: nop
     469: aload         27
     471: swap
     472: invokeinterface #108,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     477: pop
     478: goto          290
     481: aload         7
     483: checkcast     #30                 // class java/util/List
     486: nop
     487: astore_3
     488: aload_3
     489: checkcast     #62                 // class java/lang/Iterable
     492: astore        4
     494: iconst_0
     495: istore        5
     497: aload         4
     499: astore        6
     501: new           #68                 // class java/util/ArrayList
     504: dup
     505: aload         4
     507: bipush        10
     509: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     512: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
     515: checkcast     #103                // class java/util/Collection
     518: astore        7
     520: iconst_0
     521: istore        8
     523: aload         6
     525: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     530: astore        9
     532: aload         9
     534: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     539: ifeq          724
     542: aload         9
     544: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     549: astore        10
     551: aload         7
     553: aload         10
     555: checkcast     #30                 // class java/util/List
     558: astore        11
     560: astore        27
     562: iconst_0
     563: istore        12
     565: aload         11
     567: checkcast     #62                 // class java/lang/Iterable
     570: astore        13
     572: aload_0
     573: getfield      #28                 // Field covariance:Ljava/util/List;
     576: checkcast     #62                 // class java/lang/Iterable
     579: astore        14
     581: iconst_0
     582: istore        15
     584: aload         13
     586: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     591: astore        16
     593: aload         14
     595: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     600: astore        17
     602: new           #68                 // class java/util/ArrayList
     605: dup
     606: aload         13
     608: bipush        10
     610: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     613: aload         14
     615: bipush        10
     617: invokestatic  #72                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     620: invokestatic  #78                 // Method java/lang/Math.min:(II)I
     623: invokespecial #81                 // Method java/util/ArrayList."<init>":(I)V
     626: astore        18
     628: aload         16
     630: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     635: ifeq          706
     638: aload         17
     640: invokeinterface #87,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     645: ifeq          706
     648: aload         18
     650: aload         16
     652: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     657: aload         17
     659: invokeinterface #91,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     664: checkcast     #30                 // class java/util/List
     667: astore        19
     669: checkcast     #93                 // class java/lang/Number
     672: invokevirtual #97                 // Method java/lang/Number.doubleValue:()D
     675: dstore        20
     677: astore        22
     679: iconst_0
     680: istore        23
     682: dload         20
     684: aload         19
     686: checkcast     #62                 // class java/lang/Iterable
     689: invokestatic  #107                // Method kotlin/collections/CollectionsKt.sumOfDouble:(Ljava/lang/Iterable;)D
     692: dmul
     693: invokestatic  #38                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     696: aload         22
     698: swap
     699: invokevirtual #101                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     702: pop
     703: goto          628
     706: aload         18
     708: checkcast     #30                 // class java/util/List
     711: nop
     712: aload         27
     714: swap
     715: invokeinterface #108,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     720: pop
     721: goto          532
     724: aload         7
     726: checkcast     #30                 // class java/util/List
     729: nop
     730: areturn
}


package men.zhangfei.leetcode.medium

/**
 * 3. 无重复字符的最长子串
 * https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/
 */
class Problem0003 {

    companion object {

        /**
         * 滑动窗口算法
         * 1. 使用 HashSet 作为滑动窗口，存储字符
         * 2. 设置窗口的左边和右边索引为 0 val l = 0, val r = 0
         * 3. 循环判断窗口中是否包含字符串【s】右边索引下的字符，直到窗口滑动到字符串的末尾
         *   a. 不包含：右边索引右移 r++ 并更新窗口的最大长度 max = max(已存储的最大长度, 当前窗口长度)
         *   b. 包含：左边索引右移 l++ 如果移动后的左边索引到末尾的长度不大于已存在的最大长度的话 跳出循环
         */
        fun slidingWindow(s: String): Int = when {
            s.isEmpty() -> 0
            s.length == 1 -> 1
            else -> {
                var max = 0
                val len = s.length
                var l = 0
                var r = 0
                val set: MutableSet<Char> = mutableSetOf()
                while (r < len) {
                    if (set.contains(s[r])) {
                        set.remove(s[l++])
                        if (len - l <= max) {
                            break
                        }
                    } else {
                        set.add(s[r++])
                        max = max.coerceAtLeast(r - l)
                    }
                }
                max
            }
        }

        /**
         * 优化的滑动窗口
         * 0. 初始化窗口左边和右边的索引为 0 l = 0, r = 0
         * 1. 窗口右边索引递增循环 r++; r < s.length
         * 2. 如果当前右边索引下的字符已经存在，则判断 当前左边索引 > (该字符上次索引 + 1) l > (map[s[\r]] + 1)
         *   a. 是：则说明 (该字符上次索引 + 1) 至 当前左边索引中有其它重复字符，所以忽略，不改变左边索引 l
         *   b. 否：将左边索引移动到 (该字符上次索引 + 1) 的位置 l = (map[s[\r]] + 1)
         * 4. 更新最长子串长度 max = max(已存储的最大长度, 当前窗口长度)
         * 5. 将当前右边索引和字符存入 HashMap<字符，索引>. e.g. {"a": 0, "b": 1}
         * 6. 转到 1 步
         */
        fun optimizedSlidingWindow(s: String): Int = when {
            s.isEmpty() -> 0
            s.length == 1 -> 1
            else -> {
                var max = 0
                val len = s.length
                var l = 0
                var c: Char
                val map: HashMap<Char, Int> = hashMapOf()
                for (r in 0 until len) {
                    c = s[r]
                    map[c]?.let {
                        // 防止左边索引回跳
                        l = l.coerceAtLeast(it + 1)
                    }
                    max = max.coerceAtLeast(r - l + 1)
                    map[c] = r
                }
                max
            }
        }
    }
}

Compiled from "Problem0003.kt"
public final class men.zhangfei.leetcode.medium.Problem0003 {
  public static final men.zhangfei.leetcode.medium.Problem0003$Companion Companion;

  public men.zhangfei.leetcode.medium.Problem0003();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  static {};
    Code:
       0: new           #13                 // class men/zhangfei/leetcode/medium/Problem0003$Companion
       3: dup
       4: aconst_null
       5: invokespecial #16                 // Method men/zhangfei/leetcode/medium/Problem0003$Companion."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
       8: putstatic     #20                 // Field Companion:Lmen/zhangfei/leetcode/medium/Problem0003$Companion;
      11: return
}

Compiled from "Problem0003.kt"
public final class men.zhangfei.leetcode.medium.Problem0003$Companion {
  private men.zhangfei.leetcode.medium.Problem0003$Companion();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int slidingWindow(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: nop
       7: aload_1
       8: checkcast     #23                 // class java/lang/CharSequence
      11: invokeinterface #27,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      16: ifne          23
      19: iconst_1
      20: goto          24
      23: iconst_0
      24: ifeq          31
      27: iconst_0
      28: goto          158
      31: aload_1
      32: invokevirtual #30                 // Method java/lang/String.length:()I
      35: iconst_1
      36: if_icmpne     43
      39: iconst_1
      40: goto          158
      43: iconst_0
      44: istore_2
      45: aload_1
      46: invokevirtual #30                 // Method java/lang/String.length:()I
      49: istore_3
      50: iconst_0
      51: istore        4
      53: iconst_0
      54: istore        5
      56: new           #32                 // class java/util/LinkedHashSet
      59: dup
      60: invokespecial #33                 // Method java/util/LinkedHashSet."<init>":()V
      63: checkcast     #35                 // class java/util/Set
      66: astore        6
      68: iload         5
      70: iload_3
      71: if_icmpge     157
      74: aload         6
      76: aload_1
      77: iload         5
      79: invokevirtual #39                 // Method java/lang/String.charAt:(I)C
      82: invokestatic  #45                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      85: invokeinterface #49,  2           // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
      90: ifeq          124
      93: aload         6
      95: aload_1
      96: iload         4
      98: iinc          4, 1
     101: invokevirtual #39                 // Method java/lang/String.charAt:(I)C
     104: invokestatic  #45                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     107: invokeinterface #52,  2           // InterfaceMethod java/util/Set.remove:(Ljava/lang/Object;)Z
     112: pop
     113: iload_3
     114: iload         4
     116: isub
     117: iload_2
     118: if_icmpgt     68
     121: goto          157
     124: aload         6
     126: aload_1
     127: iload         5
     129: iinc          5, 1
     132: invokevirtual #39                 // Method java/lang/String.charAt:(I)C
     135: invokestatic  #45                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     138: invokeinterface #55,  2           // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     143: pop
     144: iload_2
     145: iload         5
     147: iload         4
     149: isub
     150: invokestatic  #61                 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     153: istore_2
     154: goto          68
     157: iload_2
     158: ireturn

  public final int optimizedSlidingWindow(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: nop
       7: aload_1
       8: checkcast     #23                 // class java/lang/CharSequence
      11: invokeinterface #27,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      16: ifne          23
      19: iconst_1
      20: goto          24
      23: iconst_0
      24: ifeq          31
      27: iconst_0
      28: goto          175
      31: aload_1
      32: invokevirtual #30                 // Method java/lang/String.length:()I
      35: iconst_1
      36: if_icmpne     43
      39: iconst_1
      40: goto          175
      43: iconst_0
      44: istore_2
      45: aload_1
      46: invokevirtual #30                 // Method java/lang/String.length:()I
      49: istore_3
      50: iconst_0
      51: istore        4
      53: iconst_0
      54: istore        5
      56: new           #72                 // class java/util/HashMap
      59: dup
      60: invokespecial #73                 // Method java/util/HashMap."<init>":()V
      63: astore        6
      65: iconst_0
      66: istore        7
      68: iload         7
      70: iload_3
      71: if_icmpge     174
      74: aload_1
      75: iload         7
      77: invokevirtual #39                 // Method java/lang/String.charAt:(I)C
      80: istore        5
      82: aload         6
      84: iload         5
      86: invokestatic  #45                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      89: invokevirtual #77                 // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
      92: checkcast     #79                 // class java/lang/Integer
      95: dup
      96: ifnull        125
      99: checkcast     #81                 // class java/lang/Number
     102: invokevirtual #84                 // Method java/lang/Number.intValue:()I
     105: istore        9
     107: iconst_0
     108: istore        10
     110: iload         4
     112: iload         9
     114: iconst_1
     115: iadd
     116: invokestatic  #61                 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     119: istore        4
     121: nop
     122: goto          127
     125: pop
     126: nop
     127: iload_2
     128: iload         7
     130: iload         4
     132: isub
     133: iconst_1
     134: iadd
     135: invokestatic  #61                 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     138: istore_2
     139: iload         5
     141: invokestatic  #45                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     144: astore        8
     146: iload         7
     148: invokestatic  #87                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     151: astore        9
     153: aload         6
     155: checkcast     #89                 // class java/util/Map
     158: aload         8
     160: aload         9
     162: invokeinterface #93,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     167: pop
     168: iinc          7, 1
     171: goto          68
     174: iload_2
     175: ireturn

  public men.zhangfei.leetcode.medium.Problem0003$Companion(kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: invokespecial #101                // Method "<init>":()V
       4: return
}


package men.zhangfei.leetcode.medium

import java.util.LinkedList
import java.util.Queue

/**
 * 139. 单词拆分
 * https://leetcode-cn.com/problems/word-break/
 */
class Problem0139 {

    companion object {

        /**
         * 动态规划
         * 字符串 s 可以被拆分成子字符串 s1 和 s2
         * 如果这些子字符串都可以独立地被拆分成符合要求的子字符串，那么整个字符串 s 也可以满足
         * e.g. s = "catsanddog", wordDict = ["cats", "dog", "sand", "and", "cat"]
         * s1 = "catsand", s2 = "dog"
         * s1-1 = "cats", s1-2 = "and"
         * s1-1, s1-2 满足, 所以 s1 也满足， s1, s2 都满足，所以 s 也满足
         */
        fun dp(s: String, wordDict: List<String>): Boolean {
            val len = s.length
            val dp = BooleanArray(len + 1)
            // 空字符串总是字典的一部分, 剩余为 false
            dp[0] = true
            for (r in 1..len) {
                // 通过下标 l 将字符串 s[0, r) 拆分成 s1, s2
                for (l in 0 until r) {
                    // 检查 s1 s[0, j) 是否满足条件 检查 s2 s[j, r) 是否满足条件，如果满足，说明 s[0, r) 满足 dp[r] = true
                    if (dp[l] && wordDict.contains(s.substring(l, r))) {
                        dp[r] = true
                        break
                    }
                }
            }
            return dp[len]
        }

        /**
         * 宽度优先搜索
         */
        fun bfs(s: String, wordDict: List<String>): Boolean {
            val len = s.length
            val queue: Queue<Int> = LinkedList()
            val visited = IntArray(len)
            queue.add(0)
            var start: Int
            while (!queue.isEmpty()) {
                start = queue.remove()
                if (0 == visited[start]) {
                    for (end in (start + 1)..len) {
                        if (wordDict.contains(s.substring(start, end))) {
                            queue.add(end)
                            if (end == len) {
                                return true
                            }
                        }
                    }
                    visited[start] = 1
                }
            }
            return false
        }
    }
}

Compiled from "Problem0139.kt"
public final class men.zhangfei.leetcode.medium.Problem0139 {
  public static final men.zhangfei.leetcode.medium.Problem0139$Companion Companion;

  public men.zhangfei.leetcode.medium.Problem0139();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  static {};
    Code:
       0: new           #13                 // class men/zhangfei/leetcode/medium/Problem0139$Companion
       3: dup
       4: aconst_null
       5: invokespecial #16                 // Method men/zhangfei/leetcode/medium/Problem0139$Companion."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
       8: putstatic     #20                 // Field Companion:Lmen/zhangfei/leetcode/medium/Problem0139$Companion;
      11: return
}

Compiled from "Problem0139.kt"
public final class men.zhangfei.leetcode.medium.Problem0139$Companion {
  private men.zhangfei.leetcode.medium.Problem0139$Companion();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final boolean dp(java.lang.String, java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #16                 // String s
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #24                 // String wordDict
       9: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_1
      13: invokevirtual #30                 // Method java/lang/String.length:()I
      16: istore_3
      17: iload_3
      18: iconst_1
      19: iadd
      20: newarray       boolean
      22: astore        4
      24: aload         4
      26: iconst_0
      27: iconst_1
      28: bastore
      29: iconst_1
      30: istore        5
      32: iload         5
      34: iload_3
      35: if_icmpgt     106
      38: iconst_0
      39: istore        6
      41: iload         6
      43: iload         5
      45: if_icmpge     94
      48: aload         4
      50: iload         6
      52: baload
      53: ifeq          88
      56: aload_2
      57: aload_1
      58: iload         6
      60: iload         5
      62: invokevirtual #34                 // Method java/lang/String.substring:(II)Ljava/lang/String;
      65: dup
      66: ldc           #36                 // String substring(...)
      68: invokestatic  #39                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      71: invokeinterface #45,  2           // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
      76: ifeq          88
      79: aload         4
      81: iload         5
      83: iconst_1
      84: bastore
      85: goto          94
      88: iinc          6, 1
      91: goto          41
      94: iload         5
      96: iload_3
      97: if_icmpeq     106
     100: iinc          5, 1
     103: goto          38
     106: aload         4
     108: iload_3
     109: baload
     110: ireturn

  public final boolean bfs(java.lang.String, java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #16                 // String s
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #24                 // String wordDict
       9: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_1
      13: invokevirtual #30                 // Method java/lang/String.length:()I
      16: istore_3
      17: new           #56                 // class java/util/LinkedList
      20: dup
      21: invokespecial #57                 // Method java/util/LinkedList."<init>":()V
      24: checkcast     #59                 // class java/util/Queue
      27: astore        4
      29: iload_3
      30: newarray       int
      32: astore        5
      34: aload         4
      36: iconst_0
      37: invokestatic  #65                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      40: invokeinterface #68,  2           // InterfaceMethod java/util/Queue.add:(Ljava/lang/Object;)Z
      45: pop
      46: iconst_0
      47: istore        6
      49: aload         4
      51: invokeinterface #72,  1           // InterfaceMethod java/util/Queue.isEmpty:()Z
      56: ifne          165
      59: aload         4
      61: invokeinterface #76,  1           // InterfaceMethod java/util/Queue.remove:()Ljava/lang/Object;
      66: dup
      67: ldc           #78                 // String remove(...)
      69: invokestatic  #39                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      72: checkcast     #80                 // class java/lang/Number
      75: invokevirtual #83                 // Method java/lang/Number.intValue:()I
      78: istore        6
      80: aload         5
      82: iload         6
      84: iaload
      85: ifne          49
      88: iload         6
      90: iconst_1
      91: iadd
      92: istore        7
      94: iload         7
      96: iload_3
      97: if_icmpgt     156
     100: aload_2
     101: aload_1
     102: iload         6
     104: iload         7
     106: invokevirtual #34                 // Method java/lang/String.substring:(II)Ljava/lang/String;
     109: dup
     110: ldc           #36                 // String substring(...)
     112: invokestatic  #39                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     115: invokeinterface #45,  2           // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     120: ifeq          144
     123: aload         4
     125: iload         7
     127: invokestatic  #65                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     130: invokeinterface #68,  2           // InterfaceMethod java/util/Queue.add:(Ljava/lang/Object;)Z
     135: pop
     136: iload         7
     138: iload_3
     139: if_icmpne     144
     142: iconst_1
     143: ireturn
     144: iload         7
     146: iload_3
     147: if_icmpeq     156
     150: iinc          7, 1
     153: goto          100
     156: aload         5
     158: iload         6
     160: iconst_1
     161: iastore
     162: goto          49
     165: iconst_0
     166: ireturn

  public men.zhangfei.leetcode.medium.Problem0139$Companion(kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: invokespecial #92                 // Method "<init>":()V
       4: return
}


package day04

fun solveProblem01(input: List<String>): Long {
    return input.stream()
        .map { it.split(",") }
        .map {
            val (left, right) = it
            val (left_l, left_h) = left.split("-").map { it.toInt() }
            val (right_l, right_h) = right.split("-").map { it.toInt() }
            left_l <= right_l && right_h <= left_h || right_l <= left_l && left_h <= right_h
        }
        .filter { it }
        .count()
}

fun solveProblem02(input: List<String>): Long {
    return input.stream()
        .map { it.split(",") }
        .map {
            val (left, right) = it
            val (left_l, left_h) = left.split("-").map { it.toInt() }
            val (right_l, right_h) = right.split("-").map { it.toInt() }
            right_l in left_l..left_h
                    || right_h in left_l..left_h
                    || left_l in right_l..right_h
                    || left_h in right_l..right_h
        }
        .filter { it }
        .count()
}

Compiled from "Problem.kt"
public final class day04.ProblemKt {
  public static final long solveProblem01(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #10                 // String input
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokeinterface #22,  1           // InterfaceMethod java/util/List.stream:()Ljava/util/stream/Stream;
      12: invokedynamic #41,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      17: invokedynamic #52,  0             // InvokeDynamic #1:apply:(Lkotlin/jvm/functions/Function1;)Ljava/util/function/Function;
      22: invokeinterface #58,  2           // InterfaceMethod java/util/stream/Stream.map:(Ljava/util/function/Function;)Ljava/util/stream/Stream;
      27: invokedynamic #65,  0             // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;
      32: invokedynamic #73,  0             // InvokeDynamic #3:apply:(Lkotlin/jvm/functions/Function1;)Ljava/util/function/Function;
      37: invokeinterface #58,  2           // InterfaceMethod java/util/stream/Stream.map:(Ljava/util/function/Function;)Ljava/util/stream/Stream;
      42: invokedynamic #81,  0             // InvokeDynamic #4:invoke:()Lkotlin/jvm/functions/Function1;
      47: invokedynamic #92,  0             // InvokeDynamic #5:test:(Lkotlin/jvm/functions/Function1;)Ljava/util/function/Predicate;
      52: invokeinterface #96,  2           // InterfaceMethod java/util/stream/Stream.filter:(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;
      57: invokeinterface #100,  1          // InterfaceMethod java/util/stream/Stream.count:()J
      62: lreturn

  public static final long solveProblem02(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #10                 // String input
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokeinterface #22,  1           // InterfaceMethod java/util/List.stream:()Ljava/util/stream/Stream;
      12: invokedynamic #107,  0            // InvokeDynamic #6:invoke:()Lkotlin/jvm/functions/Function1;
      17: invokedynamic #112,  0            // InvokeDynamic #7:apply:(Lkotlin/jvm/functions/Function1;)Ljava/util/function/Function;
      22: invokeinterface #58,  2           // InterfaceMethod java/util/stream/Stream.map:(Ljava/util/function/Function;)Ljava/util/stream/Stream;
      27: invokedynamic #117,  0            // InvokeDynamic #8:invoke:()Lkotlin/jvm/functions/Function1;
      32: invokedynamic #122,  0            // InvokeDynamic #9:apply:(Lkotlin/jvm/functions/Function1;)Ljava/util/function/Function;
      37: invokeinterface #58,  2           // InterfaceMethod java/util/stream/Stream.map:(Ljava/util/function/Function;)Ljava/util/stream/Stream;
      42: invokedynamic #127,  0            // InvokeDynamic #10:invoke:()Lkotlin/jvm/functions/Function1;
      47: invokedynamic #132,  0            // InvokeDynamic #11:test:(Lkotlin/jvm/functions/Function1;)Ljava/util/function/Predicate;
      52: invokeinterface #96,  2           // InterfaceMethod java/util/stream/Stream.filter:(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;
      57: invokeinterface #100,  1          // InterfaceMethod java/util/stream/Stream.count:()J
      62: lreturn

  private static final java.util.List solveProblem01$lambda$0(java.lang.String);
    Code:
       0: aload_0
       1: invokestatic  #136                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       4: aload_0
       5: checkcast     #138                // class java/lang/CharSequence
       8: iconst_1
       9: anewarray     #140                // class java/lang/String
      12: astore_1
      13: aload_1
      14: iconst_0
      15: ldc           #142                // String ,
      17: aastore
      18: aload_1
      19: iconst_0
      20: iconst_0
      21: bipush        6
      23: aconst_null
      24: invokestatic  #148                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      27: areturn

  private static final java.util.List solveProblem01$lambda$1(kotlin.jvm.functions.Function1, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokeinterface #154,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #18                 // class java/util/List
      10: areturn

  private static final java.lang.Boolean solveProblem01$lambda$4(java.util.List);
    Code:
       0: aload_0
       1: invokestatic  #136                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       4: aload_0
       5: iconst_0
       6: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      11: checkcast     #140                // class java/lang/String
      14: astore_1
      15: aload_0
      16: iconst_1
      17: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      22: checkcast     #140                // class java/lang/String
      25: astore_2
      26: aload_1
      27: checkcast     #138                // class java/lang/CharSequence
      30: iconst_1
      31: anewarray     #140                // class java/lang/String
      34: astore        4
      36: aload         4
      38: iconst_0
      39: ldc           #164                // String -
      41: aastore
      42: aload         4
      44: iconst_0
      45: iconst_0
      46: bipush        6
      48: aconst_null
      49: invokestatic  #148                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      52: checkcast     #166                // class java/lang/Iterable
      55: astore        4
      57: iconst_0
      58: istore        5
      60: aload         4
      62: astore        6
      64: new           #168                // class java/util/ArrayList
      67: dup
      68: aload         4
      70: bipush        10
      72: invokestatic  #174                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      75: invokespecial #178                // Method java/util/ArrayList."<init>":(I)V
      78: checkcast     #180                // class java/util/Collection
      81: astore        7
      83: iconst_0
      84: istore        8
      86: aload         6
      88: invokeinterface #184,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      93: astore        9
      95: aload         9
      97: invokeinterface #190,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     102: ifeq          149
     105: aload         9
     107: invokeinterface #194,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     112: astore        10
     114: aload         7
     116: aload         10
     118: checkcast     #140                // class java/lang/String
     121: astore        11
     123: astore        16
     125: iconst_0
     126: istore        12
     128: aload         11
     130: invokestatic  #200                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     133: nop
     134: invokestatic  #204                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     137: aload         16
     139: swap
     140: invokeinterface #207,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     145: pop
     146: goto          95
     149: aload         7
     151: checkcast     #18                 // class java/util/List
     154: nop
     155: astore_3
     156: aload_3
     157: iconst_0
     158: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     163: checkcast     #209                // class java/lang/Number
     166: invokevirtual #213                // Method java/lang/Number.intValue:()I
     169: istore        4
     171: aload_3
     172: iconst_1
     173: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     178: checkcast     #209                // class java/lang/Number
     181: invokevirtual #213                // Method java/lang/Number.intValue:()I
     184: istore        5
     186: aload_2
     187: checkcast     #138                // class java/lang/CharSequence
     190: iconst_1
     191: anewarray     #140                // class java/lang/String
     194: astore        7
     196: aload         7
     198: iconst_0
     199: ldc           #164                // String -
     201: aastore
     202: aload         7
     204: iconst_0
     205: iconst_0
     206: bipush        6
     208: aconst_null
     209: invokestatic  #148                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     212: checkcast     #166                // class java/lang/Iterable
     215: astore        7
     217: iconst_0
     218: istore        8
     220: aload         7
     222: astore        9
     224: new           #168                // class java/util/ArrayList
     227: dup
     228: aload         7
     230: bipush        10
     232: invokestatic  #174                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     235: invokespecial #178                // Method java/util/ArrayList."<init>":(I)V
     238: checkcast     #180                // class java/util/Collection
     241: astore        10
     243: iconst_0
     244: istore        11
     246: aload         9
     248: invokeinterface #184,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     253: astore        12
     255: aload         12
     257: invokeinterface #190,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     262: ifeq          309
     265: aload         12
     267: invokeinterface #194,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     272: astore        13
     274: aload         10
     276: aload         13
     278: checkcast     #140                // class java/lang/String
     281: astore        14
     283: astore        16
     285: iconst_0
     286: istore        15
     288: aload         14
     290: invokestatic  #200                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     293: nop
     294: invokestatic  #204                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     297: aload         16
     299: swap
     300: invokeinterface #207,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     305: pop
     306: goto          255
     309: aload         10
     311: checkcast     #18                 // class java/util/List
     314: nop
     315: astore        6
     317: aload         6
     319: iconst_0
     320: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     325: checkcast     #209                // class java/lang/Number
     328: invokevirtual #213                // Method java/lang/Number.intValue:()I
     331: istore        7
     333: aload         6
     335: iconst_1
     336: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     341: checkcast     #209                // class java/lang/Number
     344: invokevirtual #213                // Method java/lang/Number.intValue:()I
     347: istore        8
     349: iload         4
     351: iload         7
     353: if_icmpgt     363
     356: iload         8
     358: iload         5
     360: if_icmple     377
     363: iload         7
     365: iload         4
     367: if_icmpgt     381
     370: iload         5
     372: iload         8
     374: if_icmpgt     381
     377: iconst_1
     378: goto          382
     381: iconst_0
     382: invokestatic  #218                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
     385: areturn

  private static final java.lang.Boolean solveProblem01$lambda$5(kotlin.jvm.functions.Function1, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokeinterface #154,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #215                // class java/lang/Boolean
      10: areturn

  private static final boolean solveProblem01$lambda$6(java.lang.Boolean);
    Code:
       0: aload_0
       1: invokestatic  #136                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       4: aload_0
       5: invokevirtual #238                // Method java/lang/Boolean.booleanValue:()Z
       8: ireturn

  private static final boolean solveProblem01$lambda$7(kotlin.jvm.functions.Function1, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokeinterface #154,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #215                // class java/lang/Boolean
      10: invokevirtual #238                // Method java/lang/Boolean.booleanValue:()Z
      13: ireturn

  private static final java.util.List solveProblem02$lambda$8(java.lang.String);
    Code:
       0: aload_0
       1: invokestatic  #136                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       4: aload_0
       5: checkcast     #138                // class java/lang/CharSequence
       8: iconst_1
       9: anewarray     #140                // class java/lang/String
      12: astore_1
      13: aload_1
      14: iconst_0
      15: ldc           #142                // String ,
      17: aastore
      18: aload_1
      19: iconst_0
      20: iconst_0
      21: bipush        6
      23: aconst_null
      24: invokestatic  #148                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      27: areturn

  private static final java.util.List solveProblem02$lambda$9(kotlin.jvm.functions.Function1, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokeinterface #154,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #18                 // class java/util/List
      10: areturn

  private static final java.lang.Boolean solveProblem02$lambda$12(java.util.List);
    Code:
       0: aload_0
       1: invokestatic  #136                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       4: aload_0
       5: iconst_0
       6: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      11: checkcast     #140                // class java/lang/String
      14: astore_1
      15: aload_0
      16: iconst_1
      17: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      22: checkcast     #140                // class java/lang/String
      25: astore_2
      26: aload_1
      27: checkcast     #138                // class java/lang/CharSequence
      30: iconst_1
      31: anewarray     #140                // class java/lang/String
      34: astore        4
      36: aload         4
      38: iconst_0
      39: ldc           #164                // String -
      41: aastore
      42: aload         4
      44: iconst_0
      45: iconst_0
      46: bipush        6
      48: aconst_null
      49: invokestatic  #148                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      52: checkcast     #166                // class java/lang/Iterable
      55: astore        4
      57: iconst_0
      58: istore        5
      60: aload         4
      62: astore        6
      64: new           #168                // class java/util/ArrayList
      67: dup
      68: aload         4
      70: bipush        10
      72: invokestatic  #174                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      75: invokespecial #178                // Method java/util/ArrayList."<init>":(I)V
      78: checkcast     #180                // class java/util/Collection
      81: astore        7
      83: iconst_0
      84: istore        8
      86: aload         6
      88: invokeinterface #184,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      93: astore        9
      95: aload         9
      97: invokeinterface #190,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     102: ifeq          149
     105: aload         9
     107: invokeinterface #194,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     112: astore        10
     114: aload         7
     116: aload         10
     118: checkcast     #140                // class java/lang/String
     121: astore        11
     123: astore        16
     125: iconst_0
     126: istore        12
     128: aload         11
     130: invokestatic  #200                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     133: nop
     134: invokestatic  #204                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     137: aload         16
     139: swap
     140: invokeinterface #207,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     145: pop
     146: goto          95
     149: aload         7
     151: checkcast     #18                 // class java/util/List
     154: nop
     155: astore_3
     156: aload_3
     157: iconst_0
     158: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     163: checkcast     #209                // class java/lang/Number
     166: invokevirtual #213                // Method java/lang/Number.intValue:()I
     169: istore        4
     171: aload_3
     172: iconst_1
     173: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     178: checkcast     #209                // class java/lang/Number
     181: invokevirtual #213                // Method java/lang/Number.intValue:()I
     184: istore        5
     186: aload_2
     187: checkcast     #138                // class java/lang/CharSequence
     190: iconst_1
     191: anewarray     #140                // class java/lang/String
     194: astore        7
     196: aload         7
     198: iconst_0
     199: ldc           #164                // String -
     201: aastore
     202: aload         7
     204: iconst_0
     205: iconst_0
     206: bipush        6
     208: aconst_null
     209: invokestatic  #148                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     212: checkcast     #166                // class java/lang/Iterable
     215: astore        7
     217: iconst_0
     218: istore        8
     220: aload         7
     222: astore        9
     224: new           #168                // class java/util/ArrayList
     227: dup
     228: aload         7
     230: bipush        10
     232: invokestatic  #174                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     235: invokespecial #178                // Method java/util/ArrayList."<init>":(I)V
     238: checkcast     #180                // class java/util/Collection
     241: astore        10
     243: iconst_0
     244: istore        11
     246: aload         9
     248: invokeinterface #184,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     253: astore        12
     255: aload         12
     257: invokeinterface #190,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     262: ifeq          309
     265: aload         12
     267: invokeinterface #194,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     272: astore        13
     274: aload         10
     276: aload         13
     278: checkcast     #140                // class java/lang/String
     281: astore        14
     283: astore        16
     285: iconst_0
     286: istore        15
     288: aload         14
     290: invokestatic  #200                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     293: nop
     294: invokestatic  #204                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     297: aload         16
     299: swap
     300: invokeinterface #207,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     305: pop
     306: goto          255
     309: aload         10
     311: checkcast     #18                 // class java/util/List
     314: nop
     315: astore        6
     317: aload         6
     319: iconst_0
     320: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     325: checkcast     #209                // class java/lang/Number
     328: invokevirtual #213                // Method java/lang/Number.intValue:()I
     331: istore        7
     333: aload         6
     335: iconst_1
     336: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     341: checkcast     #209                // class java/lang/Number
     344: invokevirtual #213                // Method java/lang/Number.intValue:()I
     347: istore        8
     349: iload         4
     351: iload         7
     353: if_icmpgt     371
     356: iload         7
     358: iload         5
     360: if_icmpgt     367
     363: iconst_1
     364: goto          372
     367: iconst_0
     368: goto          372
     371: iconst_0
     372: ifne          453
     375: iload         4
     377: iload         8
     379: if_icmpgt     397
     382: iload         8
     384: iload         5
     386: if_icmpgt     393
     389: iconst_1
     390: goto          398
     393: iconst_0
     394: goto          398
     397: iconst_0
     398: ifne          453
     401: iload         7
     403: iload         4
     405: if_icmpgt     423
     408: iload         4
     410: iload         8
     412: if_icmpgt     419
     415: iconst_1
     416: goto          424
     419: iconst_0
     420: goto          424
     423: iconst_0
     424: ifne          453
     427: iload         7
     429: iload         5
     431: if_icmpgt     449
     434: iload         5
     436: iload         8
     438: if_icmpgt     445
     441: iconst_1
     442: goto          450
     445: iconst_0
     446: goto          450
     449: iconst_0
     450: ifeq          457
     453: iconst_1
     454: goto          458
     457: iconst_0
     458: invokestatic  #218                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
     461: areturn

  private static final java.lang.Boolean solveProblem02$lambda$13(kotlin.jvm.functions.Function1, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokeinterface #154,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #215                // class java/lang/Boolean
      10: areturn

  private static final boolean solveProblem02$lambda$14(java.lang.Boolean);
    Code:
       0: aload_0
       1: invokestatic  #136                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       4: aload_0
       5: invokevirtual #238                // Method java/lang/Boolean.booleanValue:()Z
       8: ireturn

  private static final boolean solveProblem02$lambda$15(kotlin.jvm.functions.Function1, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokeinterface #154,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #215                // class java/lang/Boolean
      10: invokevirtual #238                // Method java/lang/Boolean.booleanValue:()Z
      13: ireturn
}