leetcode 每日一题 944. 删列造序

leetcode 每日一题 944. 删列造序

class Solution {
  public int minDeletionSize(String[] strs) {
      int num = 0;
      for (int j = 0; j < strs[0].length(); j++) {
          char buf = strs[0].charAt(j);
          for (int i = 1; i < strs.length; i++) {
              char c = strs[i].charAt(j);
              if(buf > c){
                  num++;
                  break;
              }
              buf = c;
          }
      }
      return num;
  }
}

 

 

posted @ 2022-05-12 10:29  java架构师1  阅读(20)  评论(0)    收藏  举报