At time =15m44s, I want to know about complexity of line —— if(comp.find(value)! —– As I implement same in C, When I compare/Find like function as —comp.find(value) — Complexity of this step becomes N i.e. for finding element in compliment array, so total complexity becomes N^2 in worst case , average it less than N^2.

I know its been a year since the posting of the video, but I have a question regarding your code which I hope you would explain it to me. First, I like the way you solved this problem. This is really clever solution. second, My Question is: why do you need ( != comp.end ) part? Since you are checking before inserting, its always going to check only the previously added complements. Thanks for posting the video anyway.

Wow great job brilliant solution. but am worried what if the set was of the form [1, 2, 2 ,4]. This algorithm seems to dual mostly on two digits that sum to the required number and not when we have multiple digits.

I haven't watched video yet, just problem. First idea I am having to solve it is, looping through all the numbers in array, then using binary search to find the needed matching pair to make 8, if any. This will be O(nlogn). Let's how I did. Will continue watching video now.

For the last part of the problem, wouldn't it have made sense to do some pruning along the way for repeat complements? It would have bumped up the running time, but for a case where space seems to be the main issue, that would be a necessary sacrifice for the problem if you were to not use multiple systems, wouldn't it?

def checkSum(myList, s): start, end = 0, -1 for x in range(len(myList)): k = myList[start]+myList[end] if k == s:return True else: if k > s:end -= 1 elif k < s:start += 1 return False

print(checkSum([1, 4, 4, 5], 8))

#did that in 2 minutes in python, before he writes the code…!

Can someone explain the scaling part to me. 19:47 “If my set fits in memory, but my whole input doesn’t fit in memory then I can just process it in chunks. I chunk it, I just put it in a set, and accumulate it in the set.” –This doesn’t make sense to me. If the whole input doesn’t fit in memory, in worst case the set would contain the whole input (the case where there is no sum) sooo the set wouldn’t fit in memory either? Even if your processing the data in chunks, you would be using the same set for every chunk which doesn’t work?

I still have something unclear, if the whole input does not fit in memory, and you are processing it parallel, and adding the compliments in the list, when we reach towards the end (while merging) it will still be big enough not to work on a single computer, what am I missing? Is it that the merged array would be built and stored in a distributed manner?

I'm asking this VERY seriously: Is this a joke??? I'm learning programming for no more than one year now, and I solved it as he's final result maybe 5 minutes into this video. So regarding my question, is this really the level required for Google? Is that in general considered a high-level programming?

I didn't understand something about the solution to "throwing in the wrench." How is it better than the first solution (brute force where for each element, you check each other element). He says it's linear, but I don't see that. You loop n times through the for loop, but in each iteration, you have to find an element in comp. To find whether a value is in comp, you need to check each element of comp. So the time complexity would surely be O(sum(r from r=1 to n)) = O(n^2). Unless I'm misunderstanding something about how unordered_set and how comp.find(value) works (I don't really know how they work at all, but I don't see how the complexity of comp.find(value) wouldn't depend on the length of comp)

Thanks for the upload

When she said she was gonna throw a wrench into the mix I felt the pain lol.

I find this valuable, thanks a lot!

Great job googlers! Keep em coming please 🙂

This video was very helpful, thank you. Please do more videos like this.

just a minor typo, it is comp.end() … doesn't change the general idea but still :p

Such a nice video. Very well conducted by both.

Lovely!

The value that you are looking for should be the complement (ie sum-value), not the value itself, great video btw

Stupid video

Who writes the music for these videos. Hahahaha jk. It's very relaxing.

I realize I've got a long way to go. This gives me motivation, though.

At time =15m44s,

I want to know about complexity of

line —— if(comp.find(value)! —–

As I implement same in C,

When I compare/Find like function as —

~~comp.find(value) —~~Complexity of this step becomes N i.e. for finding element in compliment array,

so total complexity becomes N^2 in worst case , average it less than N^2.

I know its been a year since the posting of the video, but I have a question regarding your code which I hope you would explain it to me. First, I like the way you solved this problem. This is really clever solution. second, My Question is: why do you need ( != comp.end ) part? Since you are checking before inserting, its always going to check only the previously added complements. Thanks for posting the video anyway.

I m coming google get ready for world best programmer👌😊

Very intense, super interesting. Also, fun problem!

I loved it !

をよの（やしらむむやはみから

I love the way in which he thinks 🙂

Great video. Thanks for the tips, they're certainly helpful.

i think its easy like this

int sum= (1*2)+9-3; //i think its 8 at first 1

Wow great job brilliant solution. but am worried what if the set was of the form [1, 2, 2 ,4]. This algorithm seems to dual mostly on two digits that sum to the required number and not when we have multiple digits.

i want job in google but iknow only 3 programing languages

1] java

2] php

3] html

