摘要:
// 56ms 1 class Solution { 2 public: 3 4 void DFS(vector<vector<char>> &v,int i,int j) 5 { 6 if(v[i][j]=='O') 7 { 8 v[i][j]='Q'; 9 if(i>0)10 DFS(v,i-1,j);11 if(i<v.size()-1)12 DFS(v,i+1,j);13 ... 阅读全文
摘要:
1 /** 2 * Definition for an interval. 3 * struct Interval { 4 * int start; 5 * int end; 6 * Interval() : start(0), end(0) {} 7 * Interval(int s, int e) : start(s), end(e) {} 8 * }; 9 */10 class Solution;11 bool incmp(struct Interval a,struct Interval b)12 {13 ... 阅读全文
摘要:
//风格比较差,用时较长:712ms 1 /** 2 * Definition for an interval. 3 * struct Interval { 4 * int start; 5 * int end; 6 * Interval() : start(0), end(0) {} 7 * Interval(int s, int e) : start(s), end(e) {} 8 * }; 9 */10 class Solution;11 bool incmp(struct Interval a,struct Interval b)... 阅读全文
摘要:
//这个方案目前超时,需要其他方法 1 char vf[100][100]; 2 3 class Solution { 4 public: 5 6 7 bool DFS(vector<vector<char> > &v,int i,int j,const char *p) 8 { 9 bool r; 10 11 12 if(v[i][j]!=p[0]) 13 return false; 14 if((v[i][j]==p[0])&&(p[1]... 阅读全文