본문 바로가기
728x90
반응형

공부/2024 항해99코딩클럽35

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클럽 코테 스터디 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클럽 코테 스터디 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.
99클럽 코테 스터디 30일차 TIL + 해시맵 해시맵(HashMap)은 맵(Map) 인터페이스를 구현한 대표적인 맵(Map) 컬렉션이다. 맵(Map) 인터페이스를 상속하고 있기에 맵(Map)의 성질을 그대로 가지고 있다. 맵(Map)은 키와 값으로 구성된 Entry객체를 저장하는 구조를 가지고 있는 자료구조이다. 여기서 키와 값은 모두 객체이다. 값은 중복 저장될 수 있지만 키는 중복 저장될 수 없다. 만약 기존에 저장된 키와 동일한 키로 값을 저장하면 기존의 값은 없어지고 새로운 값으로 대치된다. 해시맵(HashMap)은 이름 그대로 해싱(Hashing)을 사용하기 때문에 많은 양의 데이터를 검색하는 데 있어서 뛰어난 성능을 보인다. 해시맵(HashMap) 특징 Key와 Value 쌍으로 데이터를 저장한다. Key는 중복되지 않는다. 중복된 Key.. 2024. 6. 19.
99클럽 코테 스터디 29일차 TIL + ArrayList ArrayList는 배열을 기반으로 한 컬렉션의 하나이며, 데이터를 추가, 삭제시 내부에서 동적으로 배열의 길이를 조절해 줍니다. ArrayList를 생성하게 되면 내부에서는 데이터를 저장하기 위한 Capacity 크기의 저장공간이 할당되며, 사용중 데이터의 크기가 이 Capacity의 크기를 넘어서게 되면 저장공간이 새롭게 할당됩니다. ArrayList 데이터 삭제시 1) ArrayList vs 배열 배열은 길이가 고정된 반면 ArrayList는 배열의 길이를 자동으로 조절해주는 기능을 가지고 있어 가변적입니다. 2) ArrayList vs Vector ArrayList와 Vector는 멀티 스레드 환경을 위한 동기화를 제외하고는 거의 유사합니다. 다만, ArrayList는 동기화 처리가 되어 있지 않.. 2024. 6. 17.
728x90
반응형