Leetcode 2742 Painting the Walls

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

Jeevan Kumar

Jeevan Kumar

Күн бұрын

Пікірлер: 8
@kshitijgarg2609
@kshitijgarg2609 Жыл бұрын
nice explanatory video
@JeevanKumar-code
@JeevanKumar-code Жыл бұрын
Thank you
@BaburaoSanivada
@BaburaoSanivada Жыл бұрын
Vey Well Explained
@JeevanKumar-code
@JeevanKumar-code Жыл бұрын
Thank you!!
@JeevanKumar-code
@JeevanKumar-code Жыл бұрын
Similar Problems: leetcode.com/problems/partition-equal-subset-sum/ leetcode.com/problems/target-sum/ leetcode.com/problems/coin-change/
@JeevanKumar-code
@JeevanKumar-code Жыл бұрын
Telegram Community Links: t.me/+FieKB7Ds6j02Y2Y1 t.me/+JU-ZF-oDjX4xYjBl
@tasneemayham974
@tasneemayham974 Жыл бұрын
Sir, I thought about this problem like this: If I add up the totalTime and start with that: f(n,totalTime, T). If I went for not_take, totalTime will decrease by one and if I went for take, totalTime will increase by time[i]. If totalTime is greater than the start(T) then return 0 else return 1e9. Hence the dp will be [n+1][2*totalTime+1]. But it gives Memory Limit Exceeded. If I use your way which is [n][n+1], it will work. Mr. how should I know this is the correct way to solve starting from recursion? Thank you for your amazing videos bhaiya!!!
@dayashankarlakhotia4943
@dayashankarlakhotia4943 Жыл бұрын
public int paintWalls ( int []cost,int[]time){ int k=500000000; int n=cost.length; int []dp=new int [n+1]; Arrays.fill (dp,k); dp[0]=0; for(int i=0;i0;--walls) dp[walls]=Math.min (dp[walls],dp[Math.max (walls-time[i]-1,0)]+cost [i]; return dp[n]; }😢🎉😂❤
Leetcode 2050 Parallel Courses III
14:21
Jeevan Kumar
Рет қаралды 824
Leetcode 1203 Sort Items by Groups Respecting Dependencies
23:23
Jeevan Kumar
Рет қаралды 3,6 М.
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 16 МЛН
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 31 МЛН
Farmer narrowly escapes tiger attack
00:20
CTV News
Рет қаралды 11 МЛН
When Cucumbers Meet PVC Pipe The Results Are Wild! 🤭
00:44
Crafty Buddy
Рет қаралды 60 МЛН
Painting the Walls - Leetcode 2742 - Python
14:29
NeetCodeIO
Рет қаралды 14 М.
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
⚡️NEWS | RUBLE COLLAPSE | STRIKE ON CRIMEA | PUTIN IN KAZAKHSTAN
10:34
Ходорковский LIVE
Рет қаралды 190 М.
5 Simple Steps for Solving Any Recursive Problem
21:03
Reducible
Рет қаралды 1,2 МЛН
Leetcode 1531 String Compression II
19:01
Jeevan Kumar
Рет қаралды 1,4 М.
How I Failed the Google Coding Interview (and lessons I learned)
14:24
LeetCode 2009 Minimum Number of Operations to Make Array Continuous
14:12
Constrained Subsequence Sum - Leetcode 1425 - Python
20:52
NeetCodeIO
Рет қаралды 8 М.
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 16 МЛН