filmov
tv
LeetCode Problem 498. Diagonal Traverse || Java Solution Walkthrough

Показать описание
LeetCode is a great platform for people who want general coding practice, whether that be for interviews or just wanting to practice their problem solving. I will be taking you through all the steps of finding the optimal solution to each problem on the site following a logical ordering setout by LeetCode themselves.
In this video, we are going over the problem 498. Diagonal Traverse and the goal is to, start in the top left corner, or index (0,0) and snake your way through the 2d index, inserting each element into a new array, when you reach one of the edges of the array you must change directions.
To solve this problem is a little bit more complex than some of the previous problems we have seen, and that should hopefully be the case as we dig deeper into the problems. At the heart of this problem, we basically just need to keep track a couple different things, mainly which directions we are currently heading in the array, and whether or not we have hit an edge. When we do hit an edge we have to change the state of which direction we are moving and continue until we have used up all the moves it would take to consume the initial 2d array.
~~~ Stay Up To Date With My Social Media ~~~
#unknownkoder #leetcode #algorithms
In this video, we are going over the problem 498. Diagonal Traverse and the goal is to, start in the top left corner, or index (0,0) and snake your way through the 2d index, inserting each element into a new array, when you reach one of the edges of the array you must change directions.
To solve this problem is a little bit more complex than some of the previous problems we have seen, and that should hopefully be the case as we dig deeper into the problems. At the heart of this problem, we basically just need to keep track a couple different things, mainly which directions we are currently heading in the array, and whether or not we have hit an edge. When we do hit an edge we have to change the state of which direction we are moving and continue until we have used up all the moves it would take to consume the initial 2d array.
~~~ Stay Up To Date With My Social Media ~~~
#unknownkoder #leetcode #algorithms