Dev 41

[코테] 99클럽 코테 스터디 40일차 TIL - 그리디

Question1 - [미들러] 문자열의 최적 구분 (Optimal Partition of String) Given a string s, partition the string into one or more substrings such that the characters in each substring are unique. That is, no letter appears in a single substring more than once.Return the minimum number of substrings in such a partition.Note that each character should belong to exactly one substring in a partition. Example 1:Inp..

Dev 2024.06.29

[코테] 99클럽 코테 스터디 39일차 TIL - 힙

Question1 - [미들러] 열 크기를 반으로 줄이기 (Reduce Array Size to The Half) You are given an integer array arr. You can choose a set of integers and remove all the occurrences of these integers in the array.Return the minimum size of the set so that at least half of the integers of the array are removed. Example 1:Input: arr = [3,3,3,3,5,5,5,2,2,7]Output: 2Explanation: Choosing {3,7} will make the new array..

Dev 2024.06.28

[코테] 99클럽 코테 스터디 37일차 TIL - 스택/큐

Question1 - [미들러] 최소 추가로 유효한 괄호 만들기 (Minimum Add to Make Parentheses Valid) 문제 설명 https://leetcode.com/problems/minimum-add-to-make-parentheses-valid/description/ A parentheses string is valid if and only if:It is the empty string,It can be written as AB (A concatenated with B), where A and B are valid strings, orIt can be written as (A), where A is a valid string.You are given a parentheses str..

Dev 2024.06.26

[코테] 99클럽 코테 스터디 32일차 TIL - 정렬

Question1 - [미들러] Top K 최빈값 찾기 (Top K Frequent Elements) 문제 설명 https://leetcode.com/problems/top-k-frequent-elements/description/ Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order. Example 1:Input: nums = [1,1,1,2,2,3], k = 2Output: [1,2]Example 2:Input: nums = [1], k = 1Output: [1] Constraints:1 -104 k is in the range [1, t..

Dev 2024.06.20

[코테] 99클럽 코테 스터디 30일차 TIL - 문자열

Question1 - [미들러] 최소한의 플립 (Minimum Suffix Flips) 문제 설명 https://leetcode.com/problems/minimum-suffix-flips/description/ You are given a 0-indexed binary string target of length n. You have another binary string s of length n that is initially set to all zeros. You want to make s equal to target.In one operation, you can pick an index i where 0  Return the minimum number of operations needed to ma..

Dev 2024.06.19

[코테] 99클럽 코테 스터디 28일차 TIL - 배열

Question1 - [미들러] 사람들을 주어진 사이즈대로 그룹화하기 (Group the People Given the Group Size They Belong To) 문제 설명 https://leetcode.com/problems/group-the-people-given-the-group-size-they-belong-to/description/ There are n people that are split into some unknown number of groups. Each person is labeled with a unique ID from 0 to n - 1.You are given an integer array groupSizes, where groupSizes[i] is the size o..

Dev 2024.06.17

[코테] 99클럽 코테 스터디 26일차 TIL - 배열

Question1 - [미들러] 하위사각형 쿼리  문제 설명 https://leetcode.com/problems/subrectangle-queries/description/ Implement the class SubrectangleQueries which receives a rows x cols rectangle as a matrix of integers in the constructor and supports two methods: 1. updateSubrectangle(int row1, int col1, int row2, int col2, int newValue) Updates all values with newValue in the subrectangle whose upper left coordi..

Dev 2024.06.15

[코테] 99클럽 코테 스터디 24일차 TIL - 그래프

Question1 - [미들러] 가장 먼 노드 문제 설명 https://school.programmers.co.kr/learn/courses/30/lessons/49189 n개의 노드가 있는 그래프가 있습니다. 각 노드는 1부터 n까지 번호가 적혀있습니다. 1번 노드에서 가장 멀리 떨어진 노드의 갯수를 구하려고 합니다. 가장 멀리 떨어진 노드란 최단경로로 이동했을 때 간선의 개수가 가장 많은 노드들을 의미합니다. 노드의 개수 n, 간선에 대한 정보가 담긴 2차원 배열 vertex가 매개변수로 주어질 때, 1번 노드로부터 가장 멀리 떨어진 노드가 몇 개인지를 return 하도록 solution 함수를 작성해주세요. 제한사항노드의 개수 n은 2 이상 20,000 이하입니다.간선은 양방향이며 총 1개 이상 5..

Dev 2024.06.13

[코테] 99클럽 코테 스터디 21일차 TIL - 동적계획법

Question1 - [미들러] 1로 구성된 정사각형의 부분 행렬 찾기 (Count Square Submatrices with All Ones) 문제설명 https://leetcode.com/problems/count-square-submatrices-with-all-ones/description/ Given a m * n matrix of ones and zeros, return how many square submatrices have all ones. Example 1:Input: matrix =[ [0,1,1,1], [1,1,1,1], [0,1,1,1] ]Output: 15 Explanation: There are 10 squares of side 1.There are 4 squares of..

Dev 2024.06.10