전체 글348 141. Linked List Cycle 📌 Problem Link : https://leetcode.com/problems/linked-list-cycle/description/✅ Accepted :public class Solution { public boolean hasCycle(ListNode head) { if (head == null) return false; ListNode current = head; while (current.next != null) { if (current.val == 100001) return true; current.val = 100001; current = current.next; } .. 알고리즘 문제 풀이: 자바/LeetCode 2026. 1. 24. [리뷰] 왜 일하는가? 1. 소개책 제목 : 왜 일하는가?저자 : 이나모리 가즈오읽은 계기 : 청년 멘토링 2025 행사에 참여해 유튜브 면접왕 이형 님의 추천으로 읽게 되었습니다.2. 기억에 남는 문장일을 하는 가장 큰 목적은 그 일을 하는 우리 자신의 마음을 연마하고 인성을 기르는 데 있다.단기간의 실천 목표를 세우지만, 가야 할 곳은 언제나 높아야 한다.인생에서 고난이 끊임없이 몰아치는 일은 없다. 물론 행운 또한 영원히 계속되지 않는다.꺽이지 않은 열망만 있으면 기술이나 노하우는 나중에 얼마든지 도입할 수 있다.인생과 일 = 능력 X 열의 X 사고방식성공적인 인생을 살아가기 위한 세 요소 중 가장 중요한 것이 사고방식이라고 생각한다.3. 추천 대상커리어 고민 중인 2030 직장인번아웃을 겪고 있는 사람4. 감상평능력이 .. 메모장/Book Review 2026. 1. 11. 이펙티브 자바(Effective Java) 핵심 내용 정리 - 진행중 이펙티브 자바를 학습하면서 중요 내용을 정리한 글입니다. 2장. 객체 생성과 파괴1. 생성자 대신 정적 팩터리 메서드를 고려하라클래스는 생성자와 별도로 그 클래스의 인스턴스를 반환하는 정적 팩터리 메서드(static factory method)를 제공할 수 있다. 정적 팩터리 메서드가 생성자보다 좋은 장점1. 이름을 가질 수 있다.- 메서드의 이름을 잘 지으면 반환될 객체의 특성을 쉽게 묘사할 수 있다. 2. 호출될 때 마다 인스턴스를 새로 생성하지 않아도 된다.- 클래스를 불변 클래스로 만들고 인스턴스를 정적 팩터리 메서드를 통해서만 제공한다면 불필요한 객체 생성을 제한할 수 있다. 3. 반환 타입의 하위 타입 객체를 반환할 수 있는 능력이 있다.- 구현 클래스를 외부에 노출하지 않고 인터페이스 기반의.. 책 읽고 내용 정리/Hard Skill 2026. 1. 3. 136. Single Number 📌 Problem Link : https://leetcode.com/problems/single-number ✅ Accepted :class Solution { public int singleNumber(int[] nums) { int n = nums.length; if (n == 1) return nums[0]; Arrays.sort(nums); Deque dq = new ArrayDeque(); for (int num: nums) { dq.addLast(num); } while(dq.size() > 1) { int first = dq.pollFirst(); .. 알고리즘 문제 풀이: 자바/LeetCode 2025. 12. 17. 649. Dota2 Senate 📌 Problem Link : https://leetcode.com/problems/dota2-senate ✅ Accepted :class Solution { public String predictPartyVictory(String senate) { Queue queue = new ArrayDeque(); int radiantCount = 0; int direCount = 0; // 초기 큐 구성 및 각 진영 카운트 for (char ch : senate.toCharArray()) { queue.offer(ch); if (ch == 'R') radiantCount++; else.. 알고리즘 문제 풀이: 자바/LeetCode 2025. 12. 2. 1137. N-th Tribonacci Number 📌 Problem Link : https://leetcode.com/problems/n-th-tribonacci-number ✅ Accepted :class Solution { public int tribonacci(int n) { int[] dp = new int[38]; dp[0] = 0; dp[1] = 1; dp[2] = 1; for (int i = 3; i 🧐 Review :LeetCode 1137번 Tribonacci 문제를 처음 풀 때 저는 가장 단순한 방법인 DP 배열을 사용했습니다. 점화식을 그대로 구현하는 방식이라 직관적이고 쉽게 통과할 수 있었지만, 풀이를 되돌아보니 공간 사용 측면에서 아쉬움이 보였습니다. Tri.. 알고리즘 문제 풀이: 자바/LeetCode 2025. 11. 25. 724. Find Pivot Index 📌 Problem Link : https://leetcode.com/problems/find-pivot-index ✅ Accepted :class Solution { public int pivotIndex(int[] nums) { int n = nums.length; int[] prefixSum = new int[n]; prefixSum[0] = nums[0]; for (int i = 1; i 🧐 Review :이 문제의 핵심 아이디어는 좌측 합(left sum)과 우측 합(right sum)이 동일한 위치를 찾는 것입니다.즉, 인덱스 i를 기준으로 왼쪽에 있는 모든 원소의 합과 오른쪽에 있는 모든 원소의 합이 같다면 그 위치가 pivot in.. 알고리즘 문제 풀이: 자바/LeetCode 2025. 11. 22. 1. Two Sum 📌 Problem Link : https://leetcode.com/problems/two-sum✅ Accepted :class Solution { public int[] twoSum(int[] nums, int target) { int[] answer = new int[2]; int n = nums.length; Map map = new HashMap(); for (int i = 0; i 🧐 Review :Two Sum 문제는 nums 배열에서 target을 만들 수 있는 두 수의 인덱스를 찾는 전형적인 문제입니다.입력 길이가 최대 10^4이기 때문에, 단순히 모든 쌍을 확인하는 O(N^2) 방식으로 접근하면 시간 초과가 날 가능성이 높습니다... 알고리즘 문제 풀이: 자바/LeetCode 2025. 11. 22. 334. Increasing Triplet Subsequence 📌 Problem Link : https://leetcode.com/problems/increasing-triplet-subsequence❌ Wrong Answer :class Solution { public boolean increasingTriplet(int[] nums) { int n = nums.length; if (n ✅ Accepted :class Solution { public boolean increasingTriplet(int[] nums) { int first = Integer.MAX_VALUE; int second = Integer.MAX_VALUE; for (int x: nums) { if.. 알고리즘 문제 풀이: 자바/LeetCode 2025. 11. 18. 933. Number of Recent Calls 📌 Problem Link : https://leetcode.com/problems/number-of-recent-calls ✅ Accepted :class RecentCounter { Queue que = new LinkedList(); int count; public RecentCounter() { count = 0; } public int ping(int t) { count = 1; int min = t - 3000; int max = t; int size = que.size(); for(int i = 0; i = min && number 🔨 Code Refactoring :class Rece.. 알고리즘 문제 풀이: 자바/LeetCode 2025. 11. 13. 이전 1 2 3 4 ··· 35 다음