comefrom: <gouthampradhan>binary_search_MinimumWindowSubsequence_1.java
code: public String minWindow(String S, String T) {
      if (T.isEmpty() || S.isEmpty()) return "";
      Map<Character, TreeSet<Integer>> charMap = new HashMap<>();
      for (int i = 0, l = S.length(); i < l; i++) {
        char c = S.charAt(i);
        charMap.putIfAbsent(c, new TreeSet<>());
        charMap.get(c).add(i);
      }
      int min = Integer.MAX_VALUE;
      int start = -1, end;
      int ansStart = -1, ansEnd = -1;
      boolean finished = false;
      while (true) {
        int index = start;
        end = -1;
        for (int i = 0, l = T.length(); i < l; i++) {
          char c = T.charAt(i);
          if (!charMap.containsKey(c)) {
            return "";
          } else {
            TreeSet<Integer> indicies = charMap.get(c);
            Integer found = indicies.higher(index);
            if (found == null) {
              finished = true;
              break;
            } else {
              index = found;
              if (i == 0) {
                start = index;
              }
              if (i == l - 1) {
                end = index;
              }
            }
          }
        }
        if (start != -1 && end != -1) {
          if ((end - start) < min) {
            min = end - start;
            ansStart = start;
            ansEnd = end;
          }
        }
        if (finished) return ansStart == -1 ? "" : S.substring(ansStart, ansEnd + 1);
      }
    }
masked: public String var_0 ( String var_1 , String var_2 ) {
    if ( var_2 . isEmpty ( ) || var_1 . isEmpty ( ) ) return "" ;
    Map < Character , TreeSet < Integer >> var_3 = new HashMap < > ( ) ;
    for ( int var_4 = 0 , var_5 = var_1 . length ( ) ;
    var_4 < var_5 ;
    var_4 ++ ) {
      char var_6 = var_1 . charAt ( var_4 ) ;
      var_3 . putIfAbsent ( var_6 , new TreeSet < > ( ) ) ;
      var_3 . get ( var_6 ) . add ( var_4 ) ;
    }
    int var_7 = Integer . MAX_VALUE ;
    int var_8 = - 1 , var_9 ;
    int var_10 = - 1 , var_11 = - 1 ;
    boolean var_15 = false ;
    while ( true ) {
      int var_12 = var_8 ;
      var_9 = - 1 ;
      for ( int var_4 = 0 , var_5 = var_2 . length ( ) ;
      var_4 < var_5 ;
      var_4 ++ ) {
        char var_6 = var_2 . charAt ( var_4 ) ;
        if ( ! var_3 . containsKey ( var_6 ) ) {
          return "" ;
        }
        else {
          TreeSet < Integer > var_13 = var_3 . get ( var_6 ) ;
          Integer var_14 = var_13 . higher ( var_12 ) ;
          if ( var_14 == null ) {
            var_15 = true ;
            break ;
          }
          else {
            var_12 = var_14 ;
            if ( var_4 == 0 ) {
              var_8 = var_12 ;
            }
            if ( var_4 == var_5 - 1 ) {
              var_9 = var_12 ;
            }
          }
        }
      }
      if ( var_8 != - 1 && var_9 != - 1 ) {
        if ( ( var_9 - var_8 ) < var_7 ) {
          var_7 = var_9 - var_8 ;
          var_10 = var_8 ;
          var_11 = var_9 ;
        }
      }
      if ( var_15 ) return var_10 == - 1 ? "" : var_1 . substring ( var_10 , var_11 + 1 ) ;
    }
  }
  