Uber Phone Screen: Reject
Anonymous User
688
May 15, 2025
An applicant is playing a game where they encounter 𝑛 obstacles in a row, each with a difficulty level 𝑎𝑖. They can choose a subsegment of obstacles defined by indices 1 ≤ 𝑙 ≤ 𝑟 ≤ 𝑛, and their character will tackle the obstacles from left to right. The character's difficulty level 𝑔 starts at 0 and increases by the difficulty level of each obstacle encountered. If 𝑔 exceeds a given value 𝑥, it resets to zero, and the process continues. The applicant wants to know how many subsegments can be chosen such that the final difficulty level 𝑔 is not zero. Help them determine this number.
I was asked this problem in my Uber Phone Screen round and could not come up with the optimal answer. Can anyone provide a solution to this problem?
Comments (8)


