you give array books booksi thicknessi heighti indicate thickness height ith book you give integer shelfwidthwe want place book order bookcase shelf total width shelfwidthwe choose book place shelf sum thickness equal shelfWidth build level shelf bookcase total height bookcase increase maximum height book we repeat process book placenote step process order book place order give sequence booksfor example order list 5 book place second book shelf book second shelf fourth fifth book shelfReturn minimum possible height total bookshelf place shelf manner Example 1input book 11232311111112 shelf_width 4Output 6explanationthe sum height 3 shelf 1 3 2 6notice book number 2 shelfexample 2input book 132432 shelfwidth 6output 4 Constraints1 bookslength 10001 thicknessi shelfwidth 10001 heighti 1000