Supporting errichto from bottom of my heart for being honset with community and giving knowledge ,far better than scammers selling paid courses with shit content. Keep up bro
@Errichto4 жыл бұрын
Thanks :)
@hshhsjhahsvs77284 жыл бұрын
One of the few channels that doesnt waste my time. Thanks!
@i_vikassharma4 жыл бұрын
More than the solutions, its always delight to understand your thought process. Your approach and content is extremely helpful. Thank you so much!
@bogetutzu4 жыл бұрын
I feel so good that I found you, Errichto. Even if some problems are far over my knowledge, I know I'll get there. Thanks for those nice videos with great explanations :)
@youarecorrectiamwrongbecau13384 жыл бұрын
Hey Errichto! Yours and mine rank was same today for almost the first hour. You started with the last problem. I started with the first. My rank didn't grow after that though. congrats! Double digit rank. CJ20.
@ishaangupta41254 жыл бұрын
Can you discuss about the bottom up dp solution for valid parenthesis string problem from 3 days back? Top down dp was easier to code and visualize but bottom up solution in editorial was insanely hard to understand
@Errichto4 жыл бұрын
If you want to learn iterative dp, watch my dp lectures ;)
@ishaangupta41254 жыл бұрын
I was hopelessly stuck trying to figure out even a top down dp solution. I watched 2 of your videos but still couldn't make headway. Gave up after 2 days. The problem is iterative dp solution is not properly explained. Would love it if you explain it once
@Errichto4 жыл бұрын
@@ishaangupta4125 Do you want me to explain again what happens in the video? dp[row][col] is best path ending at (row, col). To compute it, I use already computed best paths ending at (row-1, col) and (row, col-1).
@ishaangupta41254 жыл бұрын
@@Errichto I'm sorry. I should've been more clear. I wish you could explain the bottom up dp solution for the valid parenthesis string question. I'm commenting on this video because it's easier to reach you on latest videos.
@leetcodesolver90924 жыл бұрын
Nice explanation, I also solved it using Dynamic programming but space complexity is O(M) in my case.
@Errichto4 жыл бұрын
Lower memory complexity is indeed possible, good catch!
@thakararkeval47594 жыл бұрын
please upload kick start round b wondering robot problem
@angiras074 жыл бұрын
I aolved it thanks to your lectures
@vickyandreas12304 жыл бұрын
Always see this channel's videos, so informative
@surajkumarsharma57964 жыл бұрын
From where you have learnt analysis of algorithms To find which algo is efficient All of time complexities and so on
@Errichto4 жыл бұрын
Watch a video on "how to start with competitive programming" kzbin.info/www/bejne/rnLImouvbZJsj5o basically, solve problems and you will learn things.
@dhananjaysonawane19964 жыл бұрын
#errichto What could be the approach if grid has -ve numbers as well? My intuition : we need to move in all 4 direction.
@agent0zer04 жыл бұрын
This approach works for negative numbers as well. We shouldn't move in all 4 directions because the question instructions say that we can only make a down/right move.
@Errichto4 жыл бұрын
Negative numbers change nothing here. But if we were allowed to move in all 4 directions (without repeating the same cell), that's an NP-hard problem. EDIT: it's just Dijkstra if we have posivitive values and can move to all 4 neighbors.
@pqrabcd4 жыл бұрын
Why does this need DP? Can it not be done using BFS with min-heap to give shortest next index? Is it not similar to Dijkstra's shortest path algorithm?
@ashish11220004 жыл бұрын
Could you do a video on the problems in today's CJ Round 1B please? The problems were really interesting and can be great learning tools.
@sasankasekharde98354 жыл бұрын
Why don't you do a video on the gear that you use to code/build anything? We would love to see it.
@oziomaogbe86654 жыл бұрын
please which screencasting software do you use?
@esbanarango4 жыл бұрын
@Errichto Thank you for all your work! I really enjoy your videos! I was wondering if you will do a video of CodeJam Round 1B 2020?
@athenanouhi3 жыл бұрын
@Errichto, thank you for the video. How about if the question is finding the actual paths that lead to the minimum sum path? This is an interview question and has been puzzling me.
@karanh4 жыл бұрын
Can you explain the else part of the solution? Especially where you compute the min()
@karansagar78704 жыл бұрын
Can u make video with bigger font or more zoomed version ?
@gladwinrojer2734 жыл бұрын
Please improve video quality atleast 720p
@iamsuperwen4 жыл бұрын
What if it can also move up and left? Thanks in advance.
@aryanlohani6224 жыл бұрын
It would always increase the sum
@zacklee25104 жыл бұрын
Then you would have to represent this as a weighted graph and run some shortest path algorithm like Dijkstra’s
@Danzlh4 жыл бұрын
@@aryanlohani622 not neccesarily. in small grid that might be the case, but you can try to construct a 5 x 5 example where moving up/right produces a smaller sum.
@rentib91364 жыл бұрын
@@aryanlohani622 nope and here is an example 1 9 1 1 1 1 9 1 9 1 1 1 1 9 1
@rentib91364 жыл бұрын
Just like Zack Lee said it will be enough to run Disjkstra on the grid, I dont think there is any way to solve it faster than O(n * m * log(n * m))
@israkulhaquetusher32564 жыл бұрын
what will be the recursive approach ??
@aparna83384 жыл бұрын
Your videos are soo helpful
@999ggod4 жыл бұрын
Hey @errichto I got a similar question in my interview but couldn't solve All the grid cells have an arrow directions, if we move along arrow direction then cost is 0 else cost is 1. Find min cost to reach bottom right from top left. You can move in all 4 directions Please help!
@arthak24754 жыл бұрын
Arrows were only in right and down direction or all 4 direction?
@ZeeshanHussain124 жыл бұрын
use Dijkstra to solve it, for every node you can move in all 4 direction. Weight for every node will be 0 where the arrow is pointing and for rest it will be 1. It will take nlogn but there is a better solution in o(n) using 0-1 bfs
@999ggod4 жыл бұрын
@@ZeeshanHussain12 thank you my friend 01 bfs does look like the correct approach
@TheJoker-cm5mf4 жыл бұрын
Stupid question. What’s the difference between x++ and ++x?
@rentib91364 жыл бұрын
++x (preincrementation) means: x = x + 1 and then do sth; x++ (postincrementation) means: do sth and then x = x + 1
@nguyenhoanvule57554 жыл бұрын
Which keyboard are you using for coding?
@sounishnath5134 жыл бұрын
can we apply BFS like yesterday problem?
@agent0zer04 жыл бұрын
You can BFS every possible path in the grid but you will be searching many paths that are not required. This is a standard DP problem where there is optimal substructure and overlapping subproblems. Therefore, DP is the most efficient way to solve this problem.
@israkulhaquetusher32564 жыл бұрын
i have applied bfs and got WA :-(
@devanshmaurya99284 жыл бұрын
I applied DFS and got TLE
@sounishnath5134 жыл бұрын
@@agent0zer0 hmm. Later I understand.. but. I interest in how to implement.
@Errichto4 жыл бұрын
How would BFS use values from cells?
@9MAS914 жыл бұрын
was waiting for this video, did not expect it to be so fast
@seaorz4 жыл бұрын
Did you cleared Codejam Round 1 2020?
@FazeelUsmani4 жыл бұрын
Hey! Errichto, every time you pre-increment variables, why? Is it any time-saving trick?
@moby_vyk4 жыл бұрын
pre-increment is usually faster (does not need to store a temporary). Let's say you want to implement it. The code is simply: int pre_increment(int& i) { i++; return i; } While for post-increment is : int post_increment(int& i) { int temp = i; i++; return temp; }
@FazeelUsmani4 жыл бұрын
@@moby_vyk Wow! nice. Thanks! for the explanation
@rustmc4 жыл бұрын
@@FazeelUsmani tbh with primitives like int it doesnt really make a difference, but its good practice anyways and it expresses what you are trying to do better
@FazeelUsmani4 жыл бұрын
@@rustmc okay, I'll make use of it. Thanks Fox
@mkgcodes4 жыл бұрын
For 2 days I cannot access LeetCode.
@dominikwawszczak5234 жыл бұрын
Could you make a video about debugging? I mean about this stuff like debug()
@nikhilgautam28574 жыл бұрын
You don't need that level of debugging code to debug your code it is for complex problems like Np hard and bigger lines of code
@dominikwawszczak5234 жыл бұрын
@@nikhilgautam2857 How do you know what I need?
@nikhilgautam28574 жыл бұрын
LoL if you needed it that badly you'd had that already Ps:- I got it in first try of Google it's not even that hard
@dominikwawszczak5234 жыл бұрын
@@nikhilgautam2857 I don't think I need it "that badly". I just believe it's gonna help me a lot.
@alimodz62534 жыл бұрын
video is done and im still trying to understand the question
@huoyuhao1673 жыл бұрын
I made an achievement of trying hours to derive a solution for this, but still wasn't able to....and I can't understand your approach....😥😢
@sacchidanandverma82014 жыл бұрын
When I opened the problem it was already solved 😂
@arpitdixit96194 жыл бұрын
@@vk-vz8qo It's fun vk
@fiziblank26094 жыл бұрын
sir, which keyboard do you use?
@MatteoYTGaming4 жыл бұрын
Logitech UltraX Premium
@jonathanharder82844 жыл бұрын
What is the name of that cute teddy in the background, I'm asking for a friend.
@mikemihay4 жыл бұрын
Python version please :D
@bethsuni40114 жыл бұрын
> INF = 1e9 + 5 I often see this when I watch competitive programming streams but I haven't figure out yet what it means. Can you please explain? (I mean what's so special about 1e9 + 5, and not say 1e9+4 or 1e9+6)
@learnfromarandomguy70264 жыл бұрын
Maybe this is also related to the number 42. The Answer to the Ultimate Question of Life, The Universe, and Everything.
@mohamedelkaramany98634 жыл бұрын
INF = 100005;
@rentib91364 жыл бұрын
5 is a magic number, the same goes for 7
@bethsuni40114 жыл бұрын
@@rentib9136 why not use 1e9 instead?
@rentib91364 жыл бұрын
sue gondeese, lets say that you have array of n numbers where it is said that array[i]
@PavanKumar-jt5mq4 жыл бұрын
where is the timer?
@Errichto4 жыл бұрын
I'm not using it this week. I can be calmer and explain more. I'm not saying that I explained things in detail in this problem :D
@ChandraKanth74 жыл бұрын
A better solution will be in O1 space
@Errichto4 жыл бұрын
How do you want to do it in O(1) space?
@ChandraKanth74 жыл бұрын
Errichto Yes I guess you can keep the same array and keep updating it instead of creating another array. Then return the last value of the 2D array. And that is O(1) space.
@Errichto4 жыл бұрын
@@ChandraKanth7 we keep and use the input array, so I would say it's O(H*W) anyway. But yeah, sometimes leetcode problems are about modifying the input without using extra space.
@elandor30844 жыл бұрын
errichto can u pl explain the algorithms ? i'm a begninner i would like to learn
@rentib91364 жыл бұрын
cp-algorithms.com/ thats a cool website with good descriptions of algorithms and nice implementations
@openworld75854 жыл бұрын
Please make a video talk to your subscrbers
@openworld75854 жыл бұрын
thank you so much
@hassambitw4 жыл бұрын
what if we wanted to find the shortest path from every row instead of just the first one
@Errichto4 жыл бұрын
In O(N*M) you can find distances from chosen starting cell to all other cells. If you want to do it X times, multiple the complexity by X.