728x90

리스트 22

[leetCode] 1832. Check if the Sentence Is Pangram (Python)

▼ 문제 바로가기 (링크) ▼ https://leetcode.com/problems/check-if-the-sentence-is-pangram/ Check if the Sentence Is Pangram - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com * 팬그램은 주어진 모든 문자를 적어도 한 번 이상 사용하여 만든 문장이며 로렘 입숨처럼 글꼴 샘플을 보여주거나 장비를 테스트하는 데 사용된다. - 위키백과 - return true if sentence is a..

[leetCode] 771. Jewels and Stones (Python)

▼ 문제 바로가기 (링크) ▼ https://leetcode.com/problems/jewels-and-stone/ Jewels and Stones - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문자열 jewels과 stones이 주어진다. jewels의 각 문자는(char) 보석 종류를 나타내고 stones의 문자는 내가 가진 돌을 나타낸다. stones중 보석이 몇 개인지 구하고 반환하는 문제. class Solution: def numJewelsInSt..

[leetCode] 2160. Minimum Sum of Four Digit Number After Splitting Digits (Python)

▼ 문제 바로가기 (링크) ▼ https://leetcode.com/problems/minimum-sum-of-four-digit-number-after-splitting-digits/ Minimum Sum of Four Digit Number After Splitting Digits - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 4자리 양의 정수를 담은 변수 num이 주어진다. 2개의 수로 만들어 더했을 때의 최소값을 찾고 그 값을 반환하는 문제. clas..

[leetCode] 1470. Shuffle the Array (Python)

▼ 문제 바로가기 (링크) ▼ https://leetcode.com/problems/shuffle-the-array/ Shuffle the Array - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com [x₁, x₂,..., y₁, y₂,...] 형태의 2n개의 요소로 구성된 배열이 주어진다. [x₁, y₁, x₂,, y₂,.. 형식으로 반환하는 문제. *아래 첨자는 인덱스 번호를 의미한다. 예를 들어 [1,2,3,4,5,6]라는 배열이 있다면 [1,4,2,5,3..

[leetCode] 1929. Concatenation of Array (Python)

▼ 문제 바로가기 (링크) ▼ https://leetcode.com/problems/concatenation-of-array/ Concatenation of Array - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 정수 배열 nums가 주어진다. nums의 원소를 한 번 더 반복해서 가지는, 새로운 배열 ans를 반환하는 문제. # for문과 append() class Solution: def getConcatenation(self, nums: List[in..

[leetCode] 1480. Running Sum of 1d Array (Python)

▼ 문제 바로가기 (링크) ▼ https://leetcode.com/problems/running-sum-of-1d-array/ Running Sum of 1d Array - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com nums 라는 배열이 주어지면 0번째 인덱스만 그대로 두고 나머지는 이전 요소의 값을 모두 더해서 새로운 리스트로 반환하는 문제. * 1d array : 1차원 배열 (One Dimentional- Array) class Solution: de..

[leetCode] 989. Add to Array-Form of Integer (Python)

▼ 문제 바로가기 (링크) ▼ https://leetcode.com/problems/add-to-array-form-of-integer/ Add to Array-Form of Integer - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 배열 형식의 정수는 왼쪽에서 오른쪽 순서로 숫자를 나타낸다. 예를 들면 정수 1321는 array form으로 [1,3,2,1] 이다. 주어진 배열 형식의 숫자와 정수 k를 더한 후, 그 값을 다시 배열 형식으로 return ..

[leetCode] 1672. Richest Customer Wealth (Python)

▼ 문제 바로가기 (링크) ▼ https://leetcode.com/problems/richest-customer-wealth/ Richest Customer Wealth - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 정수로 이루어진 m x n 의 그리드 행렬이 주어진다. [i][j] 은 i번째 손님이 j은행에 가지고 있는 재산의 양이다. 가장 부유한 손님의 재산을 return하라. 손님의 재산은 모든 은행의 자산을 합친 값이다. 문제만 읽었을 때는 바로 와..

[부스트코스] 모두를 위한 파이썬 (PY4E) 6주 차_정리 (7/8)

▼ 강의 보러 가기 ▼ www.boostcourse.org/cs122 마지막 6주차 학습 범위는 9,10단원! [ 이번 주는 무엇을 배웠나요? PY4E 요약 정리! ] 9. 딕셔너리 1) 콜렉션 : 리스트와 딕셔너리 리스트는 순서대로 정렬된 콜렉션으로 데이터를 추가하면 리스트의 끝에 추가된다. 또한 0부터 n-1번 위치까지 순서대로 n개의 원소가 저장되어있다. 딕셔너리도 리스트 처럼 여러개의 값을 가지는 콜렉션이지만 순서가 없다. (*파이썬 3.6 부터는 순서를 기억한다. 그 이전 버전에서는 orderdict를 사용해야한다.) 2) 빈 딕셔너리 생성 리스트를 변수명 = [] 또는 변수명 = list() 로 생성할 수 있었던 것 처럼 딕셔너리도 변수명 = { } 또는 변수명 = dict() 로 생성할 수 ..

[부스트코스] 모두를 위한 파이썬 (PY4E) 5주 차_정리 (6/8)

▼ 강의 보러 가기 ▼ www.boostcourse.org/cs122 5주차 학습 범위는 8단원! [ 이번 주는 무엇을 배웠나요? PY4E 요약 정리! ] 8. 리스트 1) 콜렉션 리스트는 콜렉션의 일종이다. 변수는 새로운 값을 할당하면 그 값으로 대체되는데, 이와 다르게 콜렉션은 하나의 변수에 여러개의 값을 가질 수 있다. 2) 리스트 리스트 이름 = [ a,b,c,[d,e] ] 리스트 이름2 = list() 항목은 ,(콤마)로 구분되며, 각 항목에 인덱스 값으로 접근할 수 있다. 리스트 안에 또 다른 리스트를 가질 수 있다. 빈 리스트를 만들 수 있다. ( 이름에 list() 함수를 넣는다) 리스트의 항목은 변경 가능하다. (추가, 삭제 등) 3) len() 리스트를 len() 함수로 감싸면 항목의 ..

728x90