Maximum occurred integer | gfg potd | 07-06-2024 | GFG Problem of the day

Sdílet
Vložit
  • čas přidán 5. 06. 2024
  • Geeks for Geeks Problem of the Day(POTD) in C++ | Maximum occurred integer | Fully Explained🧠
    Solution Code :
    github.com/IshanSawhney/GfG_P...
    IMPORTANCE OF DSA FOR PLACEMENT:
    • Is DSA Still Important...
    BEST FREE WEB DEVELOPMENT COURSE:
    • BEST Web development c...
    🌐 Connect with Me:
    GitHub: github.com/IshanSawhney
    Linkedin: / ishansawhney
    #GFG #POTD #geeksforgeeks #problemoftheday #c++

Komentáře • 10

  • @RohitKumar-dz8dh
    @RohitKumar-dz8dh Před měsícem +2

    To understand programming we need logic not magic 😊. What is the intuition behind putting decreasing -1 for upper bound ?

    • @CodeGenius316
      @CodeGenius316  Před měsícem +2

      I agree what you said but this is called as difference array technique which is a pre step for prefix sum method which we used to solve this problem and I can't explain all this from the scratch in one video as they are different concepts so I suggest you to first get through the prefix sum approach then all your doubts will be cleared 😊

  • @deeptijain1096
    @deeptijain1096 Před měsícem +1

    Why nobody talks about the intution, this can be understood by just doing dry the code in comments section. Please try to show the intution

    • @CodeGenius316
      @CodeGenius316  Před měsícem +1

      I understand your concern but see prefix sum method which we used to solve this problem I can't explain all this from the scratch in one video as they are different concepts so I suggest you to first get through the prefix sum approach then all your doubts will be cleared .for example, if we encounter a dp problem...we find how can dp be applied on it but we don't start to first explain what is dp...same is with this case 😊

  • @rachitvohra23
    @rachitvohra23 Před měsícem

    Count should be initialize with maxx+2 rather than maxx+1.

    • @CodeGenius316
      @CodeGenius316  Před měsícem

      Why? We have maxx elements and array indexing is 0 based so maxx+1 is fine

    • @rachitvohra23
      @rachitvohra23 Před měsícem

      @@CodeGenius316 +1 for last element storing and +1 more for doing -1 in their next index answer in count array.(use Maxx+2 to handle r[i] +1 case)

    • @CodeGenius316
      @CodeGenius316  Před měsícem +1

      Yes you're right for safety purpose it's good to have maxx+2 but here
      Using an array of size maxx + 1 is typically sufficient for handling the range increment and decrement operations correctly.😊

  • @yashverma6507
    @yashverma6507 Před měsícem

    bhai aapki voice RJ ke liye achi hai aap mimicry bhi try kro