본문 바로가기
728x90
반응형

99클럽37

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.
99클럽 코테 스터디 31일차 TIL + 좋은 코드를 작성하기위한 방법 1. **가독성**: 코드는 다른 사람이 쉽게 이해하고 유지보수할 수 있어야 합니다. 변수명과 함수명은 명확하고 직관적이어야 하며, 코드 블록은 들여쓰기를 통해 구조화되어야 합니다. 2. **모듈화**: 코드를 작은 단위로 분리하여 각 기능이나 역할에 맞게 모듈화합니다. 함수나 클래스 등을 재사용 가능한 형태로 설계하여 중복을 최소화하고 코드를 관리하기 쉽게 합니다. 3. **명확성**: 코드는 목적에 맞게 명확해야 합니다. 네이밍 규칙을 지키고, 함수와 클래스의 책임을 명확히 분리하여 코드의 의도를 명확히 전달해야 합니다. 4. **효율성**: 코드는 성능 면에서도 효율적이어야 합니다. 불필요한 반복이나 자원 낭비를 줄이는 최적화를 고려해야 합니다. 하지만 이는 코드의 가독성이나 유지보수성에 우선시 되.. 2024. 6. 19.
728x90
반응형