Nice series. I like it a lot. A small correction though in your attempt to explain the basic idea. In the dictionary, the third row should be *Key:* 12 *Value:* 2 and not *Key:* 3 *Value:* 2
Can you please do more of these problems There are examples out there but no-one explains like you do, like how a program can be made more efficient by analyzing time complexities I greatly appreciate you uploading these especially now I'll be data structures and algorithms next semester by the way I'm doing Mechatronics in South Africa
It's really confusing when you try to explain what's returned in the integer array because you're using the plural form of the word 'index' (indexes/indecis) when it should be singular. You're literally saying: "It's just an int array with the first value being the first index, and the second value being the second index.", which doesn't make sense. I know what you meant to say, but I thought I'd point it out to help you improve.
karsten600 I completely see how this can be confusing. Let me try to clear confusion. Remember we’re trying to find 2 numbers that add up to the target value. We don’t want to return the actual two numbers in an array, instead we want to return their positions in the array. So since the answer in our example was 7 + 8 = 15. We want to return the index of value 7, which is 1, and the index of value 8, which is 3. Since there are two numbers we decide to return them using a brand new array. The first value in this new array is the first index (1) and the second value in this new array is the second index (3).
Yep I've seen similar solutions posted on multiple forums and this fails the edge case of duplicate values in the array. since C# dictionaries do not let you add duplicate keys. I coded the same thing and my leetcode kept failing because of it. My suggestion is to reverse it and use the indices as the keys and the values as the...values.
With this detailed explanation I finally understood the solution! Thanks!!
yesss this is what I've been looking for!
Great! Keep them coming! Thank you.
Really interesting. Please keep it up. And the sooner, the better :)
Nice series. I like it a lot.
A small correction though in your attempt to explain the basic idea.
In the dictionary, the third row should be *Key:* 12 *Value:* 2 and not *Key:* 3 *Value:* 2
Yiannis Ioannidis damn you’re correct. Thanks I’ll get it fixed
Thanks for that also saw it
I noticed professors also do small mistakes like that on purpose to make sure students are listening and paying attention
Can you please do more of these problems
There are examples out there but no-one explains like you do, like how a program can be made more efficient by analyzing time complexities
I greatly appreciate you uploading these especially now I'll be data structures and algorithms next semester by the way I'm doing Mechatronics in South Africa
that sneaky 18 bugged me up
what would happen if there were two eights in this example array?
bucifalro it would return when it hit the first one.
It's really confusing when you try to explain what's returned in the integer array because you're using the plural form of the word 'index' (indexes/indecis) when it should be singular. You're literally saying: "It's just an int array with the first value being the first index, and the second value being the second index.", which doesn't make sense. I know what you meant to say, but I thought I'd point it out to help you improve.
karsten600 I completely see how this can be confusing. Let me try to clear confusion. Remember we’re trying to find 2 numbers that add up to the target value. We don’t want to return the actual two numbers in an array, instead we want to return their positions in the array. So since the answer in our example was 7 + 8 = 15. We want to return the index of value 7, which is 1, and the index of value 8, which is 3. Since there are two numbers we decide to return them using a brand new array. The first value in this new array is the first index (1) and the second value in this new array is the second index (3).
@@JesseDietrichson Yeah that's much better 😁👍
[1,1,1,1,1,4,1,1,1,1,1,7,1,1,1,1,1] for this input it will fail. We need to add to dictionary only if the value is not present
Yep I've seen similar solutions posted on multiple forums and this fails the edge case of duplicate values in the array. since C# dictionaries do not let you add duplicate keys.
I coded the same thing and my leetcode kept failing because of it. My suggestion is to reverse it and use the indices as the keys and the values as the...values.