1105. Filling Bookcase Shelves | DP | Leetcode Daily Challenge | DSA | Hindi
ฝัง
- เผยแพร่เมื่อ 18 ก.ย. 2024
- Problem Name:
1105. Filling Bookcase Shelves
Problem Statement:
You are given an array books where books[i] = [thicknessi, heighti] indicates the thickness and height of the ith book. You are also given an integer shelfWidth.
We want to place these books in order onto bookcase shelves that have a total width shelfWidth.
We choose some of the books to place on this shelf such that the sum of their thickness is less than or equal to shelfWidth, then build another level of the shelf of the bookcase so that the total height of the bookcase has increased by the maximum height of the books we just put down. We repeat this process until there are no more books to place.
Note that at each step of the above process, the order of the books we place is the same order as the given sequence of books.
For example, if we have an ordered list of 5 books, we might place the first and second book onto the first shelf, the third book on the second shelf, and the fourth and fifth book on the last shelf.
Return the minimum possible height that the total bookshelf can be after placing shelves in this manner.
Problem Link:
leetcode.com/p...
Graph Playlist:
• Graph Data Structure S...
Java Plus DSA Placement Course Playlist:
• Java and DSA Course Pl...
Java Plus DSA Sheet:
docs.google.co...
Notes:
github.com/Tiw...
Telegram Link:
shashwattiwari...
Ultimate Recursion Series Playlist:
• Recursion and Backtrac...
Instagram Handle: (@shashwat_tiwari_st)
shashwattiwari...
Samsung Interview Experience:
• I cracked Samsung | SR...
Company Tags:
Facebook | Amazon | Microsoft | Netflix | Google | LinkedIn | Pega Systems | VMware | Adobe | Samsung
Timestamp:
0:00 - Introduction
#ShashwatTiwari #coding #problemsolving
👦 :- Hopefully, it will work.. and it did.. now, let's try to submit it ❤😇🥰
Masterpiece line❤
bhaiya...pls ek dp ka series chahiye....hope u will hear...!!
Keep doing good work!!
Bhaiya, you deserve a million subscribers please wait your content is very good be continue
Thanks from the bottom of my heart ❤❤
your way of telling the intuition to think problem solution helps a lot ..like here you told whenever we have to do multiple task on same element it might be related to dp ...tnks sir !
This is a memoization solution, try adding tabulation solution as well.
means in case of using dp our tc becomes 2d dp size?
@@priyanshgarg1292 yes, in dp we generally store all the states that our program is going to visit. So if it is 1D array O(N), 2d array then N*M, and so on..
@@shashwat_tiwari_st🙏
Thanks 😊
nice explanation
great explanation
why we didn't take height as a perameter in this question at the time of creating the dp Array
Nahi samjh aaya sir
Bhaiya I am not able to figure out the code for tabulation. Can you please upload the same ??
😍😍
Plz provide solutions link always
Bhaiya mera name bhi shashwta hai ❤