코딩테스트 99

409. Longest Palindrome

https://leetcode.com/problems/longest-palindrome/description/ LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com /** 1. 문제 해석하기 가장 긴 palindrome 만들기 2. 문제 풀이 방향 홀수는 한개(가장 긴 홀수를 찾아야함) 짝수는 전부 하면 무조건 palindrome을 만들 수 있을 것 같음. */ c..

코딩테스트 2024.02.17

234. Palindrome Linked List

https://leetcode.com/problems/palindrome-linked-list/description/ LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com palindrome에 대해서 잘 몰라서 풀이 방식에 대해 찾아보았다. 1. 절반으로 나눠서 비교하는 방법 2. 뒤집은 다음에 같은지 확인하는 방법 1번으로 푼 코드 8ms /** * Definit..

코딩테스트 2024.02.16

14. Longest Common Prefix

https://leetcode.com/problems/longest-common-prefix/description/ LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com /** 1. 문제 해석하기 가장 긴 공통 prefix를 찾는 문제이고 없으면 "" 반환 2. 문제 풀이 방향 이중 for문으로 풀고 만약 common prefix가 ""이면 바로 반환 최초 comm..

코딩테스트 2024.02.14

136. Single Number

https://leetcode.com/problems/single-number/description/ LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 최초 풀이는 HashMap을 이용해서 배열의 요소의 개수를 체크한 후 개수가 1인 요소를 반환했다. 하지만 이렇게 풀이할 경우 공간 복잡도가 O(n)이었다. 문제에서는 공간복잡도 O(1)로 풀길 권장하고 있었기 ..

코딩테스트 2024.02.07

876. Middle of the Linked List

https://leetcode.com/problems/middle-of-the-linked-list/description/ LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 1. 전체값을 찾는다. 2. 전체값을 통해 중간값을 찾는다. 3. 중간값에 해당하는 노드는 재귀를 통해 찾는다. /** * Definition for singly-linked list. * ..

코딩테스트 2024.02.05