Time complexity: O(n)
Space complexity: O(1)
Runtime: 0 ms, faster than 100.00% of Java online submissions for Kids With the Greatest Number of Candies.
Memory Usage: 42.3 MB, less than 48.45% of Java online submissions for Kids With the Greatest Number of Candies.