Simple O(n^2) C++ code


#1

vector<vector > Solution::diagonal(vector<vector > &A) {
_ vector<vector > answer((A.size() * 2) - 1);_
_ for (int i = 0; i < A.size(); i++) {_
_ for (int j = 0; j < A[i].size() ; j++) {_
_ answer[i + j].push_back(A[i][j]);_
_ }_
_ }_
_ return answer;_
}