[HINDI] Java - Easy to Understand (1 ms Runtime)
Hindi Explanation\nPlease UpVote if you like this HINDI Explanation Happy Coding !!\n\n\n\nclass Solution {\n\n    public int[][] matrixReshape(int[][] mat, int
**Hindi Explanation**\n*Please UpVote if you like this **HINDI** Explanation Happy Coding !!*\n\n\n```\nclass Solution {\n\n    public int[][] matrixReshape(int[][] mat, int r, int c) {\n        int m = mat.length;\n        int n = mat[0].length;\n\n        if (m * n != r * c) {\n            return mat; // Question mein ye rule diya hua hai 4th paragraph mein - "If the ...Otherwise, output the original matrix."\n        }\n\n        int[][] rc = new int[r][c];\n        int row = 0; // naya variable row ke liye\n        int column = 0; // naya variable column ke liye\n\n        //ek simple nested "for loop",  original matrix mein traverse karne ke liye\n        for (int i = 0; i < m; i++) {\n            for (int j = 0; j < n; j++) {\n                rc[row][column] = mat[i][j]; // value assign kardo\n\n                column++;\n                if (column == c) { //agar column variable row ke last column pe hai to "if" ke andar ghusjaega code\n                    row++; //row ko 1 se bada do taki next row ko traverse karsake hum\n                    column = 0; // column ko 0 set kardo taki nayi row ke 0 index se shuru ho naya traversal\n                }\n            }\n        }\n        return rc; // return kardo apna "rc" naam ka array\n    }\n}\n//badhai ho aapne successfully ye code karlia hai, Jai Mata Di...\n\n```\n
['Java']