One suggestion Kamil. As these problems seem incredibly standard as far as coding interviews are concerned, maybe after solving the problem, you can challenge us with some variant that you can construct.
@jameshello384 жыл бұрын
Yeah that would be awesome.
@djBC100004 жыл бұрын
just go practice leetcode lol, you MIGHT think that you solved his variant, but no one will be able to provide enough test cases. so just go practice leetcode, that will give you a run for your money.
@navneethingankar64864 жыл бұрын
one variant is given the same question you have a given additional integer x, you have to move all less than equal to x to end preserving the original order. and all remaining to front.
@Errichto4 жыл бұрын
I started doing it, thanks for a suggestion ;)
@Philgob2 жыл бұрын
this guy’s code is clean asf and his explanation are the best i’ve seen for these
@ronaldabellano56434 жыл бұрын
You’re really good at explaining better than AlgoExpert
@clem4 жыл бұрын
I mean...Errichto _is_ an AlgoGod after all.
@mugi17264 жыл бұрын
@@clem AHAHAHAHHAHA
@manowabdiaziz4 жыл бұрын
@@clem and boom clement is there 😂😂 . Take ericho to the company
@vishalparmar19994 жыл бұрын
@@clem Haha, Simplicity level : INT_MAX
@occo58774 жыл бұрын
Clément Mihailescu you should really consider having him explaining the solutions. The idea of short video explanations and code walkthrough is great but what algoexpert is missing is an expert like errichto :) he will change your platform otherwise I can find hundreds of mediocre dudes on KZbin explaining algorithms :)
@Kumarsivam0034 жыл бұрын
Your explanation is by far the most suitable explanation, not only in this video but every video you have ever uploaded. Also, I am no expert in coding but this algoexpert advertisement is creeping in every coding youtube channel I search nowadays.
@dragonore20093 жыл бұрын
I'm terrible at algorithms, I'm glad the company I work for didn't ask tough questions and I"m still employed with them, doing great things.
@KrishNa-hm8mk4 жыл бұрын
8:26. Totally what I needed to hear. I was feeling low for not able to think of a solution for Max subarray. Never knew Kadane's algorithm existed. But since you said this I feel that I need to discover more topics and learn as and when a new topic arises. Cheers 🙌
@pratiyushprakash65094 жыл бұрын
I started Leetcode for fun because of lock-down. And now I am enjoying it. Thanks bro :) Subscribed.
@AlokKumar-jh8wp4 жыл бұрын
Thankyou Errichto. The way you explain is incredible. You should launch your own course on data structures and algorithms. I remember the most valuable statement which was told in previous videos: - “Thinking is more important in programming”. These are golden lines
@Francisco-zi2qg4 жыл бұрын
I couldn't agreed more on your final thought, that's why so many people gets frustrated when starting competitive programming. If myself of fifteen years ago have seen this video it would had been much easier, well by that time there weren't KZbinrs. Excellent work and thanks.
@_GabrielNexT4 жыл бұрын
The quality gets better with each video. Congratulations bro!
@arthurg59664 жыл бұрын
Please make Code Jam 2020 solutions video especially the 3rd, 4th and 5th question. Also your explanation is really awesome. Not too difficult to understand nor fells like too much spoon feeding just perfect. This channel feels like my 1 stop to all my competitive programming needs.
@TOpCoder1004 жыл бұрын
Would be extremely helpful!
@jimwoodward72934 жыл бұрын
These videos are great -- your explanations are so straight forward and logical.
@vijay68774 жыл бұрын
The category of this video is Education. Now legend is not playing sports but become the coach. btw love your videos.
@chai18174 жыл бұрын
Loving this series! Will we see a Code jam Quals video soon? Would love to hear your explanation of those last two problems! Keep up the great work!
@dantran61924 жыл бұрын
I also looking forwards to the Google Code Jam Qualification video explanation. The last problem has so many maths theorems.
@stonecoldcold29414 жыл бұрын
Love this serie bro! I want to see you uploading for all 30 daus
@siddharthpanigrahi38554 жыл бұрын
if you use index , then you can swap nums[next] and nums[i]. you wont have to put zeros in end.
@cactusbee84744 жыл бұрын
Great! You have amazing talent to explain solution. Not everyone has that talent. Good luck!
@abdelrahmanadel89984 жыл бұрын
Your explanation is fantastic plz do playlist for algorithms
@mohammedshoaib16354 жыл бұрын
I like Errichto’s video, then I watch it because I know it’s going to be good.
@user-dj9ul7vq5q2 жыл бұрын
Sigma Rule: Submit the solution, without testing... 😂 Errichto is on the God Level
@houssem85974 жыл бұрын
Love the daily uploads great content
@stefanogagliardi46654 жыл бұрын
Very good from Italy. Last for cycle to get difference of size (so add n 0 to the end) is very ingenious. Best regards!
@saikiranangalakudhiti56774 жыл бұрын
Awsm idea..! After i seeing this question i did using the swap operation it made to complete in 3 lines and 30sec.. but thinking like you practically is my aim.. thnx for the new thought
@mayukhchanda58054 жыл бұрын
Thank you for making these videos. I am taking this challenge and so far your videos have helped me a lot to understand and learn better ways to solve problems. Please keep up this series.🙏🙏 Really appreciate the videos
@jay-rathod-014 жыл бұрын
Well I felt todays problem was easier than the previous one's.
@jonmichalak73464 жыл бұрын
keep it up man, you're a beast. i learn a lot from your solutions
@PoorSkill4 жыл бұрын
your explanations are so good
@secretmystery83054 жыл бұрын
Hey you are a great man. Your a knowledge powerful man on computer programming.
@learnstochastic4 жыл бұрын
Errichto's sense of humour.❤️
@occo58774 жыл бұрын
I would buy algoexpert only if you were presenting in the videos :) Since you are an indeed an expert, you bring a totally different view to the problem when you are explaining it. You have the experience to give the big picture that algoexpert doesn’t. At least from the one free video I tried to watch. Please make more series like this. I would gladly pay you :)
@solvingcodingchallenges19134 жыл бұрын
Wow. Your skills are impressive.
@w47-p1e4 жыл бұрын
sorting the vector with comparator (x!=0 && y == 0) would solve it in one line. :)
@asdfg65284 жыл бұрын
thanks for explaining line by line
@shahirabdullah54384 жыл бұрын
Thank you so much for making such kind of videos.
@elandor30844 жыл бұрын
ty Errichto
@jeffkirchoff144 жыл бұрын
def move_zero(list): empty=[] for i in list: if i !=0: empty.append(i) count=list.count(0) for s in range(count): empty.append(0) print(empty) move_zero([1,4,0,2,0,6,8,0,1,5])
@seanpe64804 жыл бұрын
This works but is not an in place algorithm. You're creating a duplicate array, which creates a space complexity of O(n). It works though!
@MetalNeo914 жыл бұрын
here is my solution : def order(L): a = [] b = [] for i in range(len(L)): if L[i] == 0: a.append(L[i]) else : b.append(L[i]) return b+a print(order([1,0,0,1,1])) print(order([0,1,0,3,12]))
@shahanahmed9524 жыл бұрын
Great Video Erricto! The explanation was done marvelously keep doing it like this! Also I'll be sure to checkout Algoexpert like you said for support. Cheers!
@anjanas_life4 жыл бұрын
Congrats on your first youtube ad/promo
@maikopskoy4 жыл бұрын
Damn this was well explained. I already feel a bit better
@НикитаШуляк-б6в4 жыл бұрын
The eazsiest solution for this problem is to use a method like in bubble sort :) When you come up agains with 0, move them till the end while swapping him with other elements. It would take quadratic TC but constant space, which reqired.
@Britas10304 жыл бұрын
I haven't watched the video. Yet I see the timer and knowing that it is a good problem.
@ialpha64314 жыл бұрын
We can also swap `nxt` with `i` in the first for loop and be done with it right there.
@atharvjain54244 жыл бұрын
have you ever tried doing usaco solution guides? that would be really helpful... keep up the good content!
@reformed_attempt_14 жыл бұрын
It's definitely possible to come up with solution for max subarray sum and xor. Takes about 2 hours, but possible
@raulpodar59944 жыл бұрын
Hi @Errichto, I really like this series. What do you use for drawing ? Is it a drawing tablet ?
@vineetkothari3984 жыл бұрын
A video on Google Code Jam qualifiers,especially the last 2 questions,would be very helpful!
Errichto, can you please tell the runtime and memory consumption of your solution ?
@ezdp4 жыл бұрын
will you upload a screencast/explanation of Google Codejam Qualification Round?
@CarrotCakeMake4 жыл бұрын
Loved it great video.
@dscmtr6864 жыл бұрын
For me this problem is similar to removing duplicates from sorted array in O(n).
@anandkanade95004 жыл бұрын
You can use partition in C++ stl
@SamDaBest4 жыл бұрын
I think changing nums[nxt]=x to swap this two numbers will be faster You will only need one for loop
@prakash_774 жыл бұрын
Did you see it in the solution? Where it discussed the sub-optimal vs optimal approach?
@SamDaBest4 жыл бұрын
Prakash Arora I actually solve with this way
@prakash_774 жыл бұрын
@@Catalyz7 It is same complexity wise but we don't have to iterate through the loop twice. In worst case, all zeroes result in traversing whole array twice. Therefore, swapping solution is optimal. Comparing swap operation to assignment operator is immaterial. Doesn't make much difference. Assignment is either way a fast operation. Swapping is just two assignments.
@jameshello384 жыл бұрын
1:03 was that real or just some sound effect?
@djBC100004 жыл бұрын
brah it is real lol
@miguelperezpal4 жыл бұрын
Great content!
@divineforever86914 жыл бұрын
can u make a video on problems on this codejam.
@luisresendiz32214 жыл бұрын
The same solution, perfect
@TheAceInfinity4 жыл бұрын
Very nice videos :)
@xNiickT4 жыл бұрын
Nice video thank you. Is the time complexity O(n logn) ?
@prakash_774 жыл бұрын
O(n) because we are just traversing the array. And there are n elements in the array. Worst case will be O(n+n) ~ O(n) (when all elements are zeroes).
@xNiickT4 жыл бұрын
@@prakash_77 Okay, thanks mate
@cobrandrewg99954 жыл бұрын
Code jam qualifiers tutorial please!!!
@baburayhanshaik51214 жыл бұрын
you are my dhronacharya
@suhendar9774 жыл бұрын
youre so amazing ! please make an apps that have a case and you tell us how to solve it. gonna be amazing series thank you !
@andrewlei29804 жыл бұрын
Can you also do: count how many zeros, delete all zeros in the array, append an array of zeroes to the start of the array.
@UNDAGROUNDCREEP4 жыл бұрын
Can I get the advice from any of you, guys. Should I learn C# - > JS/C++ or JS - > C# - > C++? Is it better to start from simpler languages to eventually stick to C++? Share own experience, thanks in advance
@luisoncpp4 жыл бұрын
My experience: First I tried to learn C and I failed, then I learned PHP and I started to feel more familiarized with many elements of the C syntax, then I started to learn C++ and it was much easier than when I tried C first. The C++ syntax even seemed simpler than the syntax of C, and even simpler than those java codes that I had seen at that time and seemed pretty intimidating. Through the years I learned about a bunch of things that I missed on my first try on C++ and why it's considered to be more complicated than Java. If you are only programming out of curiosity, as a hobby, I think you would have a better time learning C++ than learning Java. You can playing with few elements of C++ pretty quickly but Java seems more convoluted at the beginning. This is because C++ let you start using it as a structured programming language and leave the objects for later, but in Java you need to start with object oriented programming right from the start.
@pushpam_kumar_4 жыл бұрын
Make video on Google Code Jam Qualification Round Solutions.
@II_xD_II4 жыл бұрын
I got an approach scan number of zeros in an array then count them add equal number of zeros at the end.
@isytadrug70854 жыл бұрын
you forgot to delete the zeros before re-adding them at the end
@II_xD_II4 жыл бұрын
@@isytadrug7085 i think thats what you did to me :)
@TarequeMdKhan4 жыл бұрын
I was finding difficult to understand your voice earlier. I'm able grasp your English now.. it's quite different than your first video. :)
@booklal4 жыл бұрын
Plz make video of solution of last problem of code jam qualification round
@djBC100004 жыл бұрын
here is how i solved it: void moveZeroes(vector& nums) { int j = 0; for(int i = 0; i < nums.size(); i++) if(nums[i] != 0) swap(nums[i], nums[j++]); }
@silverzero95244 жыл бұрын
same but in python
@navneethingankar64864 жыл бұрын
try the variant i provided with the same approach of yours. (you have a given additional integer x, you have to move all less than equal to x to end preserving the original order. and all remaining to front.)
@djBC100004 жыл бұрын
@@navneethingankar6486 Okay thanks for the question. for your variant, i would use my function above and check for all of the elements that are
@navneethingankar64864 жыл бұрын
@@djBC10000 but you have changed the order of elements
@djBC100004 жыл бұрын
@@navneethingankar6486 only the order of the elements that are bigger than x, the order of the elements that are smaller than x is preserved and those elements will be at the end of the array. Do you also want the order of the elements that are bigger than x to be preserved?
@jassimmohammed56434 жыл бұрын
I think swapping is a bit faster since it will traverse the sequence only once
@danishirfan93174 жыл бұрын
Please make video on codejam 2020 qualification round
@karansagar78704 жыл бұрын
I saw u at number 2 code jam
@malkeetsapien48522 жыл бұрын
Litt video 🔥
@fiziblank26094 жыл бұрын
will you update video of code jam?
@nawnaw23154 жыл бұрын
3:14am here and still watching
@djkassir20084 жыл бұрын
But using some stl features, we can solve this problem just in one line: fill(remove_if(nums.begin(), nums.end(), [](int x) { return x == 0; }), nums.end(), 0);
@viktorpenelski32654 жыл бұрын
@Errichto What software/input device are you using for the drawing-on-screen part?
@Coder_DhruvArora3 жыл бұрын
A pentab maybe
@ascyrax85074 жыл бұрын
kamil..u the best
@cocoarecords4 жыл бұрын
what does the question mark inside an index do? eg: [?] i googles found nothing
@MetalNeo914 жыл бұрын
def order(L): a = [] b = [] for i in range(len(L)): if L[i] == 0: a.append(L[i]) else : b.append(L[i]) return b+a print(order([1,0,0,1,1])) print(order([0,1,0,3,12])) took me 30s, just create two empty list, in one u put all 0's everyone else in the other list.
@rajdave98624 жыл бұрын
From where Did you learned c++? How can I learn c++ as like you know?
@lvanishkoul16674 жыл бұрын
Make a video on code jam qualification round
@mursalinahmed34634 жыл бұрын
Can you say what vector syntax do?
@peepforlearning60584 жыл бұрын
what pen and software pad u are using to write on screen.....
@abdullahalattar56424 жыл бұрын
well it could solved with a single line, std::stable_partition(nums.begin(), nums.end(), [](int n){return n!=0;});
@AshishKumar-hh9dw2 жыл бұрын
Hey man, can you tell me the name of that online blackboard that you using?
@user-ji7mq7sn6w4 жыл бұрын
Best
@jeremydurand86564 жыл бұрын
Is it bad to remove and append elements in the array?
@aanchalsharma52644 жыл бұрын
I have a doubt function movezeroes's return type is void Then how we can return nums ?🤔 I am confused Please help
@uniqjohni19764 жыл бұрын
He commented it out later in the video. :)
@aanchalsharma52644 жыл бұрын
@@uniqjohni1976 oh yes
@sharudesu4 жыл бұрын
i was able to solve the first 3 problems in google code jam (because they are easy) but got no idea how to solve the other 2 :(
@NotFound-hy7qb4 жыл бұрын
Where is codejam video?
@soepet4 жыл бұрын
Couldn't you just go through the array, remove all 0 and later add currentLengthOfArray - startingLengthOfArray 0 at the end? That wouldn't need nxt and so on
@prakash_774 жыл бұрын
But that would be O(n square) solution. Erase function in vector is O(N+M) where N is no. of elements erased and M is no. of elements moved. Here although N is 1 but still it's a O(n) approach. When inside the loop, in worst case when all elements are zeroes, complexity will be O(n square) because we will call it for every element.
@prakash_774 жыл бұрын
@@jalsol But when you remove the 0, all elements after it are moved to a lesser index (vector is just a dynamic array), in worst case all n elements. That's why it's an O(n) operation.
@YoannBuzenet4 жыл бұрын
I dont know c++ could you do it in python?
@rajdave98624 жыл бұрын
How are you able to think too much fast?
@TwoTeaTee4 жыл бұрын
Your leetcode profile picture is rotated. ‼️
@abhinavgupta58934 жыл бұрын
I wasted too much time not understanding array out of bounds error while coding in cpp
@Paradise-kv7fn4 жыл бұрын
i solved it recurision + memo in around 20 lines...didn't even realize that it can be solved in 3 lines...*sigh* :/