三分梦_0bc3

关注

每日一题 leetcode 944. 删列造序 java

三分梦_0bc3

关注

阅读 70

2022-05-12

https://leetcode.cn/problems/delete-columns-to-make-sorted/

class Solution {
    public int minDeletionSize(String[] strs) {
        int m=strs.length;
        int n=strs[0].length();
        int count=0;
        for(int i=0;i<n;i++){
            char before='a';
            for(int j=0;j<m;j++){
                if(strs[j].charAt(i)>=before){
                    before=strs[j].charAt(i);
                }
                else{
                    count++;
                    break;
                }
            }
        }
        return count;
    }
}

相关推荐

玉新行者

Leetcode 944. 删列造序

玉新行者 69 0 0

把平平凡凡的生活过成诗与远方

【LeetCode】第47天 - 944. 删列造序

把平平凡凡的生活过成诗与远方 68 0 0

Silence潇湘夜雨

Java LeetCode每日一题

Silence潇湘夜雨 32 0 0

小亦同学321

leetcode 每日一题

小亦同学321 37 0 0

我是小小懒

leetcode每日一题(一)

我是小小懒 161 0 0

禾木瞎写

【LeetCode】944. Delete Columns to Make Sorted 解题报告(Python)

禾木瞎写 95 0 0

一天清晨

[leetcode每日一题]2.13

一天清晨 145 0 0

技术只适用于干活

[leetcode每日一题]1.2

技术只适用于干活 122 0 0

快乐小鱼儿_9911

Leetcode每日一题(2022.2.2)

快乐小鱼儿_9911 70 0 0

路西法阁下

[leetcode每日一题]2.15

路西法阁下 117 0 0

精彩评论(0)

0 0 举报