Tuesday, January 3, 2012

Trapping rain Water

Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.

http://www.programcreek.com/2014/06/leetcode-trapping-rain-water-java/
http://www.geeksforgeeks.org/trapping-rain-water/

Candy Problem

There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements:


1. Each child must have at least one candy.
2. Children with a higher rating get more candies than their neighbors.

What is the minimum candies you must give?
http://www.programcreek.com/2014/03/leetcode-candy-java/

No comments:

Post a Comment