From 42995ca242694534c2127ef56f796c147d8ee956 Mon Sep 17 00:00:00 2001 From: chayan das <110921638+Chayandas07@users.noreply.github.com> Date: Wed, 31 Jul 2024 16:28:02 +0530 Subject: [PATCH] Create 1105. Filling Bookcase Shelves --- 1105. Filling Bookcase Shelves | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 1105. Filling Bookcase Shelves diff --git a/1105. Filling Bookcase Shelves b/1105. Filling Bookcase Shelves new file mode 100644 index 0000000..8f616f1 --- /dev/null +++ b/1105. Filling Bookcase Shelves @@ -0,0 +1,40 @@ +class Solution { +public: + int n,w; + vector> a; + vector dp; + int ans=INT_MAX; + int f(int i) + { + if (i>=n) + return 0; + if(dp[i]!=INT_MAX) + return dp[i]; + // int a=INT_MAX; + int cw=0,ch=0; + for(int j=i;j>& books, int w) { + + + this->n=books.size(); + this->a=books; + this->w=w; + dp.resize(n,INT_MAX); + return f(0); + + } +};