Wednesday, April 23, 2014

Calculating Water

I came across this interesting programming challenge and couldn't help but dig in and solve it for myself. The solution below is a re-write of the approach I found in this book. My first (less efficient) solution involved a breadth first traversal of a histogram "graph" storing visited & filled cells in a HashSet. 

The follow up question to this is even more interesting:
"Solve this problem with an algorithm that accesses A's elements in order and can read an element only once. Use minimal additional space."

1 comment:

  1. I'm sorry, although website link developing continues to be going to function as SEARCH ENGINE OPTIMIZATION trump credit card with the foreseeable future. My spouse and i might not store your own air intended for google search algorithms 200-101 to set fewer significance with website link acceptance before the Semantic Web comes, or it could be when HTTP receives replaced by way of a fresh method.

    ReplyDelete