LeetCode 1207. Unique Number of Occurrences (Algorithm Explained)
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
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?
completely forgot to hit transition in obs lol
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 :)
thank you for sharing!
Thanks Nick
Thanks for these videos.
Thank u, it was very helpful for me
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)))
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
Nickk we are waitingg for uuu where.are u mannn ....pls continue your teaching we are addicted to you
Is it possible without using Hasmap?
you can't ,because you have to remember which element has occured already(i.e need memory or space to remember that );
Goodjob Nick! Wish we are friends..!!
we are friends liyuan!
@@NickWhite Wow I'm so happy!!! I have a Superstar friend now!!! :D
plzz ,Nick also solve hard level problem
Can someone explain a little more what exactly the getOrDefault method is doing here? Thank you!
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.