Here are my submission:
- Please define the "Items_Left" before the for loop (may be original number of items, during start the execute), as it used in the for loop counter also.
- The Items_Left will be only updated (-1), when the if condition true, otherwise it will remain same.
It would be easy to answer, if you could ask the question with representative problem (Quite simpler to get it than as actual scenario)