Testcases are not passing

@tharun,
*.size() returns unsigned int, which can produce unwanted results in arithmetic operations(specially ones involving subtraction). So make a habit of explicitly converting *.size() into (int) before using it.