| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- 매일
- 미드시청
- 영어원서읽기
- leetcode
- 잡생각
- 링피트
- 만화도
- realclass
- 스탭퍼
- 운동
- 영어공부
- 화상영어
- 10분
- Problem Solving
- Daily Challenge
- 개발자
- 파비최
- 프로젝트
- 사이드
- 3줄정리
- 월간
- English
- Writing
- 읽기
- 리얼 클래스
- 쓰릴오브파이트
- 괜찮음
- FIT XR
- 30분
- 뭐든
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/delete-columns-to-make-sorted/
Delete Columns to Make Sorted - LeetCode
Delete Columns to Make Sorted - You are given an array of n strings strs, all of the same length. The strings can be arranged such that there is one on each line, making a grid. For example, strs = ["abc", "bce", "cae"] can be arranged as: abc bce cae You
leetcode.com
처음에 문제를 잘 이해 못해서 살짝 헤맴.
가로로 검증을 해야되는게 아니라 세로로 검증을 하는거였음.
class Solution:
def minDeletionSize(self, strs: List[str]) -> int:
res = 0
for i in range(len(strs[0])):
s = []
for j in range(len(strs)):
s.append(strs[j][i])
if s == sorted(s):
continue
res += 1
return res반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
| Today's Challenge (0) | 2023.01.05 |
|---|---|
| Today's Challenge (0) | 2023.01.04 |
| Today's Challenge (0) | 2023.01.02 |
| Today's Challenge (0) | 2023.01.01 |
| Today's Challenge (0) | 2022.12.31 |
Comments