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."

10 comments:

  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
  2. Get free amazon gift card code generator amazon gift cards and start shopping at amazon.

    ReplyDelete
  3. This site provide us free codes of xbox live game so if you wanna free codes of xbox live game then you should visit on this site Thank you free xbox live gold code

    ReplyDelete
  4. amazon gift card now available in the market you can easily download amazon gift card codes generator online

    ReplyDelete
  5. i am latterly very poor in maths and coding but i am an expert in Android Development Services Islamabad so i am not good in maths may be but i am good in android app development.

    ReplyDelete
  6. The most common problem in playing game hay day is lack of coins and diamonds. But now no need to worry about this problem. Here we have a hay day coins and diamonds generator which generate genuine coins and all stuff without any cost. Try is once.

    ReplyDelete
  7. Hello admin,
    this is Ayesha Saleem. I have examine your blog and this post especially. You title is really attractive, Calculating Walter :P . weeks of pregnancy Well, about one and half month ago, i had an uncovered romance with my husband. Now i think i am pregnant and i was searching for the weeks of pregnancy so that i can verify my pregnancy.

    ReplyDelete
  8. Hi admin,
    I am really shocked that how can you measure the amount of water in the rivers and sea. what is mesothelioma Well, i was searching for what is mesothelioma. so i can learn and guide it to someone.

    ReplyDelete
  9. Hi how are you?
    I read your post about how to calculate the water in larger medium, i am not really good at mathematics and you shared a good content. What about also providing information cat wallpaper i hope you'll think about this.

    ReplyDelete