본문 바로가기

전체 글

(12)
[Leetcode][Python] 19. Remove Nth Node From End of List 리트코드 / 파이썬 / 19. Remove Nth Node From End of List https://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 풀이 방법 linkedlist를 한번에 순회하면서 찾는 방법 -> 맨 앞에 dummy 노드부터 시작. fast가 먼저 N만큼 가고, 그 후 slow와 f..
[Leetcode][Python] 57. Insert Interval 리트코드 / 파이썬 / 57. Insert Interval https://leetcode.com/problems/insert-interval/ Insert Interval - 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 풀이 방법 Leetcode Description의 Example2로 설명해본다. Input: intervals = [[1,2],[3,5],[6,7],[8,10],[12,16]], newInterval = [4,8] Output: [[1,2],[..
[Leetcode][Python] 48. Rotate Image 리트코드 / 파이썬 / 48. Rotate Image https://leetcode.com/problems/rotate-image/ Rotate Image - 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 풀이 방법 주어진 array를 90도 회전하라는 문제인데, 행렬의 연산을 이리저리 하다 보면 90도 회전한 array를 볼 수 있다. 첫번째 방법은 1. transpose(전치) 2. array의 열 뒤집기를 하는 방법이다. 두번째 방법은 아래 그림과 같이 e..