Algorithm · Visa · Hard
Problem You have a number line spanning positions 0 through n. You start at position x and want to reach position y. You are given a string s consisting only of the characters 'l' and 'r'. From this string you may select any non‑empty subsequence to form a movement sequence. When you execute that sequence: 'l' means move one step left (pos -= 1), provided the new position is at least 0. 'r' means move one step right (pos += 1), provided the new position is at most n. If any…
Checking your access…