We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
(Been having trouble submitting comments, sorry if this comes through multiple times. Also, you state v2-v1 is not guaranteed to be positive, which is true. I believe you meant v1-v2, which I address below.)
The problem states that X2 > X1, so if V2 >= V1 then there is no solution.
Therefore, for any data that we will operate on (V1-V2) is guaranteed to be positive.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Number Line Jumps
You are viewing a single comment's thread. Return to all comments →
(Been having trouble submitting comments, sorry if this comes through multiple times. Also, you state v2-v1 is not guaranteed to be positive, which is true. I believe you meant v1-v2, which I address below.)
The problem states that X2 > X1, so if V2 >= V1 then there is no solution.
Therefore, for any data that we will operate on (V1-V2) is guaranteed to be positive.