<gouthampradhan>two_pointers_SubarrayProductLessThanK_1.java
public int numSubarrayProductLessThanK(int[] nums, int k) {
    long prod = 1;
    int count = 0;
    Queue<Integer> queue = new ArrayDeque<>();
    for (int i = 0; i < nums.length; i++) {
      if (nums[i] < k) {
        count++;
        if ((prod * nums[i]) < k) {
          prod *= nums[i];
          if (!queue.isEmpty()) {
            count += (i - queue.peek());
          }
        } else {
          while (!queue.isEmpty()) {
            int last = queue.poll();
            prod /= nums[last];
            if ((prod * nums[i]) < k) {
              prod = prod * nums[i];
              if (!queue.isEmpty()) {
                count += (i - queue.peek());
              }
              break;
            }
          }
        }
        if (queue.isEmpty()) {
          prod = nums[i];
        }
        queue.offer(i);
      } else {
        queue.clear();
      }
    }
    return count;
  }
public int sample_funcname ( int [ ] var_0 , int var_1 ) {
  long var_3 = 1 ;
  int var_5 = 0 ;
  Queue < Integer > var_9 = new ArrayDeque < > ( ) ;
  for ( int var_10 = 0 ;
  var_10 < var_0 . length ;
  var_10 ++ ) {
    if ( var_0 [ var_10 ] < var_1 ) {
      var_5 ++ ;
      if ( ( var_3 * var_0 [ var_10 ] ) < var_1 ) {
        var_3 *= var_0 [ var_10 ] ;
        if ( ! var_9 . isEmpty ( ) ) {
          var_5 += ( var_10 - var_9 . peek ( ) ) ;
        }
      }
      else {
        while ( ! var_9 . isEmpty ( ) ) {
          int var_15 = var_9 . poll ( ) ;
          var_3 /= var_0 [ var_15 ] ;
          if ( ( var_3 * var_0 [ var_10 ] ) < var_1 ) {
            var_3 = var_3 * var_0 [ var_10 ] ;
            if ( ! var_9 . isEmpty ( ) ) {
              var_5 += ( var_10 - var_9 . peek ( ) ) ;
            }
            break ;
          }
        }
      }
      if ( var_9 . isEmpty ( ) ) {
        var_3 = var_0 [ var_10 ] ;
      }
      var_9 . offer ( var_10 ) ;
    }
    else {
      var_9 . clear ( ) ;
    }
  }
  return var_5 ;
}
