JUMP GAME V | LEETCODE 1340 | PYTHON GRAPH + DFS SOLUTION

  Рет қаралды 1,076

Cracking FAANG

Cracking FAANG

Күн бұрын

Пікірлер: 5
@AnandKumar-kz3ls
@AnandKumar-kz3ls Жыл бұрын
wow you just changed my prespective of seeing jump game problems how you come up with using graph data structure
@crackfaang
@crackfaang Жыл бұрын
Don't be surprised at the lengths I am willing to go to avoid using DP
@zahraaskarzadeh5618
@zahraaskarzadeh5618 Жыл бұрын
Thanks
@AnandKumar-kz3ls
@AnandKumar-kz3ls Жыл бұрын
Hi , im getting TLE in c++ Edit: i just passed the reference of graph now it get accepted int dfs(int u,vector& graph,vector& dp){ if(dp[u]!=-1) return dp[u]; int jumps=1; for (auto v : graph[u]) jumps=max(jumps,1+dfs(v,graph,dp)); return dp[u]=jumps; } int maxJumps(vector& arr, int d) { int n=arr.size(); vector dp(n,-1); vector graph(n); for(int i=0;i
@crackfaang
@crackfaang Жыл бұрын
Glad you got it working. I can’t guarantee other languages work with the solution given. The cutoffs are often different and some code is not transferable
Push Dominoes - Leetcode 838 - Python
17:39
NeetCode
Рет қаралды 22 М.
She wanted to set me up #shorts by Tsuriki Show
0:56
Tsuriki Show
Рет қаралды 8 МЛН
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 917 М.
MAXIMUM SUBARRAY | LEETCODE 53 | PYTHON OPTIMAL SOLUTION
11:51
Cracking FAANG
Рет қаралды 928
ADD ONE ROW TO TREE | LEETCODE 623 | PYTHON BFS SOLUTION
10:34
Cracking FAANG
Рет қаралды 1,9 М.
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 289 М.
REVERSE NODES IN K GROUP | LEETCODE 25 | PYTHON SOLUTION
18:01
Cracking FAANG
Рет қаралды 1,6 М.
Surrounded Regions - Graph - Leetcode 130 - Python
14:50
NeetCode
Рет қаралды 94 М.