본문 바로가기
728x90
반응형

코딩테스트 준비39

99클럽 코테 스터디 40일차 TIL + [LeetCode] 2405. Optimal Partition of String/그리디알고리즘/자바 풀이 1. 오늘의 학습 키워드 [LeetCode] 2405. Optimal Partition of String/그리디알고리즘/자바 풀이  2. 오늘의 학습 문제 문제https://leetcode.com/problems/optimal-partition-of-string/description/ 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 pa.. 2024. 6. 28.
99클럽 코테 스터디 39일차 TIL + [LeetCode] 1338. Reduce Array Size to The Half/힙/JAVA풀이 1. 오늘의 학습 키워드  [LeetCode] 1338. Reduce Array Size to The Half/힙/JAVA풀이 자바   2. 오늘의 학습 문제 문제 https://leetcode.com/problems/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.. 2024. 6. 27.
99클럽 코테 스터디 38일차 TIL + [LeetCode] 1845. Seat Reservation Manager/힙/JAVA풀이 1. 오늘의 학습 키워드  [LeetCode] 1845. Seat Reservation Manager/힙/JAVA풀이 2. 오늘의 학습 문제 문제https://leetcode.com/problems/seat-reservation-manager/ Design a system that manages the reservation state of n seats that are numbered from 1 to n.Implement the SeatManager class:SeatManager(int n) Initializes a SeatManager object that will manage n seats numbered from 1 to n. All seats are initially available.int .. 2024. 6. 26.
99클럽 코테 스터디 37일차 TIL + [LeetCode] 921. Minimum Add to Make Parentheses Valid/스택/큐/JAVA 풀이 1. 오늘의 학습 키워드 [LeetCode] 921. Minimum Add to Make Parentheses Valid/스택/큐/JAVA 풀이    2. 오늘의 학습 문제 문제https://leetcode.com/problems/minimum-add-to-make-parentheses-valid/description/ 921. Minimum Add to Make Parentheses Valid   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 .. 2024. 6. 25.
99클럽 코테 스터디 36일차 TIL + [LeetCode] 2390. Removing Stars From a String/스택/큐/JAVA풀이 1. 오늘의 학습 키워드 [LeetCode] 2390. Removing Stars From a String/스택/큐/JAVA풀이  2. 오늘의 학습 문제 문제 https://leetcode.com/problems/removing-stars-from-a-string/description/ [LeetCode] 2390. Removing Stars From a String You are given a string s, which contains stars *.In one operation, you can:Choose a star in s.Remove the closest non-star character to its left, as well as remove the star itself.Return the s.. 2024. 6. 24.
99클럽 코테 스터디 35일차 TIL + [LeetCode] 341. Flatten Nested List Iterator/스택/큐/JAVA풀이 1. 오늘의 학습 키워드[LeetCode] 341. Flatten Nested List Iterator/스택/큐/JAVA풀이    2. 오늘의 학습 문제 문제 https://leetcode.com/problems/flatten-nested-list-iterator/description/ You are given a nested list of integers nestedList. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an iterator to flatten it.Implement the NestedIterator class:NestedIterator(Lis.. 2024. 6. 23.
99클럽 코테 스터디 34일차 TIL + [LeetCode] 1823. Find the Winner of the Circular Game/스택/큐/JAVA풀이/원형리스트 1. 오늘의 학습 키워드 [LeetCode] 1823. Find the Winner of the Circular Game/스택/큐/JAVA풀이 -원형리스트원형리스트란, 리스트의 마지막 노드의 링크가 첫번째 노드를 가리기는 연결 리스트로 원형을 하고 있다. 선행 노드의 포인터가 필요하다.    2. 오늘의 학습 문제 문제 https://leetcode.com/problems/find-the-winner-of-the-circular-game/description/ There are n friends that are playing a game. The friends are sitting in a circle and are numbered from 1 to n in clockwise order. More for.. 2024. 6. 22.
99클럽 코테 스터디 33일차 TIL + [LeetCode] 869. Reordered Power of 2/정렬 1. 오늘의 학습 키워드  [LeetCode] 869. Reordered Power of 2정렬 2. 오늘의 학습 문제 문제https://leetcode.com/problems/reordered-power-of-2/description/   You are given an integer n. We reorder the digits in any order (including the original order) such that the leading digit is not zero.Return true if and only if we can do this so that the resulting number is a power of two. Example 1:Input: n = 1Output: trueExamp.. 2024. 6. 21.
99클럽 코테 스터디 32일차 TIL + [LeetCode] 347. Top K Frequent Elements 정렬 1. 오늘의 학습 키워드  [LeetCode] 347. Top K Frequent Elements 정렬 2. 오늘의 학습 문제 문제 https://leetcode.com/problems/top-k-frequent-elements/description/  코드import java.util.*;class Solution { public int[] topKFrequent(int[] nums, int k) { HashMap frequentMap = new HashMap() ; // num을 키로하고 개수를 담는 해시맵 초기화 for(int num: nums){ int keyValue= 0 ; if(frequentMap.containsK.. 2024. 6. 20.
728x90
반응형