Join Jomaclass for full-length videos like this: joma.tech/dsa
Пікірлер: 436
@project-pe6ly4 жыл бұрын
If yall had read the manga yall wouldnt need this explication
@JomaClass4 жыл бұрын
Lmaoooo
@The9TKitsune4 жыл бұрын
I mean Knuth is a great mangaka but he's been on hiatus forever, I can understand everyone's desire to just watch the adapted anime.
@randompotato264 жыл бұрын
TBH I think some details are still missing... the LN was a lot nicer and I would recommend over the manga for sure.
@prodigg92994 жыл бұрын
Best comment I've read in a while lmaoo
@martinochristanto52164 жыл бұрын
if you read the light novel you could be the senpai teaching him this algorithm
@nintorws4 жыл бұрын
1.4 million people: Watch a programming anime video just for fun. 36804 of them: I need that power!
@anupchandrahangrai12174 жыл бұрын
Glad to be one of the 95,899.
@mechatronicsprojectsandsim83374 жыл бұрын
Glad to be one of them
@mrdarip42893 жыл бұрын
Glad of be one
@josefaguilar29553 жыл бұрын
Glad
@cp0bo5933 жыл бұрын
Gla
@camuongphan62864 жыл бұрын
When a joking video had a good content
@greatbullet73724 жыл бұрын
this is legendary
@Rhidayah4 жыл бұрын
Senpai why you so fools 🤣 Just kidding
@alg_strawhat1294 жыл бұрын
I wanted to program it myself but I couldn’t, because of my carpal tunnel! Kuso!!!!
@moodman64264 жыл бұрын
unlucky
@Seba-le7mb4 жыл бұрын
If you had read the manga, you could be able to do it.
@abeeonaboat17414 жыл бұрын
Try use voice to text
@abigailyang394 жыл бұрын
Was just randomly watching funny videos to relax. And now I’m here studying during my break time
@arpitkumar45253 жыл бұрын
Lol same
@juanandrescastillofuenmayo66192 жыл бұрын
I always start out by watching random stuff for a break and always end up studying because I either feel guilty for not being productive enough or bc it's a topic I'm interested in. Some ppl just can't escape
@doubleliu Жыл бұрын
Its 4 am trying to sleep
@romyojitpaul22003 ай бұрын
same bro 😂
@MsJooy4 жыл бұрын
yutube overestimated my intelligence once again by recomending this one
@_cytosine4 жыл бұрын
Bro, you got this.
@merowareinstance4 жыл бұрын
Lol, you can do this. KZfaq algorithm will provide what it knows you can handle 😄
@NStripleseven3 жыл бұрын
H
@princyangelina_n4 жыл бұрын
Thank you, Senpai!
@defalt77324 жыл бұрын
Your comment made him to do this vid🤣 Tq
@princyangelina_n4 жыл бұрын
@@defalt7732 OMG!! I'm caught 😅😅 I can't be guilty of this... 😭😭 But yeah I can't JUST thank him cuz he has put efforts to explain it though he doesn't really have to.
@Majestic4694 жыл бұрын
Lol
@kienhuynh16144 жыл бұрын
Some additional info for Method 3 for who was struggling like me: - Notice that in the algorithm, after the hare and the tortoise meet at M in the cycle, we move the hare back to the beginning, then the hare and the tortoise moves 1 step at a time now. - We want them to both meet at the beginning of the cycle now. Why? Because that proves that there are 2 Nodes that have the same number (the node just to the left of the cycle, and the node that close the cycle). Which proves the main problem. Now: - The hare has to take x steps to get from the beginning to reach the cycle. - The tortoise also move x steps in that time. Our hope is that they will meet at the beginning of the cycle after x steps. How do we know that they will meet again after x steps? The hare is stepping from the beginning, the tortoise is stepping inside the cycle, right? To know how, notice the reason why he proves that z = x mod L, and this can be translated to x = kL + z. Basically, while the hare is walking outside in kL + z steps to reach the beginning of the cycle; the tortoise also loops in the cycle k times, goes back to the old meeting point M, then moves z more steps to go to the beginning of the cycle. And they meet. Sorry for being lengthy.
@knightartorias58723 жыл бұрын
This is 4 months old but thx man
@FINSuojeluskunta3 жыл бұрын
Okay I am starting to get it now. Intuitively it means that even if there is a big distance, for the reset pointer to cover, the one stuck in the loop will stay aligned with it and just cycle, and they will still meet at the same point.
@yelena_3 жыл бұрын
Thank you. This comment is what got me to finally understand it.
@snooglemunch3 жыл бұрын
I still don't get something. How is the cycle constructed? I understand the logic behind the detection and the modulo math for finding the start of the cycle. But how is the cycle constructed in the first place? Isn't this an array?
@yelena_3 жыл бұрын
@@snooglemunch We treat elements of the initial array as "pointers" to the other elements. So if an element at index 3 has the value of 5, that means it points to the element at index 5. Element at index 5 has a different value so it points to the next index etc. When you draw it as a graph you get what's shown in the video. If two elements of the initial array have the same value, that means they point to the same element/node in the graph. The node that has two elements pointing to it is the one we're looking for. (for example, if the number 3 appears twice in the array that means there are two elements pointing to that element, which translates to two links going into that node on the graph, creating a cycle)
@misterplus3064 жыл бұрын
Thank you so much man! That video appeared in my recommendation yesterday and I was so confused... This video is much easier to understand.
@ImposterBraum4 жыл бұрын
Oh my god thank you soooo much Quality work as usual
@mohammednagdy66614 жыл бұрын
This is awesome I would love for you to do a series about learning algorithms! I always have huge problem with figuring how to build them!
@TheSchwartzable2 жыл бұрын
This was exactly the explanation I was looking for!
@darthbumblebee73104 жыл бұрын
This is a great explanation. I really liked the way you presented the content. I have been working on a proof that relies on fewer variables and tries to play a little more on intuition. Here it is: --- Let: T be the length of the tail (represented in the video by 'x') L be the length of the loop t be the number of steps the Tortoise has taken after it has entered the loop, starting from the loop's entrance. So at t=0 the Tortoise is at the loop's entrance, at t=1 the Tortoise is one node into the loop, at t=L the Tortoise is back at the loop's entrance, and so on. It follows that the "position" of the Tortoise in the loop is: t mod L. And, the position of the Hare at time t in the loop is: (T + 2t) mod L. The 2t in the above expression comes from the fact that the Hare travels twice as fast as the Tortoise. The T is there because it is the total distance in the loop the Hare has traversed at the time the Tortoise enters the loop. We know T is the distance the Hare traversed in the loop because at the time Tortoise entered the loop, the Tortoise traveled a total of T steps (including the tail), which means that the Hare traveled a total of 2T steps (it is twice as fast) - but the first T of those 2T = T + T steps were spent traversing the tail. So the rest of the T steps the Hare traveled in in the loop. So the meeting of the Tortoise and Hare will occur when: t mod L = (T + 2t) mod L Subtracting t and T from both sides we get: t mod L = -T mod L (These are valid operations since [a mod m = b mod m] if and only if [(a + k) mod m = (b + k) mod m] This tells us that the meet will occur at position: -T mod L. What is position "-T mod L"? It is the position in the loop we get to when we walk T steps backwards in the loop starting at the entrance. So the second part of the algorithm is correct since the pointer starting in the loop will be at the loop's entrance after walking T steps forward from the meeting point. --- Anyway, I hope to see more videos on this channel. Awesome work!
@203bigd3 жыл бұрын
yo this is dope homie, nice work
@seekndstroy25604 жыл бұрын
big need, thanks joma
@Benw88884 жыл бұрын
Why the algorithm worked wasn't my cause of confusion. What wasn't clear was how you apply this to the problem. It wasn't clear because the most obvious interpretation (which turned out to be right) had a pitfall: what if you immediately get caught in a cycle, like if the array starts with {1,2,...}? (It's a cycle if array indexing starts with 1) And then I realized that array indexing starts with 0 D; which prevents you from being in a cycle at the very start. This forces the graph to turn into the shape you assumed: a line leading into a cycle. ^I think you needed to add this into this video. It was also veeerrry roughly breezed over in the anime edition
@rct3vids993 жыл бұрын
Thank you for mentioning this! I was wondering about the 0th index and this makes perfect sense
@Timformers3 жыл бұрын
When a comment blows your mind way more than the video
@L1Q3 жыл бұрын
I don't see why indexing starting from 0 makes it impossible to have a loop. even if all the numbers are unique, there can still be a place for a number in the array where it points to itself UPD: now I see it, it's impossible to have a number point at index 0 while being on index 0, then if it points elsewhere, the only way a number is pointing on itself would be it having a duplicate elsewhere. you just never find non-duplicate self pointers by going from 0 base
@samuraijosh15956 ай бұрын
@@L1Q no it's totally possible to have a node point to itself. in graph terms, this is called a self-loop and self-loops can be modelled in code. for example: struct Node{ int val; struct Node* next; } Node starting_node; Node.next = &starting_node; this is a self-loop.
@greatbullet73724 жыл бұрын
MORE ALGORYTHMS PLEASE! This was astounish entertaining
@dimylameri4 жыл бұрын
Can you imagine another application for this algorithm? Because it seems pretty specific to this problem and these constraints
@JomaClass4 жыл бұрын
Not gonna lie, it’s pretty useless in real world applications.
@kratosgodofwar7774 жыл бұрын
@@JomaClass bruh
@Fenvirr4 жыл бұрын
It's literally named Floyd's cycle-finding algorithm, so I'd assume that it only serves that niche purpose. I'd assume you can use it to prevent yourself from revisiting a node when traversing a list as a result of cycles, but I'd also assume there's better methods of doing such.
@TheNewton4 жыл бұрын
Embedded hardware, SKU handling
@tdgray9784 жыл бұрын
Well it’s already kind of a case of an algorithm that does one thing is being used for another problem. Floyd’s algorithm detects cycles, but the original problem was about finding duplicates in an array. It’s by reformatting the problem so that Floyd’s algorithm could be used that they’re able to solve it under the constraints.
@siddhantdeshmukh71204 жыл бұрын
Damn!! Now I may want to check out your other videos
@k2x2x2s2 жыл бұрын
oh Joma your video is so awsome T^T
@user-vl7nk5gj6m Жыл бұрын
Great video. This is my favorite anime.
@AleksandarDragon4 жыл бұрын
Stumbled upon the channel because of anime video, like it so much so that look for this video for the explanation :D subscribed for the normal educational content
@dark_knight98711 ай бұрын
Belive i was just left wondering watching the anime video ,keep up these algorithm videos ❤
@sparkx6114 жыл бұрын
appreciate for this detailed explained video!
@ClaudioParraGonzalez2 жыл бұрын
Beautifully explained. Thanks.
@tseren4 жыл бұрын
I watched a few of these and didn't grasp it until I watched your mathematical explanation. Thanks.
@xx_Ashura_xx4 жыл бұрын
Hey man love your videos! Someone with programming, tech, and comedy lol
@TrueZenquiorra4 жыл бұрын
Joma, totally loving this type of videos. I would pay to learn like this xD
@edwingarcia50434 жыл бұрын
pay 900 dollars ?
@hunghung-mu6se2 жыл бұрын
thanks you for Floyd's Algorithm Explained
@hilmidwiputranto69444 жыл бұрын
1:17 he even gave a spoiler warning, such a cultured man
@RomanTokarenko Жыл бұрын
Nice proof, thanks a lot, man!
@jhonconnor84404 жыл бұрын
This video is pure gold
@pinoyXasian4 жыл бұрын
bruh, this is helping me study and is making it the first leetcode medium I've solved. Whoever said anime wasn't useful?
@Philgob9 ай бұрын
beautiful explanation
@callmechocolateboy4 жыл бұрын
Dude new channel 😎👍👍👍👍👍
@abhilashpatel30364 жыл бұрын
I came here cause the hashmap solution failed and my whole world went upside down 😥
@kevinstefan984 жыл бұрын
I don't see how this solves the original problem of finding the duplicate number, though. The array could easily have extra cycles that are unconnected to the duplicate entry. For instance [1, 0, 2, 2]. 0 and 1 form a cycle, but the duplicate entry is not included in that cycle.
@yogiturtleseraph82084 жыл бұрын
Yeah, if the graph is not fully connected we might have a problem [probably the most frequent case]. But I think we can handwave that for the sake of comedy. And because the rest of the explanation is pretty cool.
@_Ytreza_4 жыл бұрын
Numbers in the array are from 1 to n, it can't contain 0. I think this ensures that the duplicate is always in the cycle.
@muchammadwahyu29934 жыл бұрын
Please make more anime videos. It makes programming so funny and enjoy to learnt 😁
@jheandaza73344 жыл бұрын
Excelente! I admire you!
@MehtaAvant2 жыл бұрын
For the input set [2,1,4,3,4] The 2 and the 1 point to eachother, and the 4 and 3 also point to eachother. How does the algorithm deal with the case when the duplicate number is entirely outside of the loop that starts with index 0 ?
@lamrin91784 жыл бұрын
RIP , was searching for floyd warshall watched the whole thing :))
@CodeF4164 жыл бұрын
Cool joma has a programming channel thank you joma
@kr13031 Жыл бұрын
Thanks sir, this helped me last night to sleep after 2 days of no sleep. After I checked I fell asleep at 11.47 .
@Nemo-ir9zl2 жыл бұрын
thank u so muchhhh
@John_does4 жыл бұрын
Question, how you avoid lenght 1 loops in the question in the original video? like if 1 is the first element?
@naasifn4 жыл бұрын
So, once we get X mod L means Z we have the starting point of the circle and decreasing by 1 we have the duplicate number, right? If I am right, then why don't we say the meeting point is the duplicate number? In the problem they didn't want positions of duplicate numbers. The just wanted the value which was written twice. Ain't that right? or we just need to make sure that duplicate numbers exist and we need to check arr[x-1]==arr[x+z]?
@corozco4 жыл бұрын
Coolness Intensified
@helboy11114 жыл бұрын
Am I correct in my understanding that after the hare moves 1 by 1 (from the meeting point described at 8:08 ), the hare might still loop any number of times before getting to the start of the loop at the same time as the turtoise? Since the turtoise moves x, which is later written as l + l + ... + l + a, and a = z that would mean that the hare still moves any amount of loops equal to the distance the turtoise has to travel as l distance as part of x. Great video! I already put aside the Wikipedia page on it for later, but this works even better ;)
@RioChandra4 жыл бұрын
i still don't get it,. maybe after code by my self or read some explaination from other reference,. my brain too hard to understand..
@forgottenmohawks87344 жыл бұрын
I still don’t get how we use it for the problem in question though 😅
@henkkk4503 жыл бұрын
Me too mate
@funnygeeks81264 жыл бұрын
You should have explained how we know we will start on the line part of the graph: 0 indexed arrays, but numbers start at 1.
@EricDongh2p4 жыл бұрын
Yeah I was also confused on that part.
@couchcamoteChannel4 жыл бұрын
I found this algorithm way before for finding out if a Linked List has a cycle. So I was surprised when I saw this same algo used on finding a duplicate number in an array.
@zAlbee24 жыл бұрын
I was surprised as well. ~Turns out it doesn't work. Try [1,2,2] or [2,1,3,3]. See my comment for why.~ EDIT: I WAS WRONG! IT WORKS AFTER ALL 😮
@L1Q3 жыл бұрын
@@zAlbee2 please explain why it works on [2,1,3,3] my brain tells me it would be stuck on number 1 (index 1) and think it's the solution. UPD: ok so the reason why [2,1,3,3] would still work is because we start from index 0 and jump directly to index 2, which contains value 3. this fixes both turtle and hare on index 3. holy shit this came to me. if a number is pointing to its own position it's basically out of the graph completely unless it's duplicate! genius! thank you Albert for giving a push in the right direction now I see the solution clearly AND understand why it works
@blindarion41274 жыл бұрын
What if the induced graph has multiple connected components (a.e. [2,3,1,5,6,5,5])? Starting in a wrong connected component means that you won't get a correct result, right? Am I missing something? Is this input illegal?
@Jaojao_puzzlesolver3 жыл бұрын
Can't wait for the season 2
@pablojavier7965 Жыл бұрын
6:03 Why do you use a set and not another array/list? You’re gonna fill n elements in the worst case scenario in both so is there an advantage in using a set?
@richard17624 жыл бұрын
Just use set negative to the value index and use the abs of the value while you scan the array to check whether the value index is negative. If its negative it means it has duplication.
@Naton4 жыл бұрын
Err what are you talking about?
@jasonpamintuan70964 жыл бұрын
Yeah I saw that solution, but in this case you can’t modify the array
@Arjunsiva4 жыл бұрын
Verithanam da Mamey!
@sanjayd96753 жыл бұрын
yes macha
@z41n4 жыл бұрын
Hey Joma, what tablet do you use to do these types of explanations? Really need a simple and clean one. Thanks
@huuphuocle26334 жыл бұрын
Correct me if I'm wrong. But if you start a a node in the circle, the two pointers will meet at the starting node, them you will return value of that node no matter where the duplicate is. Edit: i figure it out.
@hellosagar3 жыл бұрын
Thanks
@Rohith_E4 жыл бұрын
@18:36 L-Y is not the remainder of Y mod L after all the other Ls are gone. Rather we know that there is at least one complete loop by hare before it meets tortoise, so we rewrite (k*L - Y) mod L as (L - Y) mod L (since k cannot be zero) which is Z mod L which equals Z.
@L1Q3 жыл бұрын
what happens if any number is pointing on itself? UPD: my mind just ascended to solution. if any number points at itself (value = 0 based index), we will never find it by going from index 0 and forward through the graph. it is only possible to get on the index the value points to by having a duplicate value pointing to same index.
@Kris_misra2 жыл бұрын
Hey can we also use it in counting how many times that particular alphabet is being repeated I a string(array of string )?
@artemy10462 жыл бұрын
That is so cool! What program are you using for this video?
@RainerRitsch4 жыл бұрын
Can somebody please explain how to find out the length of x and thus the start of the loop? Everything afterwards is clear to me
@siobhanahbois4 жыл бұрын
An explanation about finding the entry point part. First assume when fast and slow meet, slow has moved a steps, and fast has moved 2a steps. They meet in the circle, so the difference a must be a multiple of the length of the circle. Next assume the distance between beginning to the entry point is x, then we know that the slow has traveled in the circle for a-x steps. How do we find the entry point? Just let slow move for another x steps, then slow will have moved a steps in the circle, which is a multiple of length of the circle. So we start another pointer at the beginning and let slow move with it. Remember x is the distance between beginning to the entry point, after x steps, both pointer will meet at the entry of circle.
@TraceguyRune4 жыл бұрын
But what is the line vs the circle?
@NivedhaOrton4 жыл бұрын
Make more videos about algorithms or data structures....
@tofo71514 жыл бұрын
where do i start to learn most of this? any books you can recommend?
@emmaodonnell82754 жыл бұрын
Can you get a false positive on a cycle here? If you're using 1 based indexing and you start the hare and turtle in position 1 then you immediately get stuck in a loop right?
@Iknowrealtv4 жыл бұрын
I'm not even a programmer but I need to watch this. Since the Anime was just to good.
@merowareinstance4 жыл бұрын
iKnowRealTV lol, best answer. How did you get into programming? Umm, I watched anime. Lolz
@Iknowrealtv4 жыл бұрын
@@merowareinstance facts
@danielmc56934 жыл бұрын
This might be a dumb question, but how do you know when to end x and start the loop. If the hare went twice as fast as the tortoise, wouldn't if go the beginning of the array?
@RainerRitsch4 жыл бұрын
my question exactly
@randomcarbonaccumulation64784 жыл бұрын
From my understanding of the problem, the tortoise and the hare don't go through the array in order (array[0]-->array[1]-->array[2]). Instead, they start at index 0, look up the number in the array at this index, and go there. So if array[0] was 6, the tortoise would go to array[6], and if array[6] was 3, it would go to array[3] in the next step. (The hare does the same, just twice as fast). Think of the value in the array at a certain index as a pointer that tells tortoise and hare where to go next. Because there is a duplicate value in the array, two of these pointers point to the same index. Once the tortoise or hare get to the second occurrence of this value, they go back to a value they have already visited, and if they follow that path, they will eventually get to the second occurrence again and again and again. We don't tell the tortoise and hare where to loop back, they automatically do once they get to the duplicate number. Floyd's algorithm can detect where this loop starts. At least that's what I understood. I hope I could help, tell me if I got something wrong
@user-vf3kk8vg4n4 жыл бұрын
"Senpai you are so cool!!"
@k0alk04 жыл бұрын
What will happen if, let's say, there is a value of 1 in an element with the index of 1?
@nikatamliani37904 жыл бұрын
array must be zero indexed, so at firs you must reach some index with value 1 to reach index 1, this means the duplicate number is 1, otherwise you can't reach index 1. it's not special case.
@B1SQ1T3 жыл бұрын
I'm a bit confused by the whole traverse then loop part. Is X the size of the whole array? Like say I have [1,2,3,4,4] is X gonna be 5?
@imacds4 жыл бұрын
Use a Tardis instead of a Tortoise, so that P = NP.
@ogeretla93324 жыл бұрын
hey man, nice videos. (im not good at algorithms and stuff)Just wondering, would you be able to determine (from the limitation in speed) how long can the variable N get? Cuz then, by seeing the time in which the program has to determine the duplicate, you'd know that even with an algorithm like Floyd, if you have N a certain size it would exceed the time.. So you could just estimate the max length of N and just make a frequency array... I m not sure if this would really exceed the space no matter what, but time should be fine.... right? probably its really stupid question, the main thing is that a frequency array wouldnt work cuz the max size of N is not specified, and im really trying to see if theres a way to make it work.
@LUITEN14 жыл бұрын
Thank you very much!! I just started studying C, like, 4 hours ago, and got pretty happy to kinda understand the anime video an fully understand this one! Subscribed!
@andreicalcan48894 жыл бұрын
How do you get from an array to a graph using pointers?
@karansharma89513 жыл бұрын
he is converting array to linked list
@SauravKumar-kj1uu4 жыл бұрын
U can get in a way like... There is a circular race track... Everyone starts with different speed.... They will meet again at there LCM of speed... Trying in linked list loop
@bansalashu16134 жыл бұрын
no you cant like that because you have to first know where the circular track starts.
@rohandevaki43492 жыл бұрын
great explaination, you could have explained how to write code for it too,
@thanhhuynhtan97244 жыл бұрын
hello senpai, ware ware wa Pain.. kami da, and my question is what is the name of program you use to write things out on screen. Thank you so much
@MrExample004 жыл бұрын
Anyone know what software he uses for the explanation (blackboard)
@del65532 ай бұрын
The proof is under the assumption that y > 0 if y = 0, then xmodL = 0, meaning x is a multiple of L, which implies the meeting point would be at the start of cycle, and the tortoise would still meet the new pointer at the start of cycle, so in the end everything still works out
@jasonhsieh86448 ай бұрын
the best video for explaining why the distance magic would work! X mod L = Z is amaing!
@nirajraut94083 жыл бұрын
Can someone tell me which software he is using to write and proof that algorithm?
@vinaysinghjadon19594 жыл бұрын
Explaining programming with anime its the best thing i have seen after ben10
@Eireannade4 жыл бұрын
I almost commented on the equation but then I realised you were correct it's just the way you described it confused me. Anyways, well done, I really enjoy reading on mathematical algorithms and this one was really nice, I enjoyed watching the vid. I really enjoy the mathematical aspect of programming it's quite fascinating how mathematics is everywhere in our lives. Proves how idiotic it is to think mathematics is useless after school. Well, loved the vid.
@carmineg2 жыл бұрын
What program/app are you using for the drawing here? It's really nice and clean!
@nicorobin76664 жыл бұрын
Hey Joma San tell me, How to start practicing these algorithms, and what is the best resources / websites to do so?
@panchociarer4 жыл бұрын
Introduction to algorithms by clrs is a good resource
@Ureallydontknow3 жыл бұрын
But you didn't show the function calls or the instruction set with pointers. I already know modular arithmetic and coding but I'm not sure what this video can do for me. Show the code.
@cp0bo5933 жыл бұрын
I tested, it works but I didn't understand just why it does work. Thing I didn't understand is neither tortoise nor hare is following a regular sequence. For example in that anime video, code is used for 3,1,3,4,2 array if I am not wrong. In that example, tortoise goes from first element of array to fourth element of array then fifth element of array then thirth because the code is tortoise=nums[tortoise] and hare goes from first to fifth to fourth to thirth because the code is hare=nums[nums[hare]]. Tortoise doesn't go like 1 forward 1 forward 1 forward. It goes 3 forward 1 forward 2 back. I understood the math in these video and why x mod L = z but what exactly prooves x mod L = z and why? Can anyone help?
@Seanabo3 жыл бұрын
I get that we've found a cycle but I still don't get how that cycle is used to find the duplicate number in given set.
@NStripleseven3 жыл бұрын
Not sure I understand what Floyd's algorithm does. What is the thing the pointers are on? What does that represent?
@not_vinkami4 жыл бұрын
so why don't we use nums.count(i) for i in nums (Not in correct syntax)? We can just catch nums.count(i) > 1 and output i
@marcocheng27364 жыл бұрын
You thought this video is supposed to be meme, but it was ME FLOYD!
@SteveReals4 жыл бұрын
In your anime, you find a duplicate number using the value at a given index as the next index. Is there a generic solution for the special case where a[0] := 0?
@JomaClass4 жыл бұрын
Oh that won’t happen because numbers are from 1 to n in the question. The algorithm doesn’t work if one of the value can be 0
@BetaNegative Жыл бұрын
At 14:35 "you can just think about it" is, well...unenlightening
@user-dp9yn7zf4l3 жыл бұрын
senpai,you are so smart
@lostmeme9862 Жыл бұрын
I tried it and it did not work. Then I realized the ints start at 1 not 0, and it worked.
@vm207093 жыл бұрын
The confusion for me was that the array isn't an arbitrary array of numbers. It's actually a linked list that can potentially go into a infinite cycle.