マツシタのお勉強

DFS

Connected Cell in a Grid in Hacker Rank

問題 R行C列の行列が与えれれる。行列の各マスは0か1のどちらかが書かれている。1の島の大きさ(マスの数)が最大を出力する問題。 ここで島の定義は、水平方向、垂直方向、斜め方向で1が隣同士ならばそれらは1つの島とすることができる。 www.hackerrank.com…

298. Binary Tree Longest Consecutive Sequence : Past Google Coding Interview

Problem https://leetcode.com/problems/binary-tree-longest-consecutive-sequence/ How to Solve This problem is classified into Tree and can be solve by using DFS(Depth First Search). Depth First Search Firstly, I thought the only search by D…