Skip to content

Commit b8891e2

Browse files
committed
chore: add links to the trapped rain water problem
1 parent 5c4c54d commit b8891e2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dynamic_programming/trapped_rainwater.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* @file
3-
* @brief Implementation of the Trapped Rainwater Problem
3+
* @brief Implementation of the [Trapped Rainwater
4+
* Problem](https://www.geeksforgeeks.org/trapping-rain-water/)
45
* @details
56
* This implementation calculates the amount of rainwater that can be trapped
67
* between walls represented by an array of heights.
@@ -57,6 +58,9 @@ int trappedRainwater(const std::vector<int>& heights) {
5758
* @returns void
5859
*/
5960
static void test() {
61+
std::vector<int> heights0 = {0, 1};
62+
assert(dynamic_programming::trappedRainwater(heights0) == 0);
63+
6064
std::vector<int> heights1 = {0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1};
6165
assert(dynamic_programming::trappedRainwater(heights1) == 6);
6266

0 commit comments

Comments
 (0)