July 6, 2016
Work on Leetcode 130: surrounded region
Leetcode 130 surrounded region
Study the solution discussiones - very detail discussion, comparison DFS/timeout/stack issues, and then BFS solution, ideas to approach the problem.
1. code study 1: C#
http://www.cnblogs.com/higerzhang/p/4149040.html
Julia's C# practice:
Will post here very soon!
2. Code study 2: C++
C++ code: read C++ code
http://neuzxy.github.io/2016/03/14/leetcode-130.html
Things learned in the code:
1. The description of ideas to solve the problem:
start from all four edges outside most, from each node '0', work on BFS, mark '+' for those node with '0',
and then, set those not '+', but '0' - whereas those are not accessible, surrounded by 'X' - set as 'X'.
2. learn typedef pair<int, int> state_t;
C++ solution
https://ask.julyedu.com/question/164
3. Read every blog from the author: The code is with good quality and some excellent sharing:
http://xiaoyaoworm.com/blog/
To be continued!
No comments:
Post a Comment