Find the Number of Distinct Colors Among the Balls | Leetcode 3160

Поділитися
Вставка
  • Опубліковано 10 лют 2025
  • This video explains Find the Number of Distinct Colors Among the Balls using the most optimal counting hashmap approach.
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------
    🟣 JOIN our 𝐋𝐈𝐕𝐄 𝐢𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐭𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐩𝐫𝐨𝐠𝐫𝐚𝐦 through whatsapp query: +91 8918633037
    🟣 𝐂𝐡𝐞𝐜𝐤𝐨𝐮𝐭 𝐚𝐥𝐥 𝐨𝐮𝐫 𝐂𝐨𝐮𝐫𝐬𝐞𝐬: techdose.co.in/
    🔵 LinkedIn: / surya-pratap-kahar
    🔴 INSTAGRAM: / techdose_official
    🟢 𝐓𝐞𝐜𝐡𝐝𝐨𝐬𝐞-𝟏𝟎𝟎 𝐬𝐡𝐞𝐞𝐭: docs.google.co...
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------
    𝐂𝐎𝐃𝐄 𝐋𝐈𝐍𝐊: gist.github.co...

КОМЕНТАРІ • 29

  • @freecourseplatformenglish2829
    @freecourseplatformenglish2829 4 дні тому +1

    Solved it on my own, my approach is similar to your solution. Thanks for the explanation.

  • @atharva3433
    @atharva3433 4 дні тому +2

    Sir aaj khudse solve kiya hai bohot acha laga
    thoda hint use kiya but thanks to you for your help in my journey, its just been one month im maintaining my leetcode daily streak and doint other problems along with it as well

    • @techdose4u
      @techdose4u  4 дні тому

      great :)

    • @WebDevAnjali
      @WebDevAnjali 4 дні тому

      bravo congrats! how long did it take u to come to this proficiency ?

  • @programming6177
    @programming6177 4 дні тому

    asusual you gave awasome teaching. thank you bro😇

  • @mainakdasgupta7130
    @mainakdasgupta7130 3 дні тому

    thank you man

  • @deepakgarg9649
    @deepakgarg9649 4 дні тому

    Amazing Explanation!!

  • @ShaikIrfan-ts1sg
    @ShaikIrfan-ts1sg 4 дні тому

    Superb explanation Sir... Obviously great

  • @mistercattington8597
    @mistercattington8597 4 дні тому +1

    My intuition lead me to the hashmap + hashset approach but I hit TLE. I came here and listened to the first part of the lecture to see what I could be doing wrong and I tried again with the double hashmap approach but still hit TLE. The crucial steps were removing colors that drop to 0 frequency and using a length function on the hashmap. Avoid iterating over the frequency mapping! Great video!

    • @techdose4u
      @techdose4u  4 дні тому

      That's awesome! The TLE is a common mistake with this problem. It's all about optimizing the frequency mapping.

  • @VIDITSHRIMALI-l8o
    @VIDITSHRIMALI-l8o 4 дні тому

    Thank u sir for amazing code

  • @blazing-ansh
    @blazing-ansh 4 дні тому +1

    i want to learn hashmap and mujhe hashmap par ek dam proper hat bethana hai to please suggest me how can i and please suggest some basic and medium questions and where to learn haspmap properly?

    • @mr_kat1065
      @mr_kat1065 3 дні тому

      First use chatgpt to understand what is haspmap...learn its syntax then go to the problem...this is what i did

  • @abhaymandal4903
    @abhaymandal4903 3 дні тому

    Mine same approach , but was using array for tracking all balls with color . That lead me into MLE😅

  • @nitheeshp.s2532
    @nitheeshp.s2532 4 дні тому

    I feel so demotivated, for few potd im able to think the solution but not able to solve but few questions i'm able to solve..what to do sir

    • @techdose4u
      @techdose4u  3 дні тому

      keep solving

    • @praveendevireddy9954
      @praveendevireddy9954 3 дні тому

      dont worry niteesh, i am able to solve few potd problems on my own, but could not solve this question like you. just keep solving. I dont have a friend to discuss problems and solve, if its okay then reply me

  • @zenilkapadia7572
    @zenilkapadia7572 4 дні тому +1

  • @Anikait-h3d
    @Anikait-h3d 3 дні тому

    was using sets until i understood the reason for using hashmap