Already solved this problem on my own ❤ still watching your video to gain something new ❤ Thanks for your consistency 😊
@HtotheG
10 ай бұрын
I already solved this own my own last night 100% thanks to watching your videos and finding similarities in the Neetcode 150 where I took a recursive backtracking with memoization approach. Still learned a lot from your video, love it and keep up the great work!
@NeetCodeIO
10 ай бұрын
Nice job!
@yaswanthkosuru
10 ай бұрын
I don't know why it's hard problem😂
@HtotheG
10 ай бұрын
Some of its difficulty for me came in things like dealing with integer overflow adding just two of the three recursive backtracking calls requiring nested modulos, probably not something python coders would see difficult but in Java land it's a thing. Additionally, you have to figure out the optimization that you can only get at most steps/2 from the origin and make it back or your 2D array might be too large and result in memory overflow. In a medium problem this would probably be seen as a nice optimization, a bonus point in an interview, but in this hard problem you will not even be allowed to submit without this optimization. Although I came up with the solution quite quick that worked in optimal time theoretically, these things definitely reminded me it was a hard problem not medium.
@HtotheG
10 ай бұрын
This problem has seriously made me consider doing leetcode in Python from here on out despite my 160+ Java problems solved
@VidyaBhandary
10 ай бұрын
Thank you for the daily coding problem answer ! And 2 solutions !!!
@NeetCodeIO
10 ай бұрын
Glad it helped!
@LordWannix
10 ай бұрын
Was waiting for this, Thank you :)
@dingus2332
10 ай бұрын
This solution relates better to your NeetCode 150 Patterns , similar intuition class Solution: def numWays(self, steps: int, arrLen: int) -> int: dp = {} MOD = 10**9 + 7 def dfs(pos,steps): if pos == 0 and steps == 0 : return 1 if pos not in range(0, arrLen): return 0 #if pos == 0 and steps are less than 0 if steps < 0 : return 0 if (pos, steps) in dp: return dp[(pos,steps)] right = dfs(pos+1,steps-1) left = dfs(pos-1,steps-1) stay = dfs(pos ,steps -1 ) total = (right + left + stay) % MOD dp[(pos,steps)] = total return dp[(pos,steps)] return dfs(0 , steps)
@jessanraj9086
10 ай бұрын
Thank you
@bishalkundu7592
10 ай бұрын
It will be really helpful if besides the Daily Problems if you can also solve the problems for LC Weekly and Bi Weekly Contests as well! Thanks 😊
Пікірлер: 12