# leetcode

4300개의 포스트
post-thumbnail

1480. Running Sum of 1d Array

내 풀이수정한 풀이list comprehension 과 for 문은 생각보다 별 차이 없다.sum 연산을 계속 수행하게 하는 것 보다 더한 값을 변수로 저장해 놓는 것이 더 효율적이다.

약 11시간 전
·
0개의 댓글
·
post-thumbnail

724. Find Pivot Index

처음 풀이맨 마지막 인덱스가 피봇일 때를 고려해야하는 코드라서 하드코딩 느낌 ..? 수정한 풀이sum 연산을 최소화 하기 위해 미리 전체 리스트의 합을 rightsum 변수로 담아두고 원소를 하나씩 빼는 방식시간이 8550 ms 에서 149 ms 로 줄었다.

약 11시간 전
·
0개의 댓글
·
post-thumbnail

Daily LeetCode Challenge - 704. Binary Search

Problem From.https://leetcode.com/problems/binary-search/오늘 문제는 매우 간단하게 이진탐색(Binary Search) 를 구현하는 문제였다.

약 14시간 전
·
0개의 댓글
·

[LeetCode] 704. Binary Search

704. Binary Search

약 18시간 전
·
0개의 댓글
·
post-thumbnail

Number of Distinct Islands

친구의 프리미엄 계정을 빌려서 문제를 풀고 있다 재밌는 문제를 발견했다. Distinct Islands, 즉 독립적인 섬의 숫자를 출력하면 되는 문제다. 그냥 단순하게 DFS를 사용해서 섬을 출력하는게 아니고 독립적인 섬의 "모양"이 같다면 그 섬들은 하나의 섬으로 취

어제
·
0개의 댓글
·

[LeetCode]원형 큐 디자인

원형 큐를 디자인하라.Example 1:Constraints:1 <= k <= 10000 <= value <= 1000At most 3000 calls will be made to enQueue, deQueue, Front, Rear, isEmpt

2일 전
·
0개의 댓글
·

[LeetCode]스택을 이용한 큐 구현

큐를 이용해 다음 연산을 지원하는 스택을 구현하라.Example 1:Constraints:1 <= x <= 9At most 100 calls will be made to push, pop, peek, and empty.All the calls to pop a

2일 전
·
0개의 댓글
·

[LeetCode]큐를 이용한 스택 구현

큐를 이용해 다음 연산을 지원하는 스택을 구현하라.Example 1:Constraints:1 <= x <= 9At most 100 calls will be made to push, pop, top, and empty.All the calls to pop an

2일 전
·
0개의 댓글
·

[LeetCode]일일 온도

매일의 화씨 온도(F) 리스트 T를 입력받아서, 더 따뜻한 날씨를 위해서는 며칠을 더 기다려야 하는지를 출력하라.Example 1:Example 2:Example 3:Constraints:1 <= temperatures.length <= 10530 <=

2일 전
·
0개의 댓글
·

[LeetCode]중복 문자 제거

중복된 문자를 제거하고 사전식 순서로 나열하라.Example 1:Example 2: Runtime 4 ms / Memory 6.6 MBhttps://leetcode.com/problems/remove-duplicate-letters/submissions/925

2일 전
·
0개의 댓글
·

[LeetCode]유효한 괄호

괄호로 된 입력값이 올바른지 판단하라.Example 1:Example 2:Example 3: Runtime 0 ms / Memory 6.4 MBhttps://leetcode.com/problems/valid-parentheses/submissions/92508

2일 전
·
0개의 댓글
·
post-thumbnail

[LeetCode]홀짝 연결 리스트

연결 리스트를 홀수 노드 다음에 짝수 노드가 오도록 재구성하라. 공간 복잡도 O(1), 시간 복잡도 O(n)에 풀이하라.Example 1:Example 2:Constraints:The number of nodes in the linked list is in the ra

2일 전
·
0개의 댓글
·
post-thumbnail

[LeetCode]페어의 노드 스왑

연결리스트를 입력받아 페어단위로 스왑하라.Example 1:Example 2:Example 3: Runtime 0 ms / Memory 7.6 MBhttps://leetcode.com/problems/swap-nodes-in-pairs/submissions/9

2일 전
·
0개의 댓글
·
post-thumbnail

[LeetCode]두 수의 덧셈

역순으로 저장된 연결 리스트의 숫자를 더하라.Example 1:Example 2:Example 3: Runtime 44 ms / Memory 71.6 MBhttps://leetcode.com/problems/add-two-numbers/submissions/9

2일 전
·
0개의 댓글
·
post-thumbnail

[LeetCode] 1. Two Sum 문제 풀이

LeetCode 1. Two Sum 문제 풀이

3일 전
·
0개의 댓글
·
post-thumbnail

Daily LeetCode Challenge - 1402. Reducing Dishes

Problem From.https://leetcode.com/problems/reducing-dishes/오늘 문제는 각 요리의 만족도가 적어진 staisfaction 배열이 주어졌을때, 요리를 몇개 만들지 않고 최대의 만족감값을 반환하도록 하는 문제였다.이

4일 전
·
0개의 댓글
·

[LeetCode] 1402. Reducing Dishes

1402. Reducing Dishes

4일 전
·
0개의 댓글
·