LeetCode 1207. Unique Number of Occurrences (Algorithm Explained)

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • The Best Place To Learn Anything Coding Related - bit.ly/3MFZLIZ
    Join my free exclusive community built to empower programmers! - www.skool.com/software-develo...
    Preparing For Your Coding Interviews? Use These Resources
    --------------------
    (My Course) Data Structures & Algorithms for Coding Interviews - thedailybyte.dev/courses/nick
    AlgoCademy - algocademy.com/?referral=nick...
    Daily Coding Interview Questions - bit.ly/3xw1Sqz
    10% Off Of The Best Web Hosting! - hostinger.com/nickwhite
    Follow My Twitter - / nicholaswwhite
    Follow My Instagram - / nickwwhite
    Other Social Media
    ----------------------------------------------
    Discord - / discord
    Twitch - / nickwhitettv
    TikTok - / nickwhitetiktok
    LinkedIn - / nicholas-w-white
    Show Support
    ------------------------------------------------------------------------------
    Patreon - / nick_white
    PayPal - paypal.me/nickwwhite?locale.x...
    Become A Member - / @nickwhite
    #coding #programming #softwareengineering
  • Věda a technologie

Komentáře • 18

  • @johnleonardo
    @johnleonardo Před 4 lety +5

    just discovered your videos, been helping me a lot, seriously. this channel is gonna blow up. i graduate in 2020, and I'm getting into the Leetcode grind. Are you still in school or new grad and job hunting?

  • @NickWhite
    @NickWhite  Před 4 lety +2

    completely forgot to hit transition in obs lol

  • @danielraducu4784
    @danielraducu4784 Před 4 lety

    Hey man, I appreciate all the effort you put in explaining these problems.
    Could you please explain the problem from Hackerrank: Sherlock and Anagrams? Appreciate it :)

  • @thankyouthankyou1172
    @thankyouthankyou1172 Před 4 lety +1

    thank you for sharing!

  • @saravanansarangan7035
    @saravanansarangan7035 Před 4 lety +1

    Thanks Nick

  • @HiBMlive
    @HiBMlive Před 4 lety

    Thanks for these videos.

  • @azamatik3
    @azamatik3 Před rokem

    Thank u, it was very helpful for me

  • @onyandoonyando187
    @onyandoonyando187 Před rokem +1

    I used a list and set. The runtime is a little bit longer: def uniqueOccurrences(self, arr: List[int]) -> bool:
    elements = list(set(arr))
    res = []
    for i in elements:
    res.append(arr.count(i))
    return len(res)==len(list(set(res)))

    • @nidhishsrivastava4868
      @nidhishsrivastava4868 Před rokem +1

      i m trying to do it using two for loops,but it aint submitting in leetcode,this is my code,can u tell the mistake
      class Solution {
      public boolean uniqueOccurrences(int[] arr) {
      boolean flag=false;
      int count=0;
      for(int i=0;i

  • @Krishna42570
    @Krishna42570 Před 4 lety +1

    Nickk we are waitingg for uuu where.are u mannn ....pls continue your teaching we are addicted to you

  • @rishabhsharma5037
    @rishabhsharma5037 Před 2 lety +3

    Is it possible without using Hasmap?

    • @strickler453
      @strickler453 Před rokem

      you can't ,because you have to remember which element has occured already(i.e need memory or space to remember that );

  • @cutieboo233
    @cutieboo233 Před 4 lety +4

    Goodjob Nick! Wish we are friends..!!

    • @NickWhite
      @NickWhite  Před 4 lety +1

      we are friends liyuan!

    • @cutieboo233
      @cutieboo233 Před 4 lety +1

      @@NickWhite Wow I'm so happy!!! I have a Superstar friend now!!! :D

  • @aaravkumarsingh4018
    @aaravkumarsingh4018 Před 4 lety

    plzz ,Nick also solve hard level problem

  • @user-mn3iq2cs9n
    @user-mn3iq2cs9n Před 4 lety

    Can someone explain a little more what exactly the getOrDefault method is doing here? Thank you!

    • @Frederic_Chopin.
      @Frederic_Chopin. Před 4 lety +1

      It is basically saying are there any occurrences? okay great use the number of occurrences. Else if there are no occurrences use this default value instead which is 0.