Circular Campus
https://www.hackerrank.com/contests/codenection-2021-open-category-finals/challenges/circular-campus
Question
MMU has a circular campus. We have N buildings arranged in the campus and one of it is Kyle's faculty. Kyle is currently on the building that is S buildings away from his faculty in the clockwise direction (Means his faculty is S buildings away anti clockwise). Now he'll repeat the move: Go to the building that is K buildings away from the building he is currently in, in clockwise direction. How many moves will it take for him to reach his faculty? If he cannot reach his faculty at all, print -1.
Input Format
First line contains an integer T, the number of testcases. The next line is, N S K.
Constraints
Output Format
A single integer, the number of moves to reach his faculty, or -1.
Sample Inputs:
Last updated