Create Candy.java

This is a linear time solution, basic idea is scan from left to right once and then right to left once, to make sure that children at position i with higher rank gets more candy then both of its neighbors