i am 14 year young from india

what language is this

😩 just when I thought 1 + 1=2

A new for of mathematics comes

I haven't watched video yet, just problem. First idea I am having to solve it is, looping through all the numbers in array, then using binary search to find the needed matching pair to make 8, if any. This will be O(nlogn). Let's how I did. Will continue watching video now.

How much math do we actually have to know for this software programming becz like fuc i hate math and i love computer

in problem 1 : we can simply use map storing values and index .

For the last part of the problem, wouldn't it have made sense to do some pruning along the way for repeat complements? It would have bumped up the running time, but for a case where space seems to be the main issue, that would be a necessary sacrifice for the problem if you were to not use multiple systems, wouldn't it?

Hi

def checkSum(myList, s):

start, end = 0, -1

for x in range(len(myList)):

k = myList[start]+myList[end]

if k == s:return True

else:

if k > s:end -= 1

elif k < s:start += 1

return False

print(checkSum([1, 4, 4, 5], 8))

#did that in 2 minutes in python, before he writes the code…!

try this algo: (a[0]*a[1]) + a[2] +((a[3]/a[2])*(a[2]-a[1]))

can someone please tell me what does comp.end do.

Thanks for the video!!

How can he think the solution too fast, or it is already practiced?

That noob man…

He crossed the first array 2:00 …. and then asked her if he could repeat the elements… and they are making 'example interview'

I thought of a better solution than him that would work in half the time of what he is proposing.

So does this mean I can get an internship??

解题一秒钟，表演一小时

Can someone explain the scaling part to me.

19:47 “If my set fits in memory, but my whole input doesn’t fit in memory then I can just process it in chunks. I chunk it, I just put it in a set, and accumulate it in the set.” –This doesn’t make sense to me. If the whole input doesn’t fit in memory, in worst case the set would contain the whole input (the case where there is no sum) sooo the set wouldn’t fit in memory either? Even if your processing the data in chunks, you would be using the same set for every chunk which doesn’t work?

great stuff.. thanks 🙇♂️

I have a lot do now. I need to Study hard. Thanks googler, its very motivating

it's painful to watch. just use a map.

Lovely…

There can't be two same elements on the same index. Wut? What array has TWO things at ONE index?

I still have something unclear, if the whole input does not fit in memory, and you are processing it parallel, and adding the compliments in the list, when we reach towards the end (while merging) it will still be big enough not to work on a single computer, what am I missing? Is it that the merged array would be built and stored in a distributed manner?

Man she is hot

I'm asking this VERY seriously: Is this a joke???

I'm learning programming for no more than one year now, and I solved it as he's final result maybe 5 minutes into this video.

So regarding my question, is this really the level required for Google?

Is that in general considered a high-level programming?

I didn't understand something about the solution to "throwing in the wrench." How is it better than the first solution (brute force where for each element, you check each other element). He says it's linear, but I don't see that. You loop n times through the for loop, but in each iteration, you have to find an element in comp. To find whether a value is in comp, you need to check each element of comp. So the time complexity would surely be O(sum(r from r=1 to n)) = O(n^2). Unless I'm misunderstanding something about how unordered_set and how comp.find(value) works (I don't really know how they work at all, but I don't see how the complexity of comp.find(value) wouldn't depend on the length of comp)

This question was way too easy. Literally every single google interview question i've seen so far on youtube has been so easy. Is it really this easy