일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 프로그래밍
- 카카오
- 코테연습
- C++
- 고득점Kit
- dp
- Level3
- Level2
- 파이썬
- 백준
- CS
- 자바스크립트
- react
- web
- javascript
- Level1
- sql
- 동적계획법
- 웹프로그래밍
- python
- OS
- Medium
- Doitvue.js입문
- typescript
- 프로그래머스
- 리액트
- LeetCode
- 배열
- 리트코드
- VUE
- Today
- Total
목록코테 문제 풀이 (216)
큰 수 만들기 문제 설명 어떤 숫자에서 k개의 수를 제거했을 때 얻을 수 있는 가장 큰 숫자를 구하려 합니다. 예를 들어, 숫자 1924에서 수 두 개를 제거하면 [19, 12, 14, 92, 94, 24] 를 만들 수 있습니다. 이 중 가장 큰 숫자는 94 입니다. 문자열 형식으로 숫자 number와 제거할 수의 개수 k가 solution 함수의 매개변수로 주어집니다. number에서 k 개의 수를 제거했을 때 만들 수 있는 수 중 가장 큰 숫자를 문자열 형태로 return 하도록 solution 함수를 완성하세요. 제한 조건 number는 2자리 이상, 1,000,000자리 이하인 숫자입니다. k는 1 이상 number의 자릿수 미만인 자연수입니다. 풀이 stack을 이용한다. 문자열을 앞에서부터 담..
1578. Minimum Time to Make Rope Colorful 문제 설명 Alice wants the rope to be colorful. She does not want two consecutive balloons to be of the same color, so she asks Bob for help. Bob can remove some balloons from the rope to make it colorful. You are given a 0-indexed integer array neededTime where neededTime[i] is the time (in seconds) that Bob needs to remove the ith balloon from the rope. Retu..
1710. Maximum Units on a Truck 문제 설명 You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]: numberOfBoxesi is the number of boxes of type i. numberOfUnitsPerBoxi is the number of units in each box of the type i. You are also given an integer truckSize, which is the maximum number of boxes that ca..
76. Minimum Window Substring Problem Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring**, return the empty string "". t를 만족하는 s의 최소 부분 문자열 찾기 Constraints: m == s.length n == t.length 1 0 : target_len -= 1 target_cnt[s[end]] -= 1 while ta..
209. Minimum Size Subarray Sum 문제 Given an array of positive integers nums and a positive integer target, return the minimal length of a contiguous subarray [numsl, numsl+1, ..., numsr-1, numsr] of which the sum is greater than or equal to target. If there is no such subarray, return 0 instead. 제한사항 1
724. Find Pivot Index 오른쪽 숫자들의 합과 왼쪽 숫자들의 합이 같아지는 피벗의 위치 찾기 [1, 8, 2, 9, 2, 3, 6] : 9 [2, 5, 7] : -1 (가능한 피벗이 없음) Brute-force? o(n) * n -> o (n ^ 2) 비효율적임 sliding 전체 합계를 구해준다. 피벗을 0부터 한 칸씩 움직이면서 right sum에는 빼고 left sum에는 이전 피벗 값을 더해준다. right sum과 left sum이 같아지는 지점을 찾는다. [1, 8, 2, 9, 2, 3, 6] 0 | sum() - 1 1 + 0 | sum() - 1 - 8 8 + 1 + 0 | sum() - 1 - 8 - 2 . . . 전체 합계를 구하는데 O(n) 매번 오퍼레이션이 O(1)..
283. Move Zeroes in place(나머지 숫자의 순서를 바꾸지 않고) 로 0을 오른쪽으로 옮기기 [0, 5, 0, 7, 6, 3] 0을 무조건 오른쪽으로 옮긴다면? 나머지 숫자를 한 칸씩 앞으로 옮겨야하므로 오퍼레이션이 복잡해짐 0을 버블 스왑한다면 ? O(n * 0의 개수)로 시간 복잡도가 너무 커짐 basic Idea 0을 찾아서 옮긴다면 나머지 숫자들의 순서가 바뀌지 않아야 하므로 버블 스왑 할 수 밖에 없음 그렇다면 0이 아닌 숫자를 찾아서 왼쪽으로 옮긴다면? 숫자만 옮기면 되니까 순서가 바뀔 일이 없음 [0,0,0,0,5,9,3] [5,0,0,0,0,9,3] [5,9,0,0,0,0,3] [5,9,3,0,0,0,0] 투포인터를 사용한다. start : 0을 가리킴 end : 0이 아닌..
구명보트 문제 설명 무인도에 갇힌 사람들을 구명보트를 이용하여 구출하려고 합니다. 구명보트는 작아서 한 번에 최대 2명씩 밖에 탈 수 없고, 무게 제한도 있습니다. 구명보트를 최대한 적게 사용하여 모든 사람을 구출하려고 합니다. 사람들의 몸무게를 담은 배열 people과 구명보트의 무게 제한 limit가 매개변수로 주어질 때, 모든 사람을 구출하기 위해 필요한 구명보트 개수의 최솟값을 return 하도록 solution 함수를 작성해주세요. 제한사항 무인도에 갇힌 사람은 1명 이상 50,000명 이하입니다. 각 사람의 몸무게는 40kg 이상 240kg 이하입니다. 구명보트의 무게 제한은 40kg 이상 240kg 이하입니다. 구명보트의 무게 제한은 항상 사람들의 몸무게 중 최댓값보다 크게 주어지므로 사람들..