<awangdev>1060. Missing Element in Sorted Array_1.java
public int missingElement(int[] nums, int k) {
        int start = 0, end = nums.length - 1;
        int count = nums[end] - nums[0] - end;
        if (count < k) {
            return nums[end] + k - count;
        }
        
        while (start + 1 < end) {
            int mid = start + (end - start) / 2;
            count = nums[mid] - nums[0] - mid;
            if (count >= k) end = mid;
            else start = mid;
        }
        count = nums[start] - nums[0] - start;
        return nums[start] + k - count;
    }
public int sample_funcname ( int [ ] var_0 , int var_1 ) {
  int var_3 = 0 , var_6 = var_0 . length - 1 ;
  int var_7 = var_0 [ var_6 ] - var_0 [ 0 ] - var_6 ;
  if ( var_7 < var_1 ) {
    return var_0 [ var_6 ] + var_1 - var_7 ;
  }
  while ( var_3 + 1 < var_6 ) {
    int var_9 = var_3 + ( var_6 - var_3 ) / 2 ;
    var_7 = var_0 [ var_9 ] - var_0 [ 0 ] - var_9 ;
    if ( var_7 >= var_1 ) var_6 = var_9 ;
    else var_3 = var_9 ;
  }
  var_7 = var_0 [ var_3 ] - var_0 [ 0 ] - var_3 ;
  return var_0 [ var_3 ] + var_1 - var_7 ;
}
