Finger Game
Basic Accuracy: 41.18% Submissions: 34 Points: 1

Count the given numbers on your fingers and find the correct finger on which the number ends.

  • The first number starts from the thumb, second on the index finger, third on the middle finger, fourth on the ring finger and fifth on the little finger.
  • Again six comes on the ring finger and so on.

Example 1:

Input:
N = 3
Output:
3
Explanation:
3 ends on the finger 3.

Example 2:

Input:
N = 6
Output:
4
Explanation:
6 ends on the finger 4.

Your Task:  
You don't need to read input or print anything. Your task is to complete the function fingerCount() which takes an integer N as input parameter and returns the finger number on which this number ends.

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

Constraints:
1 <= N <= 10^6

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.