Ad
  • Default User Avatar

    Wow, this took some time. If you are having trouble understanding how it works, doing it manually on a piece of paper might help.
    A little tip from me - if you are doing this on JavaScript make sure when you are checking/incrementing/decrementing the cells they aren't undefined. That stupid mistake took me a lot of time to notice.