Find the minimum number of hand lifts needed to play a sequence of piano notes.
Unlock detailed company stats for this questionUpgrade
Given a sequence of notes on a piano (each an integer key position) and a maximum hand span k (the maximum distance between the leftmost and rightmost keys you can press at once), your hand covers multiple keys within span k without lifting, but you must lift and reposition to play a note outside the current span. Find the minimum number of hand lifts to play all notes in sequence. Example: notes = [1, 3, 5, 7, 9, 11], k = 4 -> output 2 (cover 1-5, then 7-11).
Community answers
No answers contributed by the community yet.


