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​

ความคิดเห็น • 21

  • @choudhryaysha8816
    @choudhryaysha8816 หลายเดือนก่อน +7

    👦 :- Hopefully, it will work.. and it did.. now, let's try to submit it ❤😇🥰

  • @spandansahu
    @spandansahu หลายเดือนก่อน +6

    bhaiya...pls ek dp ka series chahiye....hope u will hear...!!

  • @mayankrathore7558
    @mayankrathore7558 หลายเดือนก่อน

    Keep doing good work!!

  • @RanjeetKumarceb
    @RanjeetKumarceb หลายเดือนก่อน +1

    Bhaiya, you deserve a million subscribers please wait your content is very good be continue

  • @ishan9604
    @ishan9604 หลายเดือนก่อน +1

    Thanks from the bottom of my heart ❤❤

  • @priyanshgarg1292
    @priyanshgarg1292 หลายเดือนก่อน

    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 !

  • @mrfred456123
    @mrfred456123 หลายเดือนก่อน

    This is a memoization solution, try adding tabulation solution as well.

  • @priyanshgarg1292
    @priyanshgarg1292 หลายเดือนก่อน +2

    means in case of using dp our tc becomes 2d dp size?

    • @shashwat_tiwari_st
      @shashwat_tiwari_st  หลายเดือนก่อน

      @@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..

    • @priyanshgarg1292
      @priyanshgarg1292 หลายเดือนก่อน

      @@shashwat_tiwari_st🙏

  • @RohitKumar-dz8dh
    @RohitKumar-dz8dh หลายเดือนก่อน

    Thanks 😊

  • @DSAbyraj1729
    @DSAbyraj1729 หลายเดือนก่อน

    nice explanation

  • @mayanktripathi9892
    @mayanktripathi9892 หลายเดือนก่อน

    great explanation

  • @shubhamtrivedi2155
    @shubhamtrivedi2155 หลายเดือนก่อน

    why we didn't take height as a perameter in this question at the time of creating the dp Array

  • @Mangesh_65
    @Mangesh_65 หลายเดือนก่อน +2

    Nahi samjh aaya sir

  • @arbabsahid2969
    @arbabsahid2969 หลายเดือนก่อน

    Bhaiya I am not able to figure out the code for tabulation. Can you please upload the same ??

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd หลายเดือนก่อน

    😍😍

  • @rohankumartiwary6900
    @rohankumartiwary6900 หลายเดือนก่อน

    Plz provide solutions link always

  • @shashwattiwari1502
    @shashwattiwari1502 หลายเดือนก่อน +1

    Bhaiya mera name bhi shashwta hai ❤