Iterate until current element position is at most its just smaller element position
while ( currElementPos <= prevElementPos filled [ currElementPos ] ) { currElementPos += jump . get ( a [ curr ] ) ; ans += 1 ; }