【Leetcode_easy】944. Delete Columns to Make Sorted

problem

944. Delete Columns to Make Sorted

题意:其实题意很简单,但是题目的description给整糊涂啦。。。直接看题目标题即可理解。

solution:

class Solution {
public:
    int minDeletionSize(vector<string>& A) {
        int res = 0;
        for(int i=0; i<A[0].size(); i++)
        {
            for(int j=0; j<A.size()-1; j++)
            {
                if(A[j][i]>A[j+1][i]) 
                {
                    res++;
                    break;
                }
            }
        }
        return res;
    }
};

参考

1. Leetcode_easy_944. Delete Columns to Make Sorted;

2. discuss;

posted on 2019-07-26 19:47  鹅要长大  阅读(145)  评论(0编辑  收藏  举报

导航