Yesterday I was cleaning my house and I made a startling discovery. In the corner of the living room stood a nice decorated Christmas tree. The next Christmas is still too far away, thus I decided to remove all the decorations, put them into cardboard boxes and store them in the garage. However, the garage is almost full of other stuff. Therefore I'd like to arrange the boxes to form a tall stack, one atop another.
This may not be possible. Christmas tree decorations are fragile and the boxes that contain them aren't exactly made of steel. I weighed each of the boxes and for each of them I estimated the maximum weight that can be placed on the top of the box without it collapsing. In the following text we will use the term carrying capacity of a box when referring to this maximum weight.
You will be given this information in two String[]s: weight and canCarry.
Each element of weight will contain the weights of some of the boxes.
Similarly, each element of canCarry will contain the carrying capacities of some of the boxes.
The carrying capacities of the boxes will be given in the same order as their weights.
Your task is to find and return the largest N such that N of the boxes can be selected and placed one atop another in some order such that none of the boxes collapse.
