Bro i can’t find it lol i just wanna know how to find the duplicate number
@JIT100TV
Жыл бұрын
In python it's easyyy
@nihalseegobin1263
2 жыл бұрын
After watching this, I can't believe there isn't a coding anime or at least manga. Most animes would spend 3+ episodes on one fight whereas you could spend an entire season debugging one issue
@gabrielbalang5694
2 жыл бұрын
and thats the main conflict for the whole season
@nirmalrawal7494
2 жыл бұрын
A side character, "ethical hacker" who can't decide whether to help the mc or not!
@nickdaves3467
2 жыл бұрын
I'm fell to the floor laughing LMAO underrated comment
@NicahMariano
2 жыл бұрын
Hahahahahha!
@braindeveloperdimensional5579
2 жыл бұрын
There's an anime named "Battle Programmer".
@jesse2667
Жыл бұрын
Disappointment Compiler: “My GRANDmother runs faster than your code.”
@mekanavyasri9071
5 ай бұрын
😂😂
@petermichaelw
4 ай бұрын
"Disappointment compiler" 😂😂😂
@nelsonmei9527
2 жыл бұрын
What a nice response from the compiler.
@NoProblem76
2 жыл бұрын
You mean the interpreter
@Jakku_Azzo
2 жыл бұрын
You mean the multiplier
@Chuk392
2 жыл бұрын
@@Jakku_Azzo 👏👏🤣😂
@hunteraff5872
2 жыл бұрын
@@Jakku_Azzo you mean the divider
@sealandland3959
2 жыл бұрын
Yo mean yo mama
@gwendolyn7015
2 жыл бұрын
The fact that they explain everything and you did the same 😂
@makelifeeasyin30seconds
8 ай бұрын
But we don't get it😂😂
@kazooduck
Жыл бұрын
"a simple sort" and that's where you're wrong!
@GoogleUser-uv9bo
8 ай бұрын
Bugo sort could have done that in 1/∞ time.
@schlafhase
3 ай бұрын
Quantum bogosort is O(1) and also space complexity O(1)
@serzhredalert1
2 ай бұрын
because you sorted the array, the asymptotics of your solution is O(n log n). It’s easier to create an array bool used where the i-th element will mean whether this number is in the array and if we come across a number that has already been used, this is the answer. asymptotics O(n)
@jasonharnaugh6392
2 жыл бұрын
Project name shows "nanithefuck". 😂
@void_walker6660
2 жыл бұрын
My guy just really maded a tutorial anime thats actually is funny and really helpfull💀
@pargatsingh5261
Жыл бұрын
*made
@syedalimehdi-english
Жыл бұрын
Hasmap! I'd use a hashmap!
@gleb562
Жыл бұрын
HashSet would be enough I think
@StreamNexus
Жыл бұрын
Hashmap all the things!! But not far off...I'd memoize it, where it would take more memory but be constant O(n) for the win. Maintaining an array[n] would be it...or yeah hashing algorithm...oh wait its Python lol yeah collections.Counter
@brennanc3846
Жыл бұрын
@@gleb562 hashset gives unnecessary overhead just just another array of boolean
@creatureofhabit7049
Жыл бұрын
@@b_107_satyakisaha6 why? If all duplicates were n then n^2>(n+1)*(n+2)/2. Plus it wont tell which number
@ahmalidi
3 ай бұрын
When the programmer talk longer rather than solving problem
@AbhijitDas-rd1ib
2 жыл бұрын
LMAO last scene was really something else 🤣
@roulio7908
2 жыл бұрын
python 3 lines solution : import sys for i in list: if list.count(i) > 1: print(i); sys.exit() (i took that personnaly)
@roulio7908
2 жыл бұрын
i though a little and here is the one line solution: print([e for e in list if list.count(e) > 1][0]) for those who wonder im an absolute condingame tryhard
@climatechangedoesntbargain9140
Жыл бұрын
quadratic complexity
@darknight3613
Жыл бұрын
Now try to do it in O(n) instead of O(n²)
@zxk
Жыл бұрын
this is slower than the one he has so it won't even work
@konstantinbachem9800
Жыл бұрын
python two line solution from collections import Counter print(Counter(list).most_common(1)[0])
@gwendolyn7015
2 жыл бұрын
Wow🤣that was good😂👍 keep posting Joma ❤
@brandonalejandromosquedago2220
Жыл бұрын
The optimal solution, I think would be visiting the first position, take the vale use it as index, so you go to that position, store the vale in this new position and mark it as visited with a -1, then you use this new value as index and repeat the process, eventually when the duplicate value appears and you try to go to this new position you are going to find a -1 and you are going to know it's the repeated value. All of this in linear time and with no extra memory usage
@warred
Жыл бұрын
OutOfBound
@srsr7258
Жыл бұрын
It doesn’t really matter but for simplicity I assume you’re using 1-based indexing. In this example consider the case where the first element is 1. You go to the 1st position, store the value (1) before marking it as -1. Now you go to the 1st position and see -1. But 1 hasn’t been duplicated yet.
@albirtarsha5370
Жыл бұрын
Good one
@-dafhatas-6519
Жыл бұрын
Not a bad idea,but what if the list is something like {1,2,3,999,2}? Then won't we need a list with the length of 999?(so that we can go to the 999th position) Wouldn't that waste memory?
@minecraftprovie5076
8 ай бұрын
@@-dafhatas-6519 there can't be spaces, because the exercise was that there are all numbers from 1 to n
@Vahn35652
Жыл бұрын
This is exactly how I imagine magic works in fantasy Anime. The most elegant solutions would generate more powerful magic. Takes into account time complexity for casting time, memory allocation for mana managent, etc. You can also use hacks to gamble with specific situations, but you risk the spell failing or blowing up in your face if some situation it can't handle throws an execption. This can go deep lol.
@sheri-.-
2 жыл бұрын
This is Light Yagami from an anime named 'Death Programme'☠️
@Ryan-xq3kl
2 жыл бұрын
senpai dissappinted
@gwendolyn7015
2 жыл бұрын
💀
@albirtarsha5370
Жыл бұрын
"Time Exceeded" is more frustrating than any compiler error.
@cookiegaming1911
Жыл бұрын
"I gotta impress senpai" AYOOOO
@robotman21a3
2 жыл бұрын
‘laughes in set’
@vyomvartak8212
Жыл бұрын
Answer uses fast and slow linked list detection algorithm for O(1) space
@buff_daddyclub9539
2 жыл бұрын
Bro used brute force and explained it like he is doing hard questions on leetcode
@gwendolyn7015
2 жыл бұрын
Wait it's part1 😳 there's more to come yayyyy 🥳🥳🥳
@hansa5867
Жыл бұрын
Wouldn't it take longer to sort the array, then search for a number and comparing it to the previous number, instead of just storing each number discovered until a duplicate appears?
@azkdestructive8967
Жыл бұрын
The food wars background music 🤌 perfection
@longlong10203
2 жыл бұрын
Python set: Am I A Joke To U?
@parthsarathidixit5648
Жыл бұрын
"I'll take a problem and code it"
@robertmurillo7153
Жыл бұрын
I love this channel
@rayenasarkar
Жыл бұрын
Oh my God ! This is so funny and inspirational at the same time..Thanks Joma ..Lots of love from India.
@achyutagrahari2008
Жыл бұрын
//Mene iss problem solve kiya in c language #include // Find the duplicate number given below using array? //n=7 {1,2,4,5,3,4,6} int main() { float dup[] = {1, 2, 4, 5, 3, 4, 6}; for (int i = 0; i < 7; i++) { for (int j = 1; j < 7; j++) { if (dup[i] / dup[i + j] == 1) { printf("The duplicate number is %.0f ", dup[i]); } } } return 0; }
@sayedhaneef6068
Жыл бұрын
I entered into programming this month only,I started doin LeetCode questions too....and the moment u said linear search, I was like,"Okh u are doomed"😂😂😂
@jameshogge
Жыл бұрын
I don't think you can go sublinear. The problem is the sort being O(nlogn)
@Nikkikkikkiz
Жыл бұрын
This is a cycle finding problem. It is using DFS.
@trusttheprocess4775
Жыл бұрын
OMG I CANT STOP LAUGHING I RELATE SO HARD 😭😂😭😂😭😂😭😂😭😂
@scrollingdownaswespeak
2 жыл бұрын
Hahaha why is this so hilariously true. Anime has the power to make even the simplest things feels so hardcore
@afzalshaikh4739
4 ай бұрын
When ever i watch your videos my coding practice gets blurred.
@Chuk392
2 жыл бұрын
😂🤣😂😂🤣To slow 😂🤣😂😂 you are killin it man… You are awesome
@klimmesil9585
Жыл бұрын
This problem is one of my favorites, it's also one of the easiest but I think it is a good example of thinking outside of the box, and we should show this to the students
@Zer0-0
Жыл бұрын
When in doubt, use a hashmap!
@check7737
2 жыл бұрын
This reminds me of my traumatic days
@akasharthanur3057
2 жыл бұрын
Loved it bro🤣🤣
@mohamedkhaled3822
2 жыл бұрын
hashmap won't let ur senpi down
@devkesarwani7793
2 жыл бұрын
Hashmaps✨
@theonlyremedy
Жыл бұрын
Hashset?
@devkesarwani7793
Жыл бұрын
@@theonlyremedy yes
@Aditya-us5gj
Жыл бұрын
It will take O(n) extra space. This can be done in constant space. Think from array's index perspective. Use that line "array of size n but numbers from 0 to n-1
@alokgautam351
3 ай бұрын
Death Note vibes..😂😂
@christopherwright7077
Жыл бұрын
Ironically, a hash map would help performance, but I'm sure they will reveal some kind of plot armor during episode 2.
@tashagimera
7 ай бұрын
THAT FUCKING SOUND YESSSSSSS THAT HAD ME DYING.Any notifier that pops up with that sound must be instantly hysterical
@paulrichey4237
7 ай бұрын
Honestly, a programming anime would be so cool
@hatmanulrrc7852
2 жыл бұрын
I want that compiler
@pol165
2 жыл бұрын
Haha lmao
@Ayush-_-007
6 ай бұрын
Wait a minute...I was watching this short a year ago and thought the sum was so hard....now that I am learning pigeon hole principal in computational mathematics it looks so easy...is this what is called experience 😅
@rahulgunkar6308
Жыл бұрын
Imagine leetcode saying too slow bitch on TLE😂
@lewisshin744
Жыл бұрын
If only learning programming was fun like this.
@bartech101
2 жыл бұрын
Loop over array and create new array using values as keys. Increase value in any given key by 1 every time you already have this key. Sort is expensive. foreach items as item { array[ item ]++ } Then loop again and copy only items with value > 1 or unset with all with 1 if want to be more memory efficient.
@ckpunka7
2 жыл бұрын
Mah man! I had a similar solution.
@radkolyutskanov6867
4 ай бұрын
good luck if numbers are 32 bits ... you will need 8GB of memory to support all numbers
@bartech101
4 ай бұрын
@@radkolyutskanov6867What you said make no sense. How do you know how many numbers there will be in the array. In case of n being infinate you will need infinite amount of memory regardless of each number size. You start with array of numbers anyway without even doing anything you will need n*int_size memory. If you're concerned about RAM you can read data as steam and steam result to the disk. We got tools for that it's called database. But it will be thousands times slower.
@radkolyutskanov6867
4 ай бұрын
@@bartech101 considering worst case scenario for integer numbers if you have to store each one in array and then look by index you have 2 billion numbers each is 4 bytes u do the math. Of course u can use other tools but if u are using storage to look for duplicate need that memory
@bartech101
4 ай бұрын
@@radkolyutskanov6867 You start with array with that many number so what's your point? To sort you also have to put them in memory. Indexed array is nothing else than hashmap, time complexity to access hm is O(1) so it's constant no matter what size it is in practice it's nearly constant. So in case of many elements with same value you will have less elements but each will hold bigger number if initial array hold many elements and they don't repeat that much you have many elements in hashmap but each store small integers. Instead of winning about size better tell us what's your algorytm.
@shaneannconnell8022
Жыл бұрын
Dude my favourite shorts
@xRAMSESBATEMANx
Жыл бұрын
That compiler-sama is real tough
@Vaibhavfarkade54
Жыл бұрын
Mom swear this what they asked me to solve duplicate value in Array 😂😹🙌🏼🙌🏼🙌🏼
@RohitPatil_Tech
2 жыл бұрын
Love this. Super relatable if you in the interview prep phase right now. 😅😅😅😅
@Semicolon2024
2 жыл бұрын
sum(nums) - sum(set(nums))
@hudsonfernandes6171
Жыл бұрын
The duplicate can be repeated though… consider [1,2,2,2,3]. sum()=10 sum(set())=6, but the duplicate isn’t 4
@yadikishameer9587
Жыл бұрын
len(arr) != len(set(arr)) ? 'duplicate present' : 'duplicate not present'
@josebaiturregui37
5 ай бұрын
When even the promt is roasting you 😂😂😂
@KEN0G
Жыл бұрын
This is so true, and had me dying 🤣 😭
@The_moonlit
2 жыл бұрын
HE USES REPLIT YES!
@jbremer
2 жыл бұрын
since the new Editor replit is dogshit
@ibetyoufivedollars
Жыл бұрын
A deep voiced man a la Present Mike needs to do a cut in voice over to explain concepts and practices
@mannyx2796
2 жыл бұрын
Lol I figured this out but the plot twist got me
@jeffyboyreloaded
2 ай бұрын
The dreaded exceeded time limit 😂
@mohamedlifa741
Жыл бұрын
That "Nani the fuck " got me
@Mr.Plawl01
Жыл бұрын
So good! Happened to me just yesterday when i started with leetcode
@scuffedcoding3814
Жыл бұрын
I like the kimi no na wa wallpaper, nice touch
@om84
6 ай бұрын
Bro that's fuckin gooood😂
@rajatmishra9993
2 жыл бұрын
If giving interview was an anime. Please make on this.
@mikelarry5498
Жыл бұрын
Bro this is intense as well as interesting an informative , where can I find this at ?
@juliensaab
Жыл бұрын
Since we know that the numbers are between 1 and n inclusive what we can simply do is create an array of size n+1 (to accommodate the index 0 since it's not included) and simply iterate over the original array and increment by 1 the value in the second array by using the number from the first array as index. This is the simplest way to solve it, but not the optimal in terms of memory consumption, because we're reserving more memory than we need. The best solution is using a Map/Dictionary, which will be more efficient when talking about large numbers.
@HarshHemaniHH
Жыл бұрын
Well, for all those wondering, the solution indeed, is a hashmap
@SuperOtter
Жыл бұрын
A bucket sort would also suffice theoretically speaking but yes this definitely should be hashmap
@Aditya-us5gj
Жыл бұрын
Can be done without using hashmap. Hashmap will take N space but this can be done in constant space.
@micheleagnello7058
Жыл бұрын
Complexity (O2) for a duplicate, Master Apposai must be disappointed😂
@sigra4867
Жыл бұрын
You make it work I was getting into it
@c7hu1hu
2 жыл бұрын
That moment when he gets the answer
@craftrumzen2393
Жыл бұрын
Uses Mac and light theme 💀💀💀
@rishichoubey5060
Жыл бұрын
Your fun Anime explained to me... LOL
@elyipierre2284
2 жыл бұрын
I would watch it
@reenasinghchongad7176
2 жыл бұрын
Damn I want an anime on this
@shakshineha
2 жыл бұрын
When non programmers find it easy but thousands of programmers have failed the interview because of this 😂😂 I actually started calculating his solutions complexity. These programs have made me insane 😂😂
@centralprocessingunit4988
Жыл бұрын
🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣
@isarayyanmd
Жыл бұрын
Love this
2 жыл бұрын
Use a hashmap! It's the best weapon for this.
@luluberluc
2 жыл бұрын
Maybe just a sum ?
@johnle7705
2 жыл бұрын
An array is enough :))
@Darya-pu6ik
Жыл бұрын
the tle made me cry😬
@JaccBlacc0
Жыл бұрын
This would be pretty simple. You could do a count function in a loop for each value in the array. If the number of occurrences is >1, then you’ve found a duplicate.
@dmitrypavlov3279
Жыл бұрын
Nope! Still not the most efficient in terms of memory.
@arthurviktory3499
2 жыл бұрын
That timer🤣🤣🤣😂
@prathampatel1740
5 ай бұрын
Since sorting is too long I’d assume we want an O(n) solution, so we could just make a count array of length n, with the ith element being the count of (i+1), and then check which one is more than 1
@pemrograman-cepat3393
7 ай бұрын
Throw the compiler 😂
@Matthew-cx9gj
Жыл бұрын
I would just cast it to a set and then see if the size changes
@suriyamurugesan6119
2 жыл бұрын
Cyclic sort approach
@DeepakGautamX
Жыл бұрын
That reply was from STEVEN HE! 😆
@luciadoesthings3970
Жыл бұрын
I feel like someone is going to try to learn programming from these
@MrEffectfilms
Ай бұрын
If Light Yagami was a programmer 😅.
@nokhinsiu7210
Жыл бұрын
Print (“2”) 💀
@teminoah2960
Жыл бұрын
Add each element into a set data structure then loop through both arrays get the frequency of each element
@ahmadamirudin5871
Жыл бұрын
Sorting O(n^2) Find duplicate O(n)
@ExecutableSyntax
Жыл бұрын
Making an anime like this would be very easy. You would only need to draw 1 scene
@ReaLad
2 жыл бұрын
Le me* solving this exact problem on leetcode and getting this recommended at the same time😌
@sumanbhattacharya5290
6 ай бұрын
Bro could simply use a HASHMAP
@ckpunka7
2 жыл бұрын
No dude, no... you create an array of n+1 elements that's filled with zeros. Then as you traverse your UNSORTED input, you insert that number into array[index]. if it is not zero that means you already inserted the number earlier and you found your duplicate. O(n) at worst given you only need to find one duplicate.
Пікірлер: 478