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​

Комментарии • 20

  • @shashwat_tiwari_st
    @shashwat_tiwari_st  Месяц назад +10

    All 4 solutions covered. [Last 2 solutions are not easy to come up with :{ ]

  • @RohitKumar-dz8dh
    @RohitKumar-dz8dh Месяц назад +1

    Thanks 😊

  • @user-ts1kx7qn8m
    @user-ts1kx7qn8m Месяц назад

    It was really helpful , Thanks and keep it up !

  • @GirjeshSharma-zv3xo
    @GirjeshSharma-zv3xo Месяц назад

    Love from Urgentina❤

  • @arnab027
    @arnab027 Месяц назад

    ye story bahut achha laga

  • @SAURABHKUMAR-yo7er
    @SAURABHKUMAR-yo7er Месяц назад

    best video

  • @ashishbisht5359
    @ashishbisht5359 Месяц назад

    chronology of solutions :-
    beginner -> intermediate -> advance -> god

  • @RohitKumar-dz8dh
    @RohitKumar-dz8dh Месяц назад +1

    Did really Josephus iterate the loop in his mind to save himself?

  • @user-ts1kx7qn8m
    @user-ts1kx7qn8m Месяц назад

    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

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd Месяц назад +1

    Finally, checking since morning

  • @arihantsinghrana2173
    @arihantsinghrana2173 Месяц назад

    Awesome detailed vid broo!!! Thanks

  • @susmoy4385
    @susmoy4385 Месяц назад +1

    Bhaiya .. DSA khatam hone k bad Kiya development playlist ka koi plan hai ??

    • @DontCare-sl1hq
      @DontCare-sl1hq Месяц назад

      Dsa kabhi khatam hoti hai kya 😂 ham khatam hojyange vo nahi

    • @Shubham-et8qk
      @Shubham-et8qk Месяц назад

      DSA khatam bhi hota hai 🧐
      Iska sirf start hai end nhi 😬

    • @OnstreamGaming
      @OnstreamGaming Месяц назад

      @@Shubham-et8qk trueeee

    • @susmoy4385
      @susmoy4385 Месяц назад

      @@DontCare-sl1hq 😂😂

  • @vivekkumarsingh9251
    @vivekkumarsingh9251 Месяц назад

    Bhaiya please add english subtitle in your video.

    • @OnstreamGaming
      @OnstreamGaming Месяц назад

      turn on subtitle and then auto translate to english , i can see the english subtitles as well