摘要:
int projectionArea(vector>& grid) { int sum = 0; int row_max = 0; int col_max = 0; for (int i = 0; i < grid.size(); i++) { row_max = 0; for (int j = 0; j < grid[0... 阅读全文
摘要:
vector> transpose(vector>& A) { vector> V; int RowLen = A.size(); int ColLen = A[0].size(); for (int j = 0; j v; for (int i = 0; i < RowLen; i++) { v.... 阅读全文
摘要:
vector selfDividingNumbers(int left, int right) { vector V; for (int i = left; i = 1 && i <= 9) { V.push_back(i); continue; } bool tag = true; ... 阅读全文
摘要:
int peakIndexInMountainArray(vector& A) { int Len = A.size(); int position = -1; for (int i = 1; i A[i - 1] && A[i] > A[i + 1]) { position = i; break; ... 阅读全文
摘要:
vector> flipAndInvertImage(vector>& A) { vector> B; for (int i = 0; i Row = A[i]; vector Row2; for (int j = Row.size() - 1; j >= 0; j--) { int n = Row[j];... 阅读全文
摘要:
int uniqueMorseRepresentations(vector& words) { map st; st.insert(make_pair('a', ".-")); st.insert(make_pair('b', "-...")); st.insert(make_pair('c', "-.-.")); st.insert(make_pair(... 阅读全文
摘要:
vector sortArrayByParity(vector& A) { vector EVEN;//偶数 vector ODD;//奇数 for (auto a : A) { if (a % 2 == 0)//EVEN { EVEN.push_back(a); } else... 阅读全文
摘要:
string toLowerCase(string str) { transform(str.begin(), str.end(), str.begin(), ::tolower); return str; } 阅读全文
摘要:
int numJewelsInStones(string J, string S) { set st; int count = 0; for (auto c : J) { st.insert(c); } for (auto s : S) { if (st.find(s) != st.end()) ... 阅读全文
摘要:
本题目是使用递归处理,根据当前的值来判断剪去的子树,保留剩下的子树。 阅读全文