please anybody can explain how to approach this problem : CodeChef: Practical coding for everyone
You can solve this problem by binary searching on the answer , the range for binary search will be 1->max(weight i ) .
can you explain in detail why we will use binary search with example it would be very helpful for me
because i am stuck at this problem ?
Well see , by binary search we will check whether X is possible as answer or not , if X is possible then all Y>X will also be possible as answer , So Y can’t be the answer , So now we will look for another X and check that is this X possible as answer or not .
Link to the code you can refer
For example suppose you know that you know that answer can be 5 , then it is for sure answer can be 6 as well