전체 글
-
LeetCode 39. - Combination Sum알고리즘/알고리즘 문제 복기 2021. 3. 24. 16:21
leetcode.com/problems/combination-sum/ Combination Sum - LeetCode 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 Q Answer. 문제를 처음봤을때 예전에 풀었던, 하나 혹은 두개의 계단을 오르는 방법이 있을 때 계단을 오르는 경우의 수를 구하는 문제가 생각났었다. 그 뒤에 계속 생각하다보니 백트래킹을 사용해야겠다는 생각이나서 풀었었지만 구현력이 되지 않아 풀지 못했었다. 백트래킹에 관한 관련 문제를 더 풀어봐야겠다. www...
-
Leet Code - 34. Find First and Last Position of Element in Sorted Array알고리즘/알고리즘 문제 복기 2021. 3. 24. 07:26
leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ Find First and Last Position of Element in Sorted Array - LeetCode 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 Answer 바이너리 서치를 활용해서 푸는 문제였다. 다소 난잡하게 코드를 짠 것 같아 답지를 보니 다음과 같이 풀었었다.
-
LeetCode - 19. Remove Nth Node From End of List알고리즘/알고리즘 문제 복기 2021. 3. 17. 21:08
leetcode.com/problems/remove-nth-node-from-end-of-list/ Remove Nth Node From End of List - LeetCode 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 Q. Answer. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 ..
-
Leet Code - 11. Container With Most Water알고리즘/알고리즘 문제 복기 2021. 3. 14. 15:19
leetcode.com/problems/container-with-most-water/ Container With Most Water - LeetCode 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 Answer1. BRUTE FORCE 맨처음에는 단순하게 브루트 포스 방식으로 풀어봤다. 입력되는 값이 10^5길이의 배열까지 있다보니 역시 시간 초과가 나왔다. 풀어보려고 생각해본게 배열에서 height[i]의 크기가 클 때에만 값을 체크하는 것과 배열의 left와 right의 ..
-
Leet code - 5. Longest Palindromic Substring(Java)알고리즘/알고리즘 문제 복기 2021. 3. 14. 12:55
leetcode.com/problems/longest-palindromic-substring/ Longest Palindromic Substring - LeetCode 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 Q. Answer 이전에 풀었었는데 다시 한번 풀려고하니 잘 풀리지가 않았다. 맨처음에는 checkPalindrome이라는 메소드를 만들어 스트링의 중간을 구한 뒤 좌측과 우측으로 확장하며 palindrome인 것을 check하도록 문제를 만들었었는데 O(n^3)의 ..
-
Leetcode - 3. Longest SubString Without Repeating Characters알고리즘/알고리즘 문제 복기 2021. 3. 8. 21:37
leetcode.com/problems/longest-substring-without-repeating-characters/ Longest Substring Without Repeating Characters - LeetCode 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 Answer. 슬라이딩 윈도우 방식을 이용했다. left에서 right까지 훑는 dummy라는 변수를 만들고 dummy의 값이 right와 같다면 dummy+1의 값으로 left로 이동시키는 방식으로 풀었다..
-
Leet code - 2. Add Two Number - Java알고리즘/알고리즘 문제 복기 2021. 3. 8. 20:47
leetcode.com/problems/add-two-numbers/ Add Two Numbers - LeetCode 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 이전에 C++로 풀었던 것을 자바로 다시 한번 복기할겸 풀었다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 ..
-
Annotation자바 스터디 2021. 3. 1. 20:45
백기선님의 자바 스터디를 진행하며 찾아 본 내용입니다. 목표 자바의 애노테이션에 대해 학습하세요. 학습할 것 애노테이션 정의하는 방법 @retention @target @documented 애노테이션 프로세서 Annotation이란 Annotation은 JDK 1.5에서 추가 된 기능이다. 어노테이션은 메타데이터 즉 다른 데이터를 설명하기 위한 데이터이다. 전체 소스코드에서 코드의 로직에는 영향을 주지 않지만 해당 타겟의 연결 방법이나 소스코드의 구조를 변경한다. 다음과 같은 특징을 가지고 있다. '@'로 시작된다. metadata를 프로그램에 연결하는데 유용하게 사용된다. Annotatoion은 순수한 '주석'은 아니고 컴파일러가 프로그램을 컴파일 하는 과정을 변화시켜 줄 수 있다. 다음과 같은 코드가..