question_slug
stringlengths
3
77
title
stringlengths
1
183
slug
stringlengths
12
45
summary
stringlengths
1
160
author
stringlengths
2
30
certification
stringclasses
2 values
created_at
stringdate
2013-10-25 17:32:12
2025-04-12 09:38:24
updated_at
stringdate
2013-10-25 17:32:12
2025-04-12 09:38:24
hit_count
int64
0
10.6M
has_video
bool
2 classes
content
stringlengths
4
576k
upvotes
int64
0
11.5k
downvotes
int64
0
358
tags
stringlengths
2
193
comments
int64
0
2.56k
check-balanced-string
Beats 99% in java and One of the most easiest and simplest logic🔥
beats-99-in-java-and-one-of-the-most-eas-k1cf
Complexity Time complexity: O(N) Space complexity: O(1) Code
aryanxrajj
NORMAL
2025-03-31T16:01:16.203544+00:00
2025-03-31T16:01:16.203544+00:00
1
false
# Complexity - Time complexity: - O(N) - Space complexity: - O(1) # Code ```java [] class Solution { public boolean isBalanced(String num) { int even = 0, odd = 0; for(int i = 0;i < num.length();i++){ char ch = num.charAt(i); if(i % 2 == 0){ even+=ch - '0'...
0
0
['Java']
0
check-balanced-string
0 ms Beats 100.00% | Easy Typescript Solution with Explanation
0-ms-beats-10000-easy-typescript-solutio-hba5
IntuitionApproachComplexity Time complexity: O(n) where n is the length of the input string num. This is because the function iterates through each character of
chetannada
NORMAL
2025-03-31T11:26:19.461824+00:00
2025-03-31T11:26:43.891317+00:00
2
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: $$O(n)$$ where n is the length of the input string `num`. This is because the function iterates through each character of the string exactl...
0
0
['String', 'TypeScript']
0
check-balanced-string
0 ms Beats 100.00% | Easy Javascript Solution with Explanation
0-ms-beats-10000-easy-javascript-solutio-yic4
IntuitionApproachComplexity Time complexity: O(n) where n is the length of the input string num. This is because the function iterates through each character of
chetannada
NORMAL
2025-03-31T11:23:18.805756+00:00
2025-03-31T11:23:43.620964+00:00
2
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: $$O(n)$$ where n is the length of the input string `num`. This is because the function iterates through each character of the string exactl...
0
0
['String', 'JavaScript']
0
check-balanced-string
Luke - checking whether string is balanced
luke-checking-whether-string-is-balanced-3oif
IntuitionApproachI used two variables (odd and even). I used a for loop and if the indice is even, I add the value of the index to the even, otherwise, I do tha
thunderlukey
NORMAL
2025-03-30T13:39:08.706074+00:00
2025-03-30T13:39:08.706074+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> I used two variables (odd and even). I used a for loop and if the indice is even, I add the value of the index to the even, otherwise, I do that for the odd. Finally, I che...
0
0
['Java']
0
check-balanced-string
O(N) Python3 solution easy peasy
on-python3-solution-easy-peasy-by-winsto-d0ep
IntuitionSimply sum the odd/even digitsApproach Initialize two variables and a bool used as flag Cycle chars in string if flag is true add digit to first vari
WinstonWolf
NORMAL
2025-03-29T17:23:20.359038+00:00
2025-03-29T17:23:20.359038+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> Simply sum the odd/even digits # Approach <!-- Describe your approach to solving the problem. --> - Initialize two variables and a bool used as flag - Cycle chars in string - - if flag is true add digit to first variable else add it in the...
0
0
['Python3']
0
check-balanced-string
Scala solution with implicit and map
scala-solution-with-implicit-and-map-by-sqmnm
IntuitionApproachComplexity Time complexity: Space complexity: Code
iyIeO99AmH
NORMAL
2025-03-29T13:48:10.730969+00:00
2025-03-29T13:48:10.730969+00:00
2
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['Scala']
0
check-balanced-string
Balanced or Busted? ⚖️🔢 Let’s Find Out! 😂 Python !!
balanced-or-busted-lets-find-out-python-b01zv
Intuition The problem requires checking if the sum of digits at even indices is equal to the sum of digits at odd indices. Since we only need to traverse the st
Shahin1212
NORMAL
2025-03-29T05:16:07.090832+00:00
2025-03-29T05:16:07.090832+00:00
1
false
# Intuition - The problem requires checking if the sum of digits at even indices - is equal to the sum of digits at odd indices. - Since we only need to traverse the string once, a simple iteration - with two counters (one for even indices and one for odd) will work efficiently. # Approach 1. Initialize two var...
0
0
['Python3']
0
check-balanced-string
Balanced or Busted? ⚖️🔢 Let’s Find Out! 😂 Python !!
balanced-or-busted-lets-find-out-python-rrflu
Intuition The problem requires checking if the sum of digits at even indices is equal to the sum of digits at odd indices. Since we only need to traverse the st
Shahin1212
NORMAL
2025-03-29T05:16:04.338184+00:00
2025-03-29T05:16:04.338184+00:00
1
false
# Intuition - The problem requires checking if the sum of digits at even indices - is equal to the sum of digits at odd indices. - Since we only need to traverse the string once, a simple iteration - with two counters (one for even indices and one for odd) will work efficiently. # Approach 1. Initialize two var...
0
0
['Python3']
1
check-balanced-string
Quick code loops
quick-code-loops-by-kunal_1310-weka
IntuitionApproachComplexity Time complexity: Space complexity: Code
kunal_1310
NORMAL
2025-03-28T07:05:09.978981+00:00
2025-03-28T07:05:09.978981+00:00
2
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['C++']
0
check-balanced-string
Simple Swift Solution
simple-swift-solution-by-felisviridis-2yh9
Code
Felisviridis
NORMAL
2025-03-27T11:23:00.923845+00:00
2025-03-27T11:23:00.923845+00:00
4
false
![Screenshot 2025-03-27 at 2.22.15 PM.png](https://assets.leetcode.com/users/images/cde7e7e2-9c7c-4fef-8b22-187bfdd933fa_1743074566.2577815.png) # Code ```swift [] class Solution { func isBalanced(_ num: String) -> Bool { var digits = Array(num), evenSum = 0, oddSum = 0 for i in 0..<digits.count {...
0
0
['Swift']
0
check-balanced-string
O(n) easy to understand solution with JavaScript :)
on-easy-to-understand-solution-with-java-d9rn
IntuitionApproachComplexity Time complexity: O(n) Space complexity: O(1)Code
bek-shoyatbek
NORMAL
2025-03-27T00:05:34.041577+00:00
2025-03-27T00:05:34.041577+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> $$O(n)$$ - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> ...
0
0
['JavaScript']
0
check-balanced-string
my solution
my-solution-by-leman_cap13-if96
IntuitionApproachComplexity Time complexity: Space complexity: Code
leman_cap13
NORMAL
2025-03-24T14:44:22.305451+00:00
2025-03-24T14:44:22.305451+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['Python3']
0
check-balanced-string
Something Interesting
something-interesting-by-shakhob-yr6x
Code
Shakhob
NORMAL
2025-03-24T07:04:30.971248+00:00
2025-03-24T07:04:30.971248+00:00
1
false
# Code ```python3 [] class Solution: def isBalanced(self, num: str) -> bool: number = int(num) even = 0 odd = 0 i = 0 while number > 0: if i % 2 == 0: even += number % 10 else: odd += number % 10 number //= 1...
0
0
['Python3']
0
check-balanced-string
0 ms Beats 100.00%
0-ms-beats-10000-by-bvc01654-xi31
IntuitionApproachComplexity Time complexity:O(n) Space complexity:O(1) Code
bvc01654
NORMAL
2025-03-23T09:56:21.631912+00:00
2025-03-23T09:56:21.631912+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity:O(n) <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity:O(1) <!-- Add your space complexity here, e.g. $$O(n)$$ --> ...
0
0
['String', 'C++']
0
check-balanced-string
PYTHON WITH MK!!
python-with-mk-by-mohan_kumar_hd-k7td
IntuitionApproachComplexity Time complexity: Space complexity: Code
MOHAN_KUMAR_HD
NORMAL
2025-03-22T18:03:04.201367+00:00
2025-03-22T18:03:04.201367+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['Python3']
0
check-balanced-string
Check Balanced String
check-balanced-string-by-jyenduri-2qgb
IntuitionApproachComplexity Time complexity: Space complexity: Code
jyenduri
NORMAL
2025-03-22T07:41:44.522930+00:00
2025-03-22T07:41:44.522930+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['JavaScript']
0
check-balanced-string
Very Easy Solution
very-easy-solution-by-devanand8590-p2iw
IntuitionApproachComplexity Time complexity: Space complexity: Code
Devanand8590
NORMAL
2025-03-21T04:47:31.321491+00:00
2025-03-21T04:47:31.321491+00:00
2
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['Dart']
0
check-balanced-string
Solution
solution-by-omkarpatil_1304-3jej
IntuitionApproachComplexity Time complexity: Space complexity: Code
omkarpatil_1304
NORMAL
2025-03-20T18:14:24.808750+00:00
2025-03-20T18:14:24.808750+00:00
2
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['Java']
0
check-balanced-string
Easy Solution
easy-solution-by-adhi_m_s-9rox
IntuitionApproachComplexity Time complexity: Space complexity: Code
Adhi_M_S
NORMAL
2025-03-20T10:23:20.011189+00:00
2025-03-20T10:23:20.011189+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['Python']
0
check-balanced-string
Simple java Solution
simple-java-solution-by-pritdesa-9it8
Code
pritdesa
NORMAL
2025-03-19T19:52:54.281237+00:00
2025-03-19T19:52:54.281237+00:00
1
false
# Code ```java [] class Solution { public boolean isBalanced(String num) { int even = 0, odd = 0; for(int i=0;i<num.length();i++){ if(i%2==0){ even += Character.getNumericValue(num.charAt(i)); }else{ odd += Character.getNumericValue(...
0
0
['Java']
0
check-balanced-string
EASY SOLUTION 0ms /100 beats
easy-solution-0ms-100-beats-by-cookie_co-zise
IntuitionApproachMain approach is to first convert string to integer by subtracting the current string value to '0' ASCII value ...Complexity Time complexity:
Cookie_coder
NORMAL
2025-03-19T18:10:18.023861+00:00
2025-03-19T18:10:18.023861+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach Main approach is to first convert string to integer by subtracting the current string value to '0' ASCII value ... # Complexity - Time complexity: O(n) - Space complexity: O(1) # Code ```cpp [] class Solution { public: bo...
0
0
['C++']
0
check-balanced-string
clear logic
clear-logic-by-sophie84-b0c0
Code
sophie84
NORMAL
2025-03-19T17:02:10.816687+00:00
2025-03-19T17:02:10.816687+00:00
1
false
# Code ```python3 [] class Solution: def isBalanced(self, num: str) -> bool: sum_even = 0 sum_odd = 0 for i in range(len(num)): if i%2==0: sum_even += int(num[i]) else: sum_odd += int(num[i]) return (sum_even==sum_odd) ```
0
0
['Python3']
0
check-balanced-string
easy solution
easy-solution-by-mukund_th04-odet
IntuitionWe need to check if a string of digits is balanced, meaning the sum of digits at even indices is equal to the sum of digits at odd indices. The simples
Mukund_TH04
NORMAL
2025-03-19T06:32:40.394077+00:00
2025-03-19T06:32:40.394077+00:00
1
false
# Intuition We need to check if a string of digits is balanced, meaning the sum of digits at even indices is equal to the sum of digits at odd indices. The simplest idea is to traverse the string once, summing digits at even and odd positions separately, and then compare the two sums. --- # Approach 1. **Traverse the...
0
0
['C++']
0
check-balanced-string
one liner... check it out
one-liner-check-it-out-by-senth-q1ye
Complexity Time complexity: O(n) Space complexity: O(n) Code
senth
NORMAL
2025-03-19T05:59:22.396325+00:00
2025-03-19T05:59:22.396325+00:00
1
false
# Complexity - Time complexity: O(n) - Space complexity: O(n) # Code ```python3 [] class Solution: def isBalanced(self, num: str) -> bool: return sum(int(n) for n in num[::2]) == sum(int(n) for n in num[1::2]) ```
0
0
['Python3']
0
check-balanced-string
simple...
simple-by-anakha123-ifbz
IntuitionApproachComplexity Time complexity: Space complexity: Code
anakha123
NORMAL
2025-03-18T04:24:00.127779+00:00
2025-03-18T04:24:00.127779+00:00
2
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['JavaScript']
0
check-balanced-string
C++ Easiest approach
c-easiest-approach-by-aasthagupta_17-w1yn
IntuitionApproachComplexity Time complexity: Space complexity: Code
aasthagupta_17
NORMAL
2025-03-16T07:57:13.648498+00:00
2025-03-16T07:57:13.648498+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['C++']
0
check-balanced-string
Java Solution beats 99.04%
java-solution-beats-9904-by-moreshivam20-9t9b
IntuitionFind even index and odd index then add sumApproachSo we will run two for loops first start from 0th index as even and will increment counter each time
moreshivam20
NORMAL
2025-03-16T06:18:20.092720+00:00
2025-03-16T06:18:20.092720+00:00
1
false
# Intuition Find even index and odd index then add sum # Approach So we will run two for loops first start from 0th index as even and will increment counter each time by i+2 for skip one odd index and for odd index we will start from 1st index and will keep addiing respeciveli in evenSum and OddSum and in last will ...
0
0
['Java']
0
check-balanced-string
i think this is the easy way to understand for the beginner but not the optimize solution
i-think-this-is-the-easy-way-to-understa-catf
IntuitionApproachComplexity Time complexity: Space complexity: Code
mdarizaman
NORMAL
2025-03-15T08:47:43.842033+00:00
2025-03-15T08:47:43.842033+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['Python3']
0
check-balanced-string
0ms Runtime with best Case Time Complexity using C Language and Suitable String Operations : )
0ms-runtime-with-best-case-time-complexi-8qxd
IntuitionThe problem requires checking whether the sum of digits at even indices equals the sum at odd indices. By iterating through the string of digits, you c
Vivek_Bartwal
NORMAL
2025-03-15T06:12:24.812462+00:00
2025-03-15T06:12:24.812462+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> The problem requires checking whether the sum of digits at even indices equals the sum at odd indices. By iterating through the string of digits, you can categorize the digits based on their indices and compute two separate sums. If these s...
0
0
['C']
0
check-balanced-string
Beats 100% || C++
beats-100-c-by-prem2907-gm2s
IntuitionApproachComplexity Time complexity: Space complexity: Code
prem2907
NORMAL
2025-03-12T14:32:44.421229+00:00
2025-03-12T14:32:44.421229+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['C++']
0
check-balanced-string
Java
java-by-soumya_699-0fc5
IntuitionApproachComplexity Time complexity: Space complexity: Code
Soumya_699
NORMAL
2025-03-12T06:08:06.032818+00:00
2025-03-12T06:08:06.032818+00:00
4
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['Java']
0
check-balanced-string
easy and best solution in c++
easy-and-best-solution-in-c-by-ashish754-sfhm
IntuitionApproachComplexity Time complexity: Space complexity: Code
Ashish754937
NORMAL
2025-03-12T05:39:05.879263+00:00
2025-03-12T05:39:05.879263+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['C++']
0
find-the-child-who-has-the-ball-after-k-seconds
O(1) || Math
o1-math-by-fahad06-sdn7
Intuition\n- Simplify the problem by understanding the cyclic nature of the ball passing. By calculating the number of complete back-and-forth trips and the rem
fahad_Mubeen
NORMAL
2024-06-09T04:03:32.733818+00:00
2024-08-26T16:02:27.187913+00:00
8,139
false
# Intuition\n- Simplify the problem by understanding the cyclic nature of the ball passing. By calculating the number of complete back-and-forth trips and the remaining steps, we can determine the final position of the ball. \n- If the total number of complete trips is even, the ball continues in the forward direction....
71
0
['Math', 'C++', 'Java', 'Python3']
11
find-the-child-who-has-the-ball-after-k-seconds
Easy Video Solution 🔥 || How to 🤔 in Interview || O(N)->O(1) 🔥
easy-video-solution-how-to-in-interview-pq6kq
If you like the solution Please Upvote and subscribe to my youtube channel\n\n# Intuition\n Describe your first thoughts on how to solve this problem. \nDry Run
ayushnemmaniwar12
NORMAL
2024-06-09T04:04:18.588221+00:00
2024-06-09T06:33:24.740726+00:00
677
false
***If you like the solution Please Upvote and subscribe to my youtube channel***\n\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nDry Run few examples and observe how you can derive a formula\n\n\n\n# ***Easy Video Explanation***\n\nhttps://youtu.be/lTD4AqpPxUA\n\n \n\n# Code (Bru...
12
5
['Math', 'Iterator', 'Python', 'C++', 'Java']
0
find-the-child-who-has-the-ball-after-k-seconds
✅✅💯EASY SOLUTION || C++ 🔥🔥💯✅✅
easy-solution-c-by-nikhil73995-0g7y
Intuition\n Describe your first thoughts on how to solve this problem. \nImagine children playing a game of "pass the ball" in a line.\nThe ball starts with the
nikhil73995
NORMAL
2024-06-09T04:22:28.127008+00:00
2024-06-09T05:35:26.186774+00:00
933
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nImagine children playing a game of "pass the ball" in a line.\nThe ball starts with the first child and moves one step right each second.\nWhen the ball reaches the last child, they throw it back (reverse direction).\nWhen the ball reache...
9
0
['C++']
4
find-the-child-who-has-the-ball-after-k-seconds
Python 3 || 2 lines, abs || T/S: 94% / 28%
python-3-2-lines-abs-ts-94-28-by-spauldi-nov4
Here\'s the intuition:\n\n- After 2*n - 2 seconds, the ball is back to child 0, so we only need to be concerned with k%= 2*n -2.\n\n- The graph of f(k) = n-1 -
Spaulding_
NORMAL
2024-06-09T05:05:39.382770+00:00
2024-06-11T15:55:37.398543+00:00
237
false
Here\'s the intuition:\n\n- After `2*n - 2` seconds, the ball is back to *child 0*, so we only need to be concerned with `k%= 2*n -2`.\n\n- The graph of ` f(k) = n-1 - abs(k-n+1)` is in the figure below, for the case in which *n* = 3. If *k* = 5, then *k* % 4 = 1 and *f*(1) = 1.\n\n![graph.jpg](https://assets.leetcode...
8
0
['Python3']
1
find-the-child-who-has-the-ball-after-k-seconds
2-line O(1) sol||0ms beats 100%
2-line-o1-sol0ms-beats-100-by-anwendeng-x70y
Intuition\n Describe your first thoughts on how to solve this problem. \nModular arithmetic with period N=2*(n-1)\n# Approach\n Describe your approach to solvin
anwendeng
NORMAL
2024-06-09T04:33:13.325239+00:00
2024-06-09T04:33:13.325269+00:00
779
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nModular arithmetic with period `N=2*(n-1)`\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Modular arithmetic `x=k%N;`\n2. The answer is `(x<n)?x:N-x`\n# Complexity\n- Time complexity:\n<!-- Add your time complexi...
7
0
['Math', 'C++']
3
find-the-child-who-has-the-ball-after-k-seconds
5Lines simple code O(K)
5lines-simple-code-ok-by-sumanth2328-3202
\n\n# Code\n\nclass Solution:\n def numberOfChild(self, n: int, k: int) -> int:\n posneg,j=1,0\n for i in range(k):\n j+=posneg\n
sumanth2328
NORMAL
2024-06-09T04:10:23.743711+00:00
2024-06-09T04:10:23.743760+00:00
980
false
\n\n# Code\n```\nclass Solution:\n def numberOfChild(self, n: int, k: int) -> int:\n posneg,j=1,0\n for i in range(k):\n j+=posneg\n if j==0 or j==n-1:\n posneg*=-1\n return j\n```
7
0
['Python3']
5
find-the-child-who-has-the-ball-after-k-seconds
🔥Very Easy || 4 lines || Without Formula || Changing direction at the ends.
very-easy-4-lines-without-formula-changi-ae8m
Complexity\n- Time complexity:\nO(k) \n- Space complexity:\nO(1) \n\n# Code\n\nclass Solution {\npublic:\n int numberOfChild(int n, int k) {\n int dir
__esh_WAR_Amit
NORMAL
2024-06-09T04:53:15.571067+00:00
2024-06-09T12:45:42.448970+00:00
356
false
# Complexity\n- Time complexity:\n$$O(k)$$ \n- Space complexity:\n$$O(1)$$ \n\n# Code\n```\nclass Solution {\npublic:\n int numberOfChild(int n, int k) {\n int direction = 1; // 1 means right, -1 means left\n int position = 0; // Starting position\n\n for (int steps = 0; steps < k; ++steps) {\n...
6
0
['C++']
1
find-the-child-who-has-the-ball-after-k-seconds
💢☠💫Easiest👾Faster✅💯 Lesser🧠 🎯 C++✅Python3🐍✅Java✅C✅Python🐍✅💥🔥💫Explained☠💥🔥 Beats 💯
easiestfaster-lesser-cpython3javacpython-pisr
Intuition\n\n\n\n\n\n Describe your first thoughts on how to solve this problem. \nPython3 []\nclass Solution:\n def numberOfChild(self, n: int, k: int) -> i
Edwards310
NORMAL
2024-06-09T04:16:37.537885+00:00
2024-06-09T05:23:12.889569+00:00
209
false
# Intuition\n![0ehh83fsnh811.jpg](https://assets.leetcode.com/users/images/849f06d9-f2ec-40f2-a140-28ab88f17ceb_1717910223.636967.jpeg)\n![Screenshot 2024-06-09 104733.png](https://assets.leetcode.com/users/images/89d25cb7-9f9e-4baa-87ad-d13896b4740d_1717910264.5292177.png)\n![Screenshot 2024-06-09 104755.png](https://...
6
1
['Math', 'Brainteaser', 'C', 'Python', 'C++', 'Java', 'Python3']
2
find-the-child-who-has-the-ball-after-k-seconds
easy understanding solution beats 100% in time & space
easy-understanding-solution-beats-100-in-0yo7
Code\n\njavascript []\nvar numberOfChild = function (n, k) {\n let ballPosition = 0; // Start with child 0 holding the ball\n let direction = 1; // Initially,
deleted_user
NORMAL
2024-06-09T04:09:49.657188+00:00
2024-06-09T04:09:49.657214+00:00
1,468
false
# Code\n\n```javascript []\nvar numberOfChild = function (n, k) {\n let ballPosition = 0; // Start with child 0 holding the ball\n let direction = 1; // Initially, the ball moves towards the right\n\n for (let i = 0; i < k; i++) {\n if (direction === 1) {\n if (ballPosition === n - 1) direction = -1; \n ...
6
0
['C++', 'Java', 'Python3', 'JavaScript']
2
find-the-child-who-has-the-ball-after-k-seconds
DIRECT APPROACH || BASIC SIMULATION
direct-approach-basic-simulation-by-abhi-tllg
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nJUST KEEP ON ITERATIONG
Abhishekkant135
NORMAL
2024-06-09T04:22:51.831611+00:00
2024-06-09T04:22:51.831645+00:00
418
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nJUST KEEP ON ITERATIONG AS IT SAYS AND YOU ARE DONE.\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\no(n)\n- Space complexity...
4
0
['Simulation', 'Java']
3
find-the-child-who-has-the-ball-after-k-seconds
Java 1 Line simple code 🔥 O(1) Time and space
java-1-line-simple-code-o1-time-and-spac-kmii
Intuition\nsince time starts from 0 so K will always be related to n-1.\n\n# Approach\nSo firstly classify watch when ball reverses direction, If the final dire
hashed-meta
NORMAL
2024-06-16T21:52:57.564119+00:00
2024-06-16T21:52:57.564143+00:00
99
false
# Intuition\nsince time starts from ```0``` so `K` will always be related to n-1.\n\n# Approach\nSo firstly classify watch when ball reverses direction, If the final direction is same as the starting direction then it will be like 0 for 1st person, 1 for 2nd person and so on.\nAnd if the direction is reversed then chan...
3
0
['Java']
0
find-the-child-who-has-the-ball-after-k-seconds
Simple O(1) || Solution fast
simple-o1-solution-fast-by-cs_balotiya-7xzw
Complexity\n- Time complexity:\nO(1)\n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution {\npublic:\n int numberOfChild(int n, int k) {\n int tem
cs_balotiya
NORMAL
2024-06-09T12:22:23.169060+00:00
2024-06-09T12:22:23.169084+00:00
42
false
# Complexity\n- Time complexity:\n$$O(1)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\nclass Solution {\npublic:\n int numberOfChild(int n, int k) {\n int temp1 = k / (n - 1);\n int temp2 = k % (n - 1);\n if (temp1 % 2 == 0) {\n // forward\n return temp2;\n }\n ...
3
0
['C++']
0
find-the-child-who-has-the-ball-after-k-seconds
O(1) Solution | Beats 100💯
o1-solution-beats-100-by-_rishabh_96-6zg2
Number of Children in the Roundabout Game\n\n## Problem Statement\nGiven n children standing in a circle, you start counting them from 1 to k. Once you reach k,
_Rishabh_96
NORMAL
2024-06-09T09:42:41.373129+00:00
2024-06-09T09:42:41.373163+00:00
118
false
# Number of Children in the Roundabout Game\n\n## Problem Statement\nGiven `n` children standing in a circle, you start counting them from 1 to `k`. Once you reach `k`, the count restarts from 1 again, but starting with the next child. After counting to `k` several times, determine which child will be the last one coun...
3
0
['Math', 'C++']
0
find-the-child-who-has-the-ball-after-k-seconds
Clean Simple Solution O(1)
clean-simple-solution-o1-by-lokeshsk1-j9un
Approach\n\nFor n = 5, k = 6\n\n0\t[0, 1, 2, 3, 4]\n1\t[0, 1, 2, 3, 4]\n2\t[0, 1, 2, 3, 4]\n3\t[0, 1, 2, 3, 4]\n4\t[0, 1, 2, 3, 4]\n5\t[0, 1, 2, 3, 4]\n6\t[0, 1
lokeshsk1
NORMAL
2024-06-09T08:50:55.538841+00:00
2024-06-09T09:04:07.764326+00:00
99
false
# Approach\n\nFor n = 5, k = 6\n\n0\t[```0```, 1, 2, 3, 4]\n1\t[0, ```1```, 2, 3, 4]\n2\t[0, 1, ```2```, 3, 4]\n3\t[0, 1, 2, ```3```, 4]\n4\t[0, 1, 2, 3, ```4```]\n5\t[0, 1, 2, ```3```, 4]\n6\t[0, 1, ```2```, 3, 4]\n7 [0, ```1```, 2, 3, 4]\n\nFor 8 it again comes to "0"\nand for 9 it comes to "1"\n\nWe should make k ...
3
0
['Python3']
0
find-the-child-who-has-the-ball-after-k-seconds
Iterative Solution | Python
iterative-solution-python-by-pragya_2305-vczv
Complexity\n- Time complexity: O(k)\n\n- Space complexity: o(1)\n\n# Code\n\nclass Solution:\n def numberOfChild(self, n: int, k: int) -> int:\n child
pragya_2305
NORMAL
2024-06-09T04:19:07.108114+00:00
2024-06-09T04:19:07.108148+00:00
238
false
# Complexity\n- Time complexity: O(k)\n\n- Space complexity: o(1)\n\n# Code\n```\nclass Solution:\n def numberOfChild(self, n: int, k: int) -> int:\n child = 0\n reverse = 0\n while k:\n for i in range(n-1):\n if k==0:\n return child\n ...
3
0
['Array', 'Math', 'Python', 'Python3']
3
find-the-child-who-has-the-ball-after-k-seconds
TC: O(1) | SC: O(1) | BEATS 100% | SIMPLEST EXPLANATION
tc-o1-sc-o1-beats-100-simplest-explanati-qxf7
Intuition\n Describe your first thoughts on how to solve this problem. \nIf k is less than n, then simply return the kth child (because ball is passing towards
vishwa-vijetha-g
NORMAL
2024-06-09T04:03:35.034524+00:00
2024-06-09T04:06:03.097045+00:00
239
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nIf k is less than n, then simply return the kth child (because ball is passing towards right and it is the first time),\nif k is greater than n, then find the direction of ball pass by dividing k with the total children (n - 1).\nIf the q...
3
2
['Math', 'Java']
0
find-the-child-who-has-the-ball-after-k-seconds
One line Solution 🚀|| 💡 Simple Math-Based Logic || 🔥 Beginner Friendly || 🧑‍💻 Clean Code
one-line-solution-simple-math-based-logi-fks6
IntuitionThe problem can be solved using modular arithmetic to determine the position of a child after a given number of steps. The idea is to simulate the circ
Arunkarthick_k
NORMAL
2025-01-28T22:34:21.827537+00:00
2025-01-28T22:34:21.827537+00:00
131
false
# Intuition The problem can be solved using modular arithmetic to determine the position of a child after a given number of steps. The idea is to simulate the circular behavior of counting, where positions wrap around after reaching the end. # Approach 1. Calculate the effective position using the modulo operator to h...
2
0
['Math', 'Simulation', 'Java']
0
find-the-child-who-has-the-ball-after-k-seconds
Simple Easy to Understand Java Code || Beats 100%
simple-easy-to-understand-java-code-beat-0vqh
Complexity\n- Time complexity:\nO(n)\n- Space complexity:\nO(1)\n# Code\njava []\nclass Solution {\n public int numberOfChild(int n, int k) {\n return
Saurabh_Mishra06
NORMAL
2024-09-21T06:09:56.941524+00:00
2024-09-21T06:09:56.941560+00:00
174
false
# Complexity\n- Time complexity:\nO(n)\n- Space complexity:\nO(1)\n# Code\n```java []\nclass Solution {\n public int numberOfChild(int n, int k) {\n return (n-1) - Math.abs((n-1) - k%((n-1)*2));\n }\n}\n```
2
0
['Math', 'Java']
0
find-the-child-who-has-the-ball-after-k-seconds
Two Methods Math & pointer
two-methods-math-pointer-by-sangam_verma-pncg
FIRST METHOD - Using Maths\n# Code\n\nclass Solution {\npublic:\n int numberOfChild(int n, int k) {\n int d=k/(n-1);\n int r=k%(n-1);\n
sangam_verma
NORMAL
2024-07-06T02:07:40.656156+00:00
2024-07-06T02:07:40.656179+00:00
278
false
# FIRST METHOD - Using Maths\n# Code\n```\nclass Solution {\npublic:\n int numberOfChild(int n, int k) {\n int d=k/(n-1);\n int r=k%(n-1);\n if(d&1){\n return n-r-1; // odd then cournt from end side\n }\n else return r; // even then count from front\n }\n};\n```\n# SE...
2
0
['Math', 'C++']
0
find-the-child-who-has-the-ball-after-k-seconds
Assembly with explanation and comparison with C
assembly-with-explanation-and-comparison-b7vg
\n# Rationale\n\nI\'ve solved this LeetCode problem using inline assembly in C. My goal isn\'t to showcase complexity, but rather to challenge myself and deepen
pcardenasb
NORMAL
2024-06-14T01:24:00.009696+00:00
2024-06-14T01:24:00.009713+00:00
116
false
\n# Rationale\n\nI\'ve solved this LeetCode problem using inline assembly in C. My goal isn\'t to showcase complexity, but rather to challenge myself and deepen my understanding of assembly language. \n\nAs a beginner in assembly, I welcome any improvements or comments on my code.\n\nAdditionally, I aim to share insigh...
2
0
['C']
1
find-the-child-who-has-the-ball-after-k-seconds
O(1) | Efficiently Finding the Child Who Holds the Ball After K Seconds
o1-efficiently-finding-the-child-who-hol-r42v
Intuition\n Describe your first thoughts on how to solve this problem. \nTo solve the problem of finding the child who has the ball after k seconds, we can leve
pushpitjain2006
NORMAL
2024-06-10T12:48:41.237805+00:00
2024-06-10T12:48:41.237840+00:00
6
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nTo solve the problem of finding the child who has the ball after k seconds, we can leverage the observation that the ball\'s movement is periodic. The ball moves back and forth between the two ends of the line. Therefore, after a certain ...
2
0
['C++']
0
find-the-child-who-has-the-ball-after-k-seconds
O(1) approach explained detailly
o1-approach-explained-detailly-by-hrushi-17q0
Intuition\n Describe your first thoughts on how to solve this problem. \nThe problem can be visualized as children sitting in a circle where the distribution of
Hrushi_7
NORMAL
2024-06-10T09:50:00.234706+00:00
2024-06-10T09:50:00.234742+00:00
35
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem can be visualized as children sitting in a circle where the distribution of items happens in a specific pattern, reversing direction after completing a round. By carefully calculating the direction and the remainder, we can de...
2
0
['C++']
0
find-the-child-who-has-the-ball-after-k-seconds
Simple solution using Math || O(1)
simple-solution-using-math-o1-by-user745-xgz5
Intuition\nAfter 2 * (n-1) seconds, ball ends up with the first child. After n-1 seconds, the ball is with the last child.\n\n# Approach\nSo take reminder of k
user7454af
NORMAL
2024-06-09T22:49:58.446617+00:00
2024-06-09T22:49:58.446635+00:00
38
false
# Intuition\nAfter $$2 * (n-1)$$ seconds, ball ends up with the first child. After $$n-1$$ seconds, the ball is with the last child.\n\n# Approach\nSo take reminder of k with $$2 * (n-1)$$. If k is less than $$n-1$$ return k, else return $$(n-1) - (k - (n-1))$$ as the ball reaches the end $$n-1$$ seconds and runs backw...
2
0
['Rust']
0
find-the-child-who-has-the-ball-after-k-seconds
PYTHON🔥|| BEAT 100%🔥|| 100% EFFICIENT🔥|| BEGINNER'S APPROACH || EASY TO UNDERSTAND ||
python-beat-100-100-efficient-beginners-q13c7
if it\'s help, please up \u2B06vote!\u2764\uFE0F and comment\uD83D\uDD25\n# Intuition\n Describe your first thoughts on how to solve this problem. \n- My first
Adit_gaur
NORMAL
2024-06-09T12:04:34.125402+00:00
2024-06-09T12:04:34.125433+00:00
34
false
# if it\'s help, please up \u2B06vote!\u2764\uFE0F and comment\uD83D\uDD25\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- My first thought was to simulate the movement of the ball among the children in the queue. Given that the ball changes direction when it reaches either end of t...
2
0
['Python']
1
find-the-child-who-has-the-ball-after-k-seconds
O(1) Java solution using simple Math logic
o1-java-solution-using-simple-math-logic-oo9t
Intuition\nThe ball starts with child 0 and moves to the right. When it reaches the end (either child 0 or child n\u22121), the direction reverses. The problem
Sanjeev1903
NORMAL
2024-06-09T06:25:54.930669+00:00
2024-06-09T06:25:54.930700+00:00
130
false
# Intuition\nThe ball starts with child 0 and moves to the right. When it reaches the end (either child 0 or child n\u22121), the direction reverses. The problem is to determine which child has the ball after k seconds. The key insight is to notice the periodic nature of the ball\'s movement.\n\n# Complexity\n- Time Co...
2
0
['Java']
1
find-the-child-who-has-the-ball-after-k-seconds
100% BEATS || O(1) Complexity || Mathematical Approach
100-beats-o1-complexity-mathematical-app-m2ir
If k is less than n:#\n - If k is less than the total number of children n, it means the ball won\'t reach either end of the line within k seconds. So, the ch
shubham6762
NORMAL
2024-06-09T04:40:18.140811+00:00
2024-06-09T04:40:18.140844+00:00
47
false
1. **If `k` is less than `n`:**#\n - If `k` is less than the total number of children `n`, it means the ball won\'t reach either end of the line within `k` seconds. So, the child who receives the ball after `k` seconds will simply be the `k`th child in the queue.\n\n2. **If `k` is greater than or equal to `n`:**\n ...
2
0
['Math', 'C++']
0
find-the-child-who-has-the-ball-after-k-seconds
Very Simple C Solution 100%
very-simple-c-solution-100-by-rajnarayan-17ev
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n1. when current reaches
rajnarayansharma110
NORMAL
2024-06-09T04:32:58.689312+00:00
2024-06-09T04:32:58.689342+00:00
19
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. when current reaches end then traverse in reverse direction else traverse forward\n# Complexity\n- Time complexity:O(k)\n<!-- Add your time complexity here, e.g. $$...
2
0
['C']
0
find-the-child-who-has-the-ball-after-k-seconds
Best Solution Beats ✅100% --pkg
best-solution-beats-100-pkg-by-pradeepkr-mpgs
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nApproach is to traverse through the loop and if it reaches to the end of
pradeepkrgupta_39
NORMAL
2024-06-09T04:24:37.175010+00:00
2024-06-09T04:24:37.175041+00:00
192
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nApproach is to traverse through the loop and if it reaches to the end of the k then reverse it by using the codition (if pos==n-1 || pos==0)\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity : 0(k)\n- ...
2
0
['Java']
0
find-the-child-who-has-the-ball-after-k-seconds
Contest Solution!
contest-solution-by-qatyayani-d24j
\n\n# Code\n\nclass Solution:\n def numberOfChild(self, n: int, k: int) -> int:\n f=0\n i=0\n while True:\n if k==0:\n
Qatyayani
NORMAL
2024-06-09T04:07:37.803023+00:00
2024-06-09T04:07:37.803046+00:00
30
false
\n\n# Code\n```\nclass Solution:\n def numberOfChild(self, n: int, k: int) -> int:\n f=0\n i=0\n while True:\n if k==0:\n return i\n if f==0:\n i+=1\n if i==n-1:\n f=1\n elif f==1:\n i...
2
0
['Python3']
0
find-the-child-who-has-the-ball-after-k-seconds
deque 🔥| C++
deque-c-by-varuntyagig-a7xu
Code
varuntyagig
NORMAL
2025-03-12T16:29:09.829468+00:00
2025-03-12T16:29:09.829468+00:00
16
false
# Code ```cpp [] class Solution { public: int numberOfChild(int n, int k) { deque<int> dq(1, 0); bool flag1 = false; for (int i = 1; i <= k; ++i) { if (!flag1) { dq.push_back(i); if (dq.size() == n) { flag1 = true; ...
1
0
['Queue', 'C++']
0
find-the-child-who-has-the-ball-after-k-seconds
☑️ Finding the Child Who Has the Ball After K Seconds. ☑️
finding-the-child-who-has-the-ball-after-f1rh
Code
Abdusalom_16
NORMAL
2025-02-24T04:50:38.965059+00:00
2025-02-24T04:50:38.965059+00:00
39
false
# Code ```dart [] class Solution { int numberOfChild(int n, int k) { int max = n-1; int number = 0; bool isReverse = false; while(k > 0){ k--; if(isReverse){ number--; if(number == 0){ isReverse = false; } }else{ ...
1
0
['Math', 'Simulation', 'Dart']
0
find-the-child-who-has-the-ball-after-k-seconds
C modulo O(1)
c-modulo-o1-by-michelusa-6v3y
null
michelusa
NORMAL
2024-12-12T23:46:13.027458+00:00
2024-12-12T23:46:13.027458+00:00
20
false
C modulo O(1)\nCount number of whole trips.\n\n# Code\n```c []\nint numberOfChild(int n, int k) {\n --n;\n const int trips = k / n ;\n const int left = k % n ;\n\n \n\n if ((trips & 1) == 1) { // at end\n return n - left ;\n } else {\n return left;\n }\n}\n```
1
0
['C']
0
find-the-child-who-has-the-ball-after-k-seconds
Twister JS
twister-js-by-joelll-qr73
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
Joelll
NORMAL
2024-08-10T04:01:00.264690+00:00
2024-08-10T04:01:00.264720+00:00
78
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['JavaScript']
0
find-the-child-who-has-the-ball-after-k-seconds
easy c++ solution || beats 100%
easy-c-solution-beats-100-by-yogeshwarib-y7yx
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
yogeshwaribisht21
NORMAL
2024-06-15T15:20:22.439520+00:00
2024-06-15T15:20:22.439550+00:00
198
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['C++']
1
find-the-child-who-has-the-ball-after-k-seconds
Simple Java Code ☠️
simple-java-code-by-abhinandannaik1717-akgp
Code\n\nclass Solution {\n public int numberOfChild(int n, int k) {\n if(k>=(2*(n-1))){\n k = k%(2*(n-1));\n }\n if(k>=(n-1))
abhinandannaik1717
NORMAL
2024-06-15T14:11:13.971539+00:00
2024-06-19T13:07:21.114983+00:00
378
false
# Code\n```\nclass Solution {\n public int numberOfChild(int n, int k) {\n if(k>=(2*(n-1))){\n k = k%(2*(n-1));\n }\n if(k>=(n-1)){\n k = k%(n-1);\n return (n-k-1);\n }\n else{\n return k;\n }\n }\n}\n```\n\n# Intuition\n<!-- De...
1
0
['Java']
0
find-the-child-who-has-the-ball-after-k-seconds
C++ Easy Code💯 || Beats 100% || Beginner friendly || Easy to understand || With explanation 💯💀
c-easy-code-beats-100-beginner-friendly-pm385
Intuition\n Describe your first thoughts on how to solve this problem. \nThe numberOfChild function is designed to determine the position of a "child" in a sequ
Shodhan_ak
NORMAL
2024-06-14T13:21:21.082716+00:00
2024-06-14T13:21:21.082757+00:00
5
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe numberOfChild function is designed to determine the position of a "child" in a sequence after k steps, given n total positions. Here\'s a step-by-step breakdown of the intuition behind the code:\n\nInitialization:\n\na represents the ...
1
0
['C++']
0
find-the-child-who-has-the-ball-after-k-seconds
C++ | Circular Linked List | Easy and intuitive approach
c-circular-linked-list-easy-and-intuitiv-yaph
Intuition\nThe first thought to the question were recognising that this question involves a cyclic event where the ball goes from 0 to n-1 and then again comes
Anugrah_Gupta
NORMAL
2024-06-13T09:04:53.885726+00:00
2024-06-13T09:04:53.885755+00:00
3
false
# Intuition\nThe first thought to the question were recognising that this question involves a cyclic event where the ball goes from 0 to n-1 and then again comes back to 0. This led me to the idea of using Circular Linked List.\n\n# Approach\nSince the question says that there is a reversal of the passing order. So if ...
1
0
['Linked List', 'C++']
0
find-the-child-who-has-the-ball-after-k-seconds
simple solution with basic mathod
simple-solution-with-basic-mathod-by-vin-ezc7
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
vinay_kumar_swami
NORMAL
2024-06-10T19:23:07.583768+00:00
2024-06-10T19:23:07.583794+00:00
11
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['C++']
0
find-the-child-who-has-the-ball-after-k-seconds
✅ O(1) Solution
o1-solution-by-eleev-0x0r
Solution\nswift\nstruct Solution {\n @_optimize(speed)\n func numberOfChild(_ n: Int, _ k: Int) -> Int {\n let n = n - 1\n // > Ifthe number
eleev
NORMAL
2024-06-09T17:39:46.210726+00:00
2024-06-09T17:39:46.210750+00:00
9
false
# Solution\n```swift\nstruct Solution {\n @_optimize(speed)\n func numberOfChild(_ n: Int, _ k: Int) -> Int {\n let n = n - 1\n // > Ifthe number of complete back-and-forth cycles is even:\n // -> calculate the remaining passings\n // > Otherwise (if odd):\n // -> the ...
1
0
['Math', 'Swift']
0
find-the-child-who-has-the-ball-after-k-seconds
Day 253 Problem 2 Solved
day-253-problem-2-solved-by-lakshya311-slxe
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Code\n\nclass Solut
lakshya311
NORMAL
2024-06-09T13:15:44.500470+00:00
2024-06-09T13:15:44.500524+00:00
6
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Code\n```\nclass Solution {\npublic:\n int numberOfChild(int n, int k) {\n int ans = k % (2 * n - 2);\n return (ans < n) ? ans : 2 * n - 2 - ans;\...
1
0
['C++']
0
find-the-child-who-has-the-ball-after-k-seconds
✅💯Very Easy Solution | Python 🔥🔥
very-easy-solution-python-by-kg-profile-u313
Code\n\nclass Solution:\n def numberOfChild(self, n: int, k: int) -> int:\n eff = k % (2 * (n - 1))\n p = 0\n d = 1 \n \n
KG-Profile
NORMAL
2024-06-09T13:04:22.727711+00:00
2024-06-09T13:04:22.727751+00:00
57
false
# Code\n```\nclass Solution:\n def numberOfChild(self, n: int, k: int) -> int:\n eff = k % (2 * (n - 1))\n p = 0\n d = 1 \n \n for _ in range(eff):\n if p == 0:\n d = 1 \n elif p == n - 1:\n d = -1 \n \n p +=...
1
0
['Python3']
0
find-the-child-who-has-the-ball-after-k-seconds
[Python] simple brute force
python-simple-brute-force-by-pbelskiy-01do
\nclass Solution:\n def numberOfChild(self, n: int, k: int) -> int:\n a = list(range(n))\n\n while len(a) < k*2:\n a.extend(list(ran
pbelskiy
NORMAL
2024-06-09T09:56:12.804698+00:00
2024-06-09T09:56:12.804741+00:00
13
false
```\nclass Solution:\n def numberOfChild(self, n: int, k: int) -> int:\n a = list(range(n))\n\n while len(a) < k*2:\n a.extend(list(range(n - 2, -1, -1)))\n a.extend(list(range(1, n)))\n\n return a[k]\n```
1
0
['Python']
0
find-the-child-who-has-the-ball-after-k-seconds
Easy One Liner Solution along with Intuition.
easy-one-liner-solution-along-with-intui-6be3
Let\'s understand the intuition behind the solution with an example:\nGiven - \n\nn = 4\nk = 5\n\n\nNow let us look at all the solution from k=1 to k =12\n\n\n+
OmGujarathi
NORMAL
2024-06-09T09:45:35.859460+00:00
2024-06-09T09:45:56.967097+00:00
10
false
**Let\'s understand the intuition behind the solution with an example:**\nGiven - \n```\nn = 4\nk = 5\n```\n\nNow let us look at all the solution from k=1 to k =12\n\n```\n+-----+-------+\n| k | Answer|\n+-----+-------+\n| 1 | 1 |\n| 2 | 2 |\n| 3 | 3 |\n| 4 | 2 |\n| 5 | 1 |\n| 6 | 0 ...
1
0
['Math']
0
find-the-child-who-has-the-ball-after-k-seconds
easy solution | beats 100%
easy-solution-beats-100-by-leet1101-jlcc
Intuition\nThe ball is passed back and forth between the children, reversing direction when it hits either end (child 0 or child n-1). This back-and-forth movem
leet1101
NORMAL
2024-06-09T08:52:32.119134+00:00
2024-06-09T08:52:32.119167+00:00
300
false
## Intuition\nThe ball is passed back and forth between the children, reversing direction when it hits either end (child 0 or child n-1). This back-and-forth movement can be tracked using a simple iterative approach.\n\n## Approach\n1. Start with the ball at position 0 and the direction set to 1 (moving to the right).\...
1
0
['C++']
0
find-the-child-who-has-the-ball-after-k-seconds
Easy Brute Force Approach | Easy to Understand | Beats 100% of users
easy-brute-force-approach-easy-to-unders-ak6a
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nStep 1: \ntake an array
chaturvedialok44
NORMAL
2024-06-09T08:49:27.896989+00:00
2024-06-09T08:49:27.897042+00:00
17
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nStep 1: \ntake an array arr[] of size n to hold the child.\nwill take a pointer p initially at arr[0] and variable count to couter the variable k and control the numbe...
1
0
['Java']
0
find-the-child-who-has-the-ball-after-k-seconds
🔥Very Easy to understand and intuitive O(1)🔥approach.Beginner friendly
very-easy-to-understand-and-intuitive-o1-eh7b
\n\n# Complexity\n- Time complexity:\n O(1) \n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution {\npublic:\n int numberOfChild(int n, int k) {\n
Saksham_Gulati
NORMAL
2024-06-09T08:08:43.647910+00:00
2024-06-09T08:08:43.647948+00:00
142
false
\n\n# Complexity\n- Time complexity:\n $$O(1)$$ \n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\nclass Solution {\npublic:\n int numberOfChild(int n, int k) {\n if((k/(n-1))%2==0)\n return k%(n-1);\n return n-1-k%(n-1);\n \n }\n};\n```
1
0
['Math', 'C++']
0
find-the-child-who-has-the-ball-after-k-seconds
🔥Simulation - Beginner Friendly | Clean Code | C++ |
simulation-beginner-friendly-clean-code-yt9k3
Code\n\nclass Solution {\npublic:\n int numberOfChild(int n, int k) {\n if (k == 1)\n return 1;\n \n int curr = 1;\n b
Antim_Sankalp
NORMAL
2024-06-09T07:07:21.201885+00:00
2024-06-09T07:07:21.201920+00:00
78
false
# Code\n```\nclass Solution {\npublic:\n int numberOfChild(int n, int k) {\n if (k == 1)\n return 1;\n \n int curr = 1;\n bool dir = false;\n k--;\n while (k--)\n {\n if (curr == n - 1)\n dir = true;\n if (curr == 0)\n ...
1
0
['C++']
0
find-the-child-who-has-the-ball-after-k-seconds
✅ Easy C++ Solution
easy-c-solution-by-moheat-5ur0
Code\n\nclass Solution {\npublic:\n int numberOfChild(int n, int k) {\n int curr = 0;\n bool direction = true;\n while(k!=0)\n {\
moheat
NORMAL
2024-06-09T06:22:47.575151+00:00
2024-06-09T06:22:47.575175+00:00
91
false
# Code\n```\nclass Solution {\npublic:\n int numberOfChild(int n, int k) {\n int curr = 0;\n bool direction = true;\n while(k!=0)\n {\n if(direction)\n {\n if(curr == n-2)\n {\n direction = false;\n }\n ...
1
0
['C++']
0
find-the-child-who-has-the-ball-after-k-seconds
C++ || EASY
c-easy-by-abhishek6487209-dwen
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
Abhishek6487209
NORMAL
2024-06-09T05:00:45.773161+00:00
2024-06-09T05:00:45.773185+00:00
75
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['C++']
0
find-the-child-who-has-the-ball-after-k-seconds
Simple Math || O(1) 100% Faster Solution
simple-math-o1-100-faster-solution-by-ya-3yv2
Intuition\nFor a complete cycle there will be total of 2(n - 1) children and time will be k % 2(n - 1) because rest of the time complete cycles occur.\nNow if(t
yashvardhannn152004
NORMAL
2024-06-09T04:41:16.367546+00:00
2024-06-09T04:41:16.367580+00:00
5
false
# Intuition\nFor a complete cycle there will be total of 2*(n - 1) children and time will be k % 2*(n - 1) because rest of the time complete cycles occur.\nNow if(time < n) means finally the ball was in left to right direction and answer would be k%l. Else it will be in right to left direction and answer would be 2*(n ...
1
0
['C++']
0
find-the-child-who-has-the-ball-after-k-seconds
O(1) solution
o1-solution-by-ashis_kar-yazo
Approach\nBased on the quotient we can find the direction and the using the reminder we can find the result.\n\n# Complexity\n- Time complexity:O(1)\n\n- Space
ashis_kar
NORMAL
2024-06-09T04:24:12.437097+00:00
2024-06-09T04:24:12.437183+00:00
69
false
# Approach\nBased on the quotient we can find the direction and the using the reminder we can find the result.\n\n# Complexity\n- Time complexity:$$O(1)$$\n\n- Space complexity:$$O(1)$$\n\n# Code\n```\npublic class Solution {\n public int NumberOfChild(int n, int k) {\n n--;\n int q=k/n;\n int r...
1
0
['C#']
0
find-the-child-who-has-the-ball-after-k-seconds
Python O(n) Tc and o(1) Sc
python-on-tc-and-o1-sc-by-siva_manoj-qye0
Intuition\nAfter every n-1 seconds the ball will change it\'s direction\nAfter every 2(n-1) seconds the ball will repeat it\'s previous cycle\n\n# Approach\n1 .
Siva_Manoj
NORMAL
2024-06-09T04:11:49.060414+00:00
2024-06-09T04:11:49.060436+00:00
30
false
# Intuition\nAfter every n-1 seconds the ball will change it\'s direction\nAfter every 2*(n-1) seconds the ball will repeat it\'s previous cycle\n\n# Approach\n1 . So we can update k value as k = k%(2*(n-1)) (bcz same cycle will repeat)\n\n2 . We can keep track of direction of ball by using direction variable which wil...
1
0
['Math', 'Python3']
0
find-the-child-who-has-the-ball-after-k-seconds
Math solution
math-solution-by-prancinglynx-7223
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
prancingLynx
NORMAL
2024-06-09T04:10:21.286476+00:00
2024-06-09T04:10:21.286525+00:00
292
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $...
1
0
['Python3']
0
find-the-child-who-has-the-ball-after-k-seconds
Easy C++ Beginner Solution || O(1) || Beats 100%
easy-c-beginner-solution-o1-beats-100-by-tgu1
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
Ravi_Prakash_Maurya
NORMAL
2024-06-09T04:06:57.578541+00:00
2024-06-09T04:06:57.578565+00:00
94
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['C++']
2
find-the-child-who-has-the-ball-after-k-seconds
C++ | O(1) | Intuition Explained in Detail
c-o1-intuition-explained-in-detail-by-me-2g6o
After n-1 seconds we reach right end \nAfter next n-1 seconds we reach left end\nAfter next n-1 seconds we right end again \n\n.... and so on \n\nSo,\nif n-1 /
mercer80
NORMAL
2024-06-09T04:04:35.217534+00:00
2024-06-09T05:01:06.172932+00:00
91
false
After n-1 seconds we reach right end \nAfter next n-1 seconds we reach left end\nAfter next n-1 seconds we right end again \n\n.... and so on \n\nSo,\nif `n-1 / k` is an **odd** number we know for sure we are at **right end**.\n\nif `n-1/ k` is an **even** number then we know for sure we are at **left end.**\n\n\nOnce...
1
0
['C++']
0
find-the-child-who-has-the-ball-after-k-seconds
Java Solution
java-solution-by-solved-nzih
\nclass Solution {\n public int numberOfChild(int n, int k) {\n int index = 0;\n char direction = \'r\';\n while (k != 0) {\n
solved
NORMAL
2024-06-09T04:03:46.504134+00:00
2024-06-09T04:03:46.504166+00:00
37
false
```\nclass Solution {\n public int numberOfChild(int n, int k) {\n int index = 0;\n char direction = \'r\';\n while (k != 0) {\n if (index == n - 1) {\n direction = \'l\';\n }\n if (index == 0) {\n direction = \'r\';\n }\n...
1
0
['Simulation', 'Java']
0
find-the-child-who-has-the-ball-after-k-seconds
Simple O(1) solution
simple-o1-solution-by-0x4c0de-e28q
Intuition\n Describe your first thoughts on how to solve this problem. \nThe loop size is 2 * n - 2.\n\n### Approach\n Describe your approach to solving the pro
0x4c0de
NORMAL
2024-06-09T04:01:58.244466+00:00
2024-06-09T05:11:50.672408+00:00
128
false
### Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe loop size is `2 * n - 2`.\n\n### Approach\n<!-- Describe your approach to solving the problem. -->\nWe can query the remainder of the loop, forward or backward.\n\n### Complexity\n- Time complexity: $$O((1)$$\n<!-- Add your time com...
1
0
['Math', 'Java']
0
find-the-child-who-has-the-ball-after-k-seconds
Swift😎
swift-by-upvotethispls-y4o3
Math (accepted answer)
UpvoteThisPls
NORMAL
2025-04-08T06:26:57.024427+00:00
2025-04-08T06:26:57.024427+00:00
2
false
**Math (accepted answer)** ``` class Solution { func numberOfChild(_ n: Int, _ k: Int) -> Int { let (cycle, index) = k.quotientAndRemainder(dividingBy: n-1) return cycle.isMultiple(of:2) ? index : n-1-index } } ```
0
0
['Swift']
0
find-the-child-who-has-the-ball-after-k-seconds
easy approach
easy-approach-by-sidgogia20-kz7a
IntuitionApproachComplexity Time complexity: Space complexity: Code
sidgogia20
NORMAL
2025-04-05T15:22:55.116220+00:00
2025-04-05T15:22:55.116220+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: <!-- Add your space complexity here, e.g. $$O(n)$$ --> # Code `...
0
0
['Math', 'Simulation', 'C++']
0
find-the-child-who-has-the-ball-after-k-seconds
Simple Swift Solution
simple-swift-solution-by-felisviridis-51px
CodeCode
Felisviridis
NORMAL
2025-04-02T10:42:49.116923+00:00
2025-04-02T11:48:07.132296+00:00
2
false
![Screenshot 2025-04-02 at 1.41.48 PM.png](https://assets.leetcode.com/users/images/a10ebd94-6fec-4d45-8a81-d29c1eed81df_1743590539.1283495.png) # Code ```swift [] class Solution { func numberOfChild(_ n: Int, _ k: Int) -> Int { var pointer = 0, reverse = true for i in 1...k { if point...
0
0
['Math', 'Swift', 'Simulation']
0
find-the-child-who-has-the-ball-after-k-seconds
Simple and Easy Solution ( Runtime beats 100% and Memory beats 89%)
simple-and-easy-solution-runtime-beats-1-a04h
IntuitionThe problem involves passing a ball among n children arranged in a line. The ball starts at one end and moves sequentially until it reaches the other e
baytree1238
NORMAL
2025-03-11T09:23:30.975698+00:00
2025-03-11T09:23:30.975698+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> The problem involves passing a ball among n children arranged in a line. The ball starts at one end and moves sequentially until it reaches the other end, at which point it reverses direction. By thinking of the ball’s path as a “back-and-f...
0
0
['Python']
0
find-the-child-who-has-the-ball-after-k-seconds
Simple solution in Java. Beats 100 %
simple-solution-in-java-beats-100-by-kha-co2e
Complexity Time complexity: O(1) Space complexity: O(1) Code
Khamdam
NORMAL
2025-03-08T04:54:07.632249+00:00
2025-03-08T04:54:07.632249+00:00
3
false
# Complexity - Time complexity: O(1) - Space complexity: O(1) # Code ```java [] class Solution { public int numberOfChild(int n, int k) { n = n - 1; int rounds = k / n; int remainingSteps = k % n; if (rounds % 2 == 0) { return remainingSteps; } else { ...
0
0
['Java']
0
find-the-child-who-has-the-ball-after-k-seconds
Repeating sequence can be solved with mathematical formulae for O(1) complexity [Kotlin]
repeating-sequence-can-be-solved-with-ma-ic9c
IntuitionThe problem describes a simple sequence of numbers that start from zero, increase to a maximum value and then decline again to zero. The maximum value
user5661
NORMAL
2025-03-03T17:08:00.381915+00:00
2025-03-03T17:08:00.381915+00:00
1
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> The problem describes a simple sequence of numbers that start from zero, increase to a maximum value and then decline again to zero. The maximum value is the number of transitions in any direction before you reach the last child in the chai...
0
0
['Kotlin']
0
find-the-child-who-has-the-ball-after-k-seconds
O(n) Time Solution - Simple and Fast!
on-time-solution-simple-and-fast-by-ches-d3xe
ApproachChild 0 holds the ball, and passes it on to Child 1, who passes it on to Child 2, and so on. But whenever it reaches the n-1th child, the direction reve
ChessTalk890
NORMAL
2025-02-28T17:51:57.977636+00:00
2025-02-28T17:51:57.977636+00:00
3
false
# Approach <!-- Describe your approach to solving the problem. --> Child 0 holds the ball, and passes it on to Child 1, who passes it on to Child 2, and so on. But whenever it reaches the n-1th child, the direction reverses. So, if n = 5, then the sequence will look something like this: `0 -> 1 -> 2 -> 3 -> 4 -> 3 -> ...
0
0
['Python3']
0
find-the-child-who-has-the-ball-after-k-seconds
O(1) Solution fast as f*ck
o1-solution-fast-as-fck-by-yarikkotsur-kjyc
IntuitionApproachCyclic solution Ecach children has bal: 0,1,2,3...n-1,n-2,...,3,2,1 CycleLen = 2n - 2 You need to take mod from cycle len If k < n then k is so
yarikkotsur
NORMAL
2025-02-25T16:45:19.454616+00:00
2025-02-25T16:45:19.454616+00:00
3
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach Cyclic solution Ecach children has bal: 0,1,2,3...n-1,n-2,...,3,2,1 CycleLen = 2n - 2 You need to take mod from cycle len If k < n then k is solution otherwise you have to substract k from cycle len. # Complexity - Time comple...
0
0
['Go']
0
find-the-child-who-has-the-ball-after-k-seconds
Find the child who has the ball after k seconds📍 || Simple logic🎯|| Easy solution
find-the-child-who-has-the-ball-after-k-il5og
IntuitionThe problem simulates the movement of a child along a straight path of n positions. The child starts at position 0 and moves one step at a time. When r
palle_sravya
NORMAL
2025-02-20T05:01:48.708438+00:00
2025-02-20T05:01:48.708438+00:00
4
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> The problem simulates the movement of a child along a straight path of n positions. The child starts at position 0 and moves one step at a time. When reaching either end (0 or n-1), the direction reverses. The goal is to determine the child...
0
0
['Math', 'Simulation', 'Java']
0
find-the-child-who-has-the-ball-after-k-seconds
Easy Beginner friendly | Python code| Similar solution for Passing Pillow
easy-beginner-friendly-python-code-simil-ps5x
IntuitionApproachComplexity Time complexity: Space complexity: Code
S-urjith_1001
NORMAL
2025-02-11T06:46:21.170691+00:00
2025-02-11T06:46:21.170691+00:00
7
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. -->Solve it like we solve passing pillow problem # Approach <!-- Describe your approach to solving the problem. -->See this similar solution https://youtu.be/SR78dGOaxUs?si=WmiauViYAdmLrYAW # Complexity - Time complexity: <!-- Add your time c...
0
0
['Python3']
0
find-the-child-who-has-the-ball-after-k-seconds
Java | O(1) | easy to understand
java-o1-easy-to-understand-by-lost_in_sk-635v
IntuitionApproachComplexity Time complexity : O(1) Space complexity : O(1) Code
lost_in_sky
NORMAL
2025-02-10T18:57:27.789092+00:00
2025-02-10T18:57:27.789092+00:00
6
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> # Approach <!-- Describe your approach to solving the problem. --> # Complexity - Time complexity : O(1) <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity : O(1) <!-- Add your space complexity here, e.g. $$O(n)$$ -...
0
0
['Java']
0