in LeetCode Store n item sell each item price however special offer special offer consist different kind item sale priceyou give integer array price pricei price ith item integer array need needsi number piece ith item want buyyou give array special speciali size n 1 specialij number piece jth item ith offer specialin ie integer array price ith offerReturn low price pay exactly certain item give optimal use special offer you allow buy item want low overall price you use special offer time want example 1input price 25 special 3051210 need 32output 14explanation there kind item a b their price 2 5 respectively in special offer 1 pay 5 3A 0bin special offer 2 pay 10 1a 2b you need buy 3A 2B pay 10 1A 2B special offer 2 4 2aexample 2input price 234 special 11042219 need 121output 11explanation the price a 2 3 b 4 c you pay 4 1A 1B 9 2a 2b 1C you need buy 1A 2B 1C pay 4 1A 1B special offer 1 3 1b 4 1c you add item 9 2a 2b 1C Constraintsn pricelength needslength1 n 60 pricei needsi 101 speciallength 100specialilength n 10 specialij 50