JAVASCRIPT  SOLUTION || Runtime : 424  ms || 3 solutions
Code\n```\n----------------------------------------------------------\n# SIMPLE SOLUTION\n\nvar rangeAddQueries = function (n, queries) {\n    let mat = Array(n
# Code\n```\n----------------------------------------------------------\n# **SIMPLE SOLUTION**\n\nvar rangeAddQueries = function (n, queries) {\n    let mat = Array(n).fill().map(() => Array(n).fill(0));\n    while (queries.length) {\n        let opr = queries.shift()\n        for (let row = opr[0]; row <= opr[2]; row++) {\n            let update = mat[row].slice(opr[1], opr[3] + 1).map(x => x + 1)\n            mat[row].splice(opr[1]  , update.length,...update)\n        }\n    }\n    return mat\n};\n--------\nfunction rangeAddQueries(n, queries) {\n    // Create a 2D matrix of size n x n filled with zeroes\n    let mat = Array(n).fill().map(() => Array(n).fill(0));\n\n    // Iterate through the query array\n    for (let [r1, c1, r2, c2] of queries) {\n        // Add 1 to every element in the specified submatrix\n        for (let row = r1; row <= r2; row++) {\n            for (let col = c1; col <= c2; col++) {\n                mat[row][col] += 1;\n            }\n        }\n    }\n\n    return mat;\n}\n---------------------------------------------\n# **OPTIMIZED SOLUTION** \nRuntime : 424  ms\n\nvar rangeAddQueries = function (n, queries) {\n    let mat = Array(n).fill().map(() => Array(n).fill(0));\n\n    for (let [r1, c1, r2, c2] of queries)\n        for (let row = r1; row < r2 + 1; row++) {\n            mat[row][c1] += 1\n            if (c2 < n - 1)\n                mat[row][c2 + 1] -= 1\n        }\n    for (let row = 0; row < n; row++)\n        for (let col = 1; col < n; col++)\n            mat[row][col] += mat[row][col - 1]\n\n\n    return mat\n};
['JavaScript']