Find the position of M-th item
Basic Accuracy: 28.51% Submissions: 389 Points: 1

M items are to be delivered in a circle of size N. Find the position where the M-th item will be delivered if we start from a given position K. Note that items are distributed at adjacent positions starting from K.

Example 1:

Input:
N = 5, M = 2, K = 1
Output:
2
Explanation:
If we start from 1st position, the
2nd item will land at the 2nd position.

Example 2:

Input:
N = 5, M = 8, K = 2
Output:
4
Explanation:
If we start from 2nd position, the
8th item will land at the 4th position.

You don't need to read input or print anything. Your task is to complete the function findPosition() which takes 3 Integers N,M and K as input and returns the answer.

Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

Constraints:
1 <= N,M,K <= 105

We are replacing the old Disqus forum with the new Discussions section given below.