Google Code Quality Check

Hey,
My google interview is coming up and I want some suggestions regarding my code quality.

Could you please give your reviews on the overall code quality and what I can improve.

Also, could you tell me if you guys follow some particular template(variable names, class strurctures, function names) for lets say graph questions.

Following are some sample codes, Question - https://leetcode.com/problems/path-with-minimum-effort/

class Solution {
public:
    int isValid(int x, int y, int row, int col) {
        if(x>=0 && x< row && y>=0 && y<col) {
            return 1;
        }
        return 0;
    }
    int minimumEffortPath(vector<vector<int>>& heights) {
        priority_queue<tuple<int,int, int>, vector<tuple<int,int, int>>, greater<tuple<int,int, int>>>pq;
        pq.push({0,0,0});
        int xdirection[]= {-1, 0,1,0};
        int ydirection[] = {0,1,0,-1};
        int row = heights.size();
        int col = heights[0].size(); 
        int maxDiff = INT_MIN;
        vector<vector<int>>cellCostTracker(row+2, vector<int>(col+2, INT_MAX));// cellCostTracker
        while(!pq.empty()) {
            auto[diff, x, y] = pq.top();
            pq.pop();
           
            if(cellCostTracker[x][y] < diff) {
                continue;
            }
            maxDiff = max(maxDiff, diff);
            if(x == row-1 && y== col-1) {
                return maxDiff;
            }
            int directions = 4;
            //exploring all directions
            for(int i=0;i<4;i++) {
                int nextX = x+xdirection[i];
                int nextY = y+ydirection[i];
                if(isValid(nextX, nextY, row, col)) {
                    int cost = abs(heights[nextX][nextY] - heights[x][y]);
                    if(cellCostTracker[nextX][nextY] > cost) {
                        pq.push({cost, nextX, nextY});
                        cellCostTracker[nextX][nextY] = cost;
                    }
                }
            }
        }
        return 0;
    }
};

Question - https://leetcode.com/problems/maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold/

class Solution {
public:
    int maxSideLength(vector<vector<int>>& mat, int threshold) {
        int n = mat.size();
        int m = mat[0].size();
        vector<vector<int>>sum(n+1, vector<int>(m+1, 0));
        for(int i=1;i<=n;i++) {
            for(int j=1;j<=m;j++) {
                sum[i][j] = sum[i][j-1] + sum[i-1][j] + mat[i-1][j-1] - sum[i-1][j-1];
            }
        }
        int ans = 0;
        int cnt = 0;
        for(int i=1;i<=n;i++) {
            for(int j=1;j<=m;j++) {
               if(i - cnt>=0 && j-cnt>=0) {
                   int temp  = sum[i][j] - sum[i][j-cnt] - sum[i-cnt][j] + sum[i-cnt][j-cnt];
                   if(temp <= threshold) {
                       cnt++;
                   }
               }
            }
        }
        
        return cnt-1;
    }
};




Comments (3)