Javascript Easy Solution
\n/**\n * @param {number[][]} matrix\n * @return {number}\n */\nvar countSquares = function(matrix) {\n  let count = 0;\n  for (let i = 0; i < matrix.length; ++
```\n/**\n * @param {number[][]} matrix\n * @return {number}\n */\nvar countSquares = function(matrix) {\n  let count = 0;\n  for (let i = 0; i < matrix.length; ++i) {\n    for (let j = 0; j < matrix[0].length; ++j) {\n      if (matrix[i][j] === 0) continue;\n      if (i > 0 && j > 0) {\n        matrix[i][j] += Math.min(matrix[i - 1][j], matrix[i][j - 1], matrix[i - 1][j - 1]);\n      }\n      count += matrix[i][j];\n    }\n  }\n  return count; \n};\n```
['Dynamic Programming', 'JavaScript']