Find the Winner of the Circular Game | 3 Approaches | Leetcode 1823 | codestorywithMIK

Subscribers:
92,300
Published on ● Video Link: https://www.youtube.com/watch?v=lq3RMxKST-Y



Duration: 34:34
8,291 views
430


Whatsapp Community Link : https://www.whatsapp.com/channel/0029...
This is the 3rd Video of our Playlist "RECURSION : Popular Interview Problems" by codestorywithMIK

In this video we will try to solve a very famous Recursion problem : Find the Winner of the Circular Game | 3 Approaches | Easy Explanations | Leetcode 1823 | codestorywithMIK

I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY.
We will do live coding after explanation and see if we are able to pass all the test cases.
Also, please note that my Github solution link below contains both C++ as well as JAVA code.

Problem Name : Find the Winner of the Circular Game | 3 Approaches | Easy Explanations | Leetcode 1823 | codestorywithMIK
Company Tags : Goldman Sachs, Amazon
My solutions on Github(C++ & JAVA) : https://github.com/MAZHARMIK/Intervie...
Leetcode Link : https://leetcode.com/problems/find-th...


My DP Concepts Playlist :    • Roadmap for DP | How to Start DP ? | ...  
My Graph Concepts Playlist :    • Graph Concepts & Qns - 1 : Graph will...  
My Recursion Concepts Playlist :    • Introduction | Recursion Concepts And...  
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Intervie...
Instagram :   / codestorywithmik  
Facebook :   / 100090524295846  
Twitter :   / cswithmik  
Subscribe to my channel :    / @codestorywithmik  

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝

Summary :
Approach 1: Brute Force (Simple Simulation)

Time Complexity: O(n^2)
Space Complexity: O(n)
Description: This approach uses a vector/ArrayList to simulate the elimination process. It iteratively calculates the index of the player to be eliminated, removes the player from the list, and continues until only one player remains. The index of the next player to be eliminated is adjusted using modulo arithmetic.
Approach 2: Using Queue for Simulation

Time Complexity: O(n * k)
Space Complexity: O(n)
Description: This method employs a Queue to simulate the game. Players are added to the queue initially. In each iteration, players up to k-1 are moved to the back of the queue, and the k-th player is removed. This process is repeated until only one player remains in the queue.
Approach 3: Using Recursion

Time Complexity: O(n)
Space Complexity: O(1) (but O(n) due to recursion stack)
Description: This recursive approach calculates the index of the winning player directly. It uses a helper function to find the winner index for n-1 players and adjusts this index to reflect the position in the original group of n players. The base case handles the scenario with only one player left, returning index 0.
Each approach offers a different balance of time and space complexity, allowing for flexibility based on the specific constraints and requirements of the problem.


✨ Timelines✨
00:00 - Introduction
05:15 - Approach-1 (Simulation using Array)
14:23 - Approach-2 (Simulation using Queue)
19:40 - Approach-3 (Recursive Approach)

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #newyear2024




Other Videos By codestorywithMIK


2024-07-13Create Binary Tree From Descriptions | Simplest Approach | Leetcode 2196 | codestorywithMIK
2024-07-12Range Sum Query - Mutable | Leetcode 307 | Segment Tree Concepts & Qns | Video 8 | codestorywithMIK
2024-07-12Number of Atoms | Made Easy | Full Dry Run | Leetcode 726 | Google | codestorywithMIK
2024-07-12Minimum Cost for Cutting Cake I & II | Thought Process | Leetcode 3218 | 3219 | codestorywithMIK
2024-07-12Robot Collisions | Made Easy | Dry Run | Leetcode 2751 | codestorywithMIK
2024-07-12Minimum Insertion Steps to Make a String Palindrome | Blue Print | DP On Strings | Leetcode 1312
2024-07-11Maximum Score From Removing Substrings | 2 Approaches | With Proof | Leetcode 1717
2024-07-09Reverse Substrings Between Each Pair of Parentheses | 2 Approaches | Leetcode 1190 |codestorywithMIK
2024-07-08Crawler Log Folder | 2 Approaches | Dry Runs | Leetcode 1598 | codestorywithMIK
2024-07-07Average Waiting Time | Simple Simulation | Leetcode 1701 | codestorywithMIK
2024-07-06Find the Winner of the Circular Game | 3 Approaches | Leetcode 1823 | codestorywithMIK
2024-07-05Pass the Pillow | 2 Approaches | Easy Explanations | Leetcode 2582 | codestorywithMIK
2024-07-05Water Bottles | 3 Approaches | Easy Explanations | Leetcode 1518 | codestorywithMIK
2024-07-02Minimum Difference Between Largest and Smallest Value in Three Moves | 2 Approaches | Leetcode 1509
2024-07-02Merge Nodes in Between Zeros | 2 Approaches | Leap Of Faith | Leetcode 2181 | codestorywithMIK
2024-06-30Intersection of Two Arrays II | 2 Approaches | Easy Explanations | Leetcode 350 | codestorywithMIK
2024-06-29Longest Palindromic Subsequence | Using Blue Print | DP On Strings | Leetcode 516 | DP Concepts - 25
2024-06-28Query Sum II | Segment Tree Concepts & Qns | Video 5 | codestorywithMIK
2024-06-28Longest Palindromic Substring | Recursion Memo | Bottom Up | DP On Strings | Leetcode 5
2024-06-28Range Minimum Query | Segment Tree Concepts & Qns | Video 6 | codestorywithMIK
2024-06-27All Ancestors of a Node in a Directed Acyclic Graph | 3 Approaches | Leetcode 2192 |codestorywithMIK