I was trying to solve the this problem. I was trying to find the maximum numbers of column from the given matrix. And for that I am doing something like this if(m < nums[i].size()) But looks like the comparison does not happen at all,. I am having hard time understand the issue behin this.
Also when I try something like m = max(m, nums[i].size()), it throws me some compilation error.
Please look at the following code to get better context.
https://leetcode.com/contest/weekly-contest-186/problems/diagonal-traverse-ii/
vector<int> findDiagonalOrder(vector<vector<int>>& nums) {
vector<int> res;
int x , y, n = nums.size();
int m = -1;
for(int i = 0; i < n; i++) {
// m = max(m, nums[i].size());
if( nums[i].size() > m ) {
m = nums[i].size();
}
Any help would be appreciated. thanks