Delete Columns to Make Sorted II || JAVASCRIPT || Solution by Bharadwaj
Approach\nGreedy\n\n# Complexity\n- Time complexity:\nO(n * m)\n\n- Space complexity:\nO(n)\n\n# Code\n\nvar minDeletionSize = function(strs) {\n   let n = strs
# Approach\nGreedy\n\n# Complexity\n- Time complexity:\nO(n * m)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nvar minDeletionSize = function(strs) {\n   let n = strs[0].length;\n   let ans = 0;\n   let sorted = new Array(strs.length - 1).fill(false);\n\n   for(let j = 0; j < n; ++j){\n       let i;\n       for(i = 0; i + 1 < strs.length; ++i){\n        if(!sorted[i] && strs[i].charAt(j) > strs[i + 1].charAt(j)){\n               ++ans;\n               break;\n           }\n       }\nif(i + 1 === strs.length){\nfor(i = 0; i + 1 < strs.length; ++i){\nsorted[i] = sorted[i] || strs[i].charAt(j) < strs[i + 1].charAt(j);\n           }\n       }\n   } \n   return ans;\n};\n```
['JavaScript']