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.
When dividing all integers by all integers, you will get an integer. However, only full jumps will count. If they meet mid-jump, it's a No. Therefore, at least one of the integers going into the equation x1 - x2/v2 - v1 needs to become a float.
Then, once the equation returns a float, it may give u a positive result of mid jump, e.g. 5.4 or 6.7.
Since now you are getting something that should return a NO, you need to check if the result is an integer to see if it should be a YES.
Floor (result) is the integer value of whatever float. Therefore, if result == floor(result), then the float must of been an integer in the first place, and so you output a yes.
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 →
When dividing all integers by all integers, you will get an integer. However, only full jumps will count. If they meet mid-jump, it's a No. Therefore, at least one of the integers going into the equation x1 - x2/v2 - v1 needs to become a float.
Then, once the equation returns a float, it may give u a positive result of mid jump, e.g. 5.4 or 6.7.
Since now you are getting something that should return a NO, you need to check if the result is an integer to see if it should be a YES.
Floor (result) is the integer value of whatever float. Therefore, if result == floor(result), then the float must of been an integer in the first place, and so you output a yes.