Leetcode Note: Go - Delete Column to Make Sorted
Delete Columns to Make Sorted - LeetCode
https://leetcode.com/problems/delete-columns-to-make-sorted/
- Go 言語で取り組んだメモ
回答
Golang solution with quick explanation - LeetCode Discuss
https://leetcode.com/problems/delete-columns-to-make-sorted/discuss/1249501/Golang-solution-with-quick-explanation
func minDeletionSize(strs []string) int {
res := 0
for i := 0; i < len(strs[0]); i++ {
for j := 1; j < len(strs); j++ {
if strs[j][i] < strs[j-1][i] {
res++
break
}
}
}
return res
}