1823. Find the Winner of the Circular Game | Leetcode Daily Challlenge | Maths | DSA | Hindi
HTML-код
- Опубликовано: 22 авг 2024
- Problem Name:
1823. Find the Winner of the Circular Game
Problem Statement:
There are n friends that are playing a game. The friends are sitting in a circle and are numbered from 1 to n in clockwise order. More formally, moving clockwise from the ith friend brings you to the (i+1)th friend for 1 = i n, and moving clockwise from the nth friend brings you to the 1st friend.
The rules of the game are as follows:
Start at the 1st friend.
Count the next k friends in the clockwise direction including the friend you started at. The counting wraps around the circle and may count some friends more than once.
The last friend you counted leaves the circle and loses the game.
If there is still more than one friend in the circle, go back to step 2 starting from the friend immediately clockwise of the friend who just lost and repeat.
Else, the last friend in the circle wins the game.
Given the number of friends, n, and an integer k, return the winner of the game.
Problem Link:
leetcode.com/p...
Graph Playlist:
• Graph Data Structure S...
Java Plus DSA Placement Course Playlist:
• Java and DSA Course Pl...
Java Plus DSA Sheet:
docs.google.co...
Notes:
github.com/Tiw...
Telegram Link:
shashwattiwari...
Ultimate Recursion Series Playlist:
• Recursion and Backtrac...
Instagram Handle: (@shashwat_tiwari_st)
shashwattiwari...
Samsung Interview Experience:
• I cracked Samsung | SR...
Company Tags:
Facebook | Amazon | Microsoft | Netflix | Google | LinkedIn | Pega Systems | VMware | Adobe | Samsung
Timestamp:
0:00 - Introduction
#ShashwatTiwari #coding #problemsolving
All 4 solutions covered. [Last 2 solutions are not easy to come up with :{ ]
Love from Australia❤
Thanks 😊
It was really helpful , Thanks and keep it up !
Love from Urgentina❤
ye story bahut achha laga
best video
chronology of solutions :-
beginner -> intermediate -> advance -> god
Did really Josephus iterate the loop in his mind to save himself?
😂😂dont think so
class Solution(object):
def findTheWinner(self, n, k):
"""
:type n: int
:type k: int
:rtype: int
"""
def helper(n):
if n == 1:
return 0
return (helper( n-1 ) + k) % n
return helper(n) + 1
Converted code in python
Finally, checking since morning
Awesome detailed vid broo!!! Thanks
Bhaiya .. DSA khatam hone k bad Kiya development playlist ka koi plan hai ??
Dsa kabhi khatam hoti hai kya 😂 ham khatam hojyange vo nahi
DSA khatam bhi hota hai 🧐
Iska sirf start hai end nhi 😬
@@Shubham-et8qk trueeee
@@DontCare-sl1hq 😂😂
Bhaiya please add english subtitle in your video.
turn on subtitle and then auto translate to english , i can see the english subtitles as well