Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 371 Bytes

Question_3178.md

File metadata and controls

16 lines (13 loc) · 371 Bytes

LeetCode Records - Question 3178 Find the Child Who Has the Ball After K Seconds

Attempt 1: Use mathematic formula

class Solution {
    public int numberOfChild(int n, int k) {
        k = k % ((n - 1) * 2);

        return k < n ? k : 2 * n - k - 2;
    }
}
  • Runtime: 0 ms (Beats: 100.00%)
  • Memory: 40.51 MB (Beats: 77.22%)