알고리즘

Algorithm/PTUStudy

10주차. 데크, 우선순위(k개 정렬 리스트 병합)

27. k개 정렬 리스트 병합 https://leetcode.com/problems/merge-k-sorted-lists/ Merge k Sorted Lists - LeetCode Can you solve this real interview question? Merge k Sorted Lists - You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it. Example 1: Input: lis leetcode.com 📌문제 k개의 정렬된 리스트를 1개의 정렬된 리스트로 ..

Algorithm/PTUStudy

10주차. 데크, 우선순위 큐(원형 데크 디자인)

26. 원형 데크 디자인 https://leetcode.com/problems/design-circular-deque/ Design Circular Deque - LeetCode Can you solve this real interview question? Design Circular Deque - Design your implementation of the circular double-ended queue (deque). Implement the MyCircularDeque class: * MyCircularDeque(int k) Initializes the deque with a maximum size of k. * boole leetcode.com 📌문제 다음 연산을 제공하는 원형 데크를 디자인하라..

Algorithm/PTUStudy

9주차. 스택, 큐(원형 큐 디자인)

25. 원형 큐 디자인 https://leetcode.com/problems/design-circular-queue/ Design Circular Queue - LeetCode Can you solve this real interview question? Design Circular Queue - Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle, and the leetcode.com 📌문제 원형 큐를 디자인하라 - 예제1 📝입력 ["My..

Algorithm/PTUStudy

9주차. 스택,큐(스택을 이용한 큐 구현)

24. 스택을 이용한 큐 구현 https://leetcode.com/problems/implement-queue-using-stacks/ Implement Queue using Stacks - LeetCode Can you solve this real interview question? Implement Queue using Stacks - Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, and empty). Implement t leetcode.com 📌문제 스택을 이용해..

Algorithm/PTUStudy

8주차. 단어 뒤집기 2

17413. 단어 뒤집기 https://www.acmicpc.net/problem/17413 17413번: 단어 뒤집기 2 문자열 S가 주어졌을 때, 이 문자열에서 단어만 뒤집으려고 한다. 먼저, 문자열 S는 아래와과 같은 규칙을 지킨다. 알파벳 소문자('a'-'z'), 숫자('0'-'9'), 공백(' '), 특수 문자('')로만 이루어져 www.acmicpc.net 📌문제 - 예제1 📝입력 baekjoon online judge ef gh 💻출력 noojkeab enilno egduj fe hg 📌풀이(플래그, 스택 활용) 244ms, 22380kb import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamR..

Algorithm/PTUStudy

8주차. 10866 덱

10866. https://www.acmicpc.net/problem/10866 10866번: 덱 첫째 줄에 주어지는 명령의 수 N (1 ≤ N ≤ 10,000)이 주어진다. 둘째 줄부터 N개의 줄에는 명령이 하나씩 주어진다. 주어지는 정수는 1보다 크거나 같고, 100,000보다 작거나 같다. 문제에 나와있지 www.acmicpc.net 📌문제 - 예제1 📝입력 15 push_back 1 push_front 2 front back size empty pop_front pop_back pop_front size empty pop_back push_front 3 empty front 💻출력 2 1 2 0 2 1 -1 0 1 -1 0 3 📌풀이 216ms, 18588kb import java.io.Buffe..

Algorithm/PTUStudy

8주차. 스택, 큐(일일 온도)

22. 일일 온도 https://leetcode.com/problems/daily-temperatures/ Daily Temperatures - LeetCode Can you solve this real interview question? Daily Temperatures - Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer leetcode.com 📌문제 매일의 화씨 온도 리스트 T를 입력받아서, 더 따뜻한 날씨를 위..

Algorithm/PTUStudy

8주차. 스택, 큐(유효한 괄호)

20. 유효한 괄호 https://leetcode.com/problems/valid-parentheses/ Valid Parentheses - LeetCode Can you solve this real interview question? Valid Parentheses - Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: 1. Open brackets must be closed by the sam leetcode.com 📌문제 괄호로 된 입력값이 올바른지 판별하라 - 예제1 📝입력 Inpu..

Algorithm/PTUStudy

6-7주차 연결 리스트(홀짝 연결리스트)

18. 홀짝 연결리스트 https://leetcode.com/problems/odd-even-linked-list/ Odd Even Linked List - LeetCode Odd Even Linked List - Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list. The first node is considered odd, and the second node is even, and so on. N leetcode.com 📌문제 연결 리스트를 홀수 노드 다음에 짝수 노드가 오도..

Algorithm/PTUStudy

6-7주차 연결 리스트(페어의 노드 스왑)

왜 6-7주차냐면 6주차에 푼 문제인데 7주차에 복습을 하기로 해성ㅋ 이 문제 때문에 아이패드를 꺼냈다. 난 집념의 K국가 시민. 깨달음을 얻었다. 17. 페어의 노드 스왑 https://leetcode.com/problems/swap-nodes-in-pairs/https://leetcode.com/problems/add-two-numbers/ Add Two Numbers - LeetCode Add Two Numbers - You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a sin..

지구우중
'알고리즘' 태그의 글 목록 (3 Page)