title: Array Element Moved K Using Single Moves
signature: function arrayElementMovedKUsingSingleMoves($a, $n, $k) {
source_py: def array_element_moved_k_using_single_moves(a, n, k):
      if (k >= (n - 1)):
          return n
      best = 0
      times = 0
      for i in range(n):
          if (a[i] > best):
              best = a[i]
              if (i == True):
                  times = 1
          else:
              times += 1
          if (times >= k):
              return best
      return best
source_cpp: int array_element_moved_k_using_single_moves(vector<int> a, int n, int k) {
    if ( k >= n - 1 ) return n;
    int best = 0, times = 0;
    for ( int i = 0;
    i < n;
    i ++ ) {
      if ( a [ i ] > best ) {
        best = a [ i ];
        if ( i ) times = 1;
      }
      else times += 1;
      if ( times >= k ) return best;
    }
    return best;
  }