Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am dimonb on github.
  • I am dimonb (https://keybase.io/dimonb) on keybase.
  • I have a public key ASA5iOzJrmx8JTZkTDAbONB_tV-gmeqKJTYGZqQ09lqpYAo

To claim this, I am signing this object:

auto l = height.begin(), r = height.end() - 1;
int level = 0, water = 0;
while (l != r + 1) {
int lower = *l < *r ? *l++ : *r--;
level = max(level, lower);
water += level - lower;
}
auto l = height.begin(), r = height.end() - 1;
int level = 0, water = 0;
while (l != r + 1) {
int lower = *l < *r ? *l++ : *r--;
level = max(level, lower);
water += level - lower;
}
auto l = height.begin(), r = height.end() - 1;
int level = 0, water = 0;
while (l != r + 1) {
int lower = *l < *r ? *l++ : *r--;
level = max(level, lower);
water += level - lower;
}