Longest Line of Consecutive One in Matrix (Leetcode 562)
第一种方法是直接做搜索,LC现在感觉大数据的testcase少了,所以繁琐一点也是能过的.对于每一个点,朝8个方向进行搜索(其实朝前向的四个方向就可以)同时将扫过的点记录下来,以便不往回找.classSolution{public:boolisValid(intx,inty,vector>&M,vector>&visited){if(x>=0&&x=0&&y>&M){if(M.empty()||M