본문 바로가기

반응형
SMALL

LeetCode

82. Remove Duplicates from Sorted List 2 안녕하세요. 꼬동입니다. 오랜만에, leetcode에 C를 곁들여 문제를 풀어보았습니다. 아직 죽지 않았더군요. 하하하하하하하 Sorted Single Linked List가 존재합니다. 그 중 중복된 값들을 싸 잡아서, 아예 제거를 하는 것이 목적입니다. 사실 이해는 쉽게 되지만, 어떤 사람이 Single Linked List로 삭제하고 그러겠습니까... Double Linked List를 쓰고 말지.. 그래서 조금 난감했는데, 뭐 ... 펜으로 몇 번 끄적여보니 되더군요. Pointer를 세 개를 두고, 이를 가지고 놀았습니답. 제일 앞의 노드 (head)와 현재 노드 (tmp)와 현재의 이전 노드 (before)를 사용하여, 이케 저케 하니까 되네요. 그 와중에 좀 조건들이 많았는데, 이거 남들한테.. 더보기
1038. Binary Search Tree to Greater Sum Tree 요새 왤케 이진 트리 문제가 재밌는지 모르겠네요? https://leetcode.com/problems/binary-search-tree-to-greater-sum-tree/ Binary Search Tree to Greater Sum Tree - 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 이번 문제는 제일 오~~~른쪽으로 갔다가 왼쪽 갔다가 다시 올라오면서 수를 갱신하는 문제입니다. 되게 쉬워요. 단, 언제 어느 순간에 갱신을 해주냐가 중요한거 같습니다. .. 더보기
1409. Queries on a Permutation With Key 오랜만에, 문제를 가지고 왔습니다 ! 사실 계속해서 문제를 풀었는데, 포스팅만 안했네요. 이번 문제는 포스팅할 맛이 있는 문제라 가져왔습니다. https://leetcode.com/problems/queries-on-a-permutation-with-key/ Queries on a Permutation With Key - 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 가봅시다 ! 이 문제는 1 ~ m이라는 순열 (순열이란 표현이 맞는가 잘 모르겠는데...?) q.. 더보기
85. Maximal Rectangle 어제 풀었던 문제와 유사한 문제입니다. https://ggodong.tistory.com/226 84. Largest Rectangle in Histogram 두둥 제 LeetCode 인생 첫 Hard 문제입니다. https://leetcode.com/problems/largest-rectangle-in-histogram/ Largest Rectangle in Histogram - LeetCode Level up your coding skills and quickly land a job... ggodong.tistory.com 그러니 간단히 설명을 하고 마무리 짓도록하겠습니다. 우선 스택을 사용한다는 점에서는 똑같은 문제입니다만... 2차원이죠 그쵸? 그렇다면 저희는 이 2차원을 커스터마이징을 해야한다는.. 더보기
84. Largest Rectangle in Histogram 두둥 제 LeetCode 인생 첫 Hard 문제입니다. https://leetcode.com/problems/largest-rectangle-in-histogram/ Largest Rectangle in Histogram - 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 바로 Largest Rectangle in Histogram입니다. 이 문제의 경우엔 백준에도 있는 문제입니다. https://www.acmicpc.net/problem/6549 6549번: 히.. 더보기
Range Sum Query - Immutable with 2D 안녕하세요 ! 오늘의 문제 두 개를 들고 와봤습니다. 하나는 Easy https://leetcode.com/problems/range-sum-query-immutable/submissions/ Range Sum Query - Immutable - 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 하나는 Medium 입니다. https://leetcode.com/problems/range-sum-query-2d-immutable/ Range Sum Query 2D -.. 더보기
264. Ugly Number II (Heap) 이 전에 못 생긴 수 문제를 풀었더랬죠. https://ggodong.tistory.com/222 263. Ugly Number 유명한 못 생긴 수입니다. 원래 유명한 문제인 못 생긴 수는 이 문제가 아니죠. 약간... 빌드업을 위한? 문제라고 생각하시면 될 거 같습니다. 즉, 다음 문제는 그 유명한 못 생긴 수이고, 오늘 문� ggodong.tistory.com 이 문제의 경우엔 Part 2 입니다. 최근 라스트 오브 어스 Part 2가 망했다던데.. 이 문제는 어떨까요 ? 본 문제는 2, 3, 5를 공약수로 가지는 수를 나열했을 때 N 번째 오는 숫자가 무엇인지를 알아내는 문제입니다. N의 범위는 1690까지이죠. 이 문제 같은 경우엔 정말 많은 해법을 가지고 있습니다. 저 같은 경우엔 Heap을 사.. 더보기
26. Remove Duplicates from Sorted Array 자기 전 스낵 문제 입니다 ! https://leetcode.com/problems/remove-duplicates-from-sorted-array/ Remove Duplicates from 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 이 문제는 특이하게도 문제에서 extra memory로 배열을 만들지 말라고 합니다. 메소드에 들어오는 인자 배열만 사용해라는 뜻이죠. 처음엔 굉장히 당황스러웠습니다. 새로운 배열을 못 쓴다는 사실이 .. 더보기

반응형
LIST