알고리즘

Algorithm/PTUStudy

7주차. 연결리스트 복습(두 정렬 리스트의 병합)

https://memodayoungee.tistory.com/39 5주차. 연결 리스트(두 정렬 리스트의 병합) 14. 두 정렬 리스트의 병합 https://leetcode.com/problems/merge-two-sorted-lists/ Merge Two Sorted Lists - LeetCode Merge Two Sorted Lists - You are given the heads of two sorted linked lists list1 and list2. Merge the two lists in a one sorted list memodayoungee.tistory.com 복습했던 문제. 때는 바야흐로 12일. 팀원 모두가 "연결 리스트" 라는 난관에 봉착했다. 백준 문제는 돌아가며 풀이했지만, ..

Algorithm/PTUStudy

6주차. 연결리스트(두 수의 덧셈)

16. 두 수의 덧셈 https://leetcode.com/problems/add-two-numbers/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 single digit. Add the two numbers and return the sum as a linked list. You may as leetcode.c..

Algorithm/PTUStudy

6주차. 에디터

1406. 에디터 https://www.acmicpc.net/problem/1406 1406번: 에디터 첫째 줄에는 초기에 편집기에 입력되어 있는 문자열이 주어진다. 이 문자열은 길이가 N이고, 영어 소문자로만 이루어져 있으며, 길이는 100,000을 넘지 않는다. 둘째 줄에는 입력할 명령어의 개수 www.acmicpc.net 📌문제 - 예제1 📝입력 첫째 줄에는 초기에 편집기에 입력되어 있는 문자열이 주어진다. 이 문자열은 길이가 N이고, 영어 소문자로만 이루어져 있으며, 길이는 100,000을 넘지 않는다. 둘째 줄에는 입력할 명령어의 개수를 나타내는 정수 M(1 ≤ M ≤ 500,000)이 주어진다. 셋째 줄부터 M개의 줄에 걸쳐 입력할 명령어가 순서대로 주어진다. 명령어는 위의 네 가지 중 하나의..

Algorithm/PTUStudy

5주차. 괄호

9012. 괄호 https://www.acmicpc.net/problem/9012 9012번: 괄호 괄호 문자열(Parenthesis String, PS)은 두 개의 괄호 기호인 ‘(’ 와 ‘)’ 만으로 구성되어 있는 문자열이다. 그 중에서 괄호의 모양이 바르게 구성된 문자열을 올바른 괄호 문자열(Valid PS, VPS)이라고 www.acmicpc.net 📌문제 괄호 문자열(Parenthesis String, PS)은 두 개의 괄호 기호인 ‘(’ 와 ‘)’ 만으로 구성되어 있는 문자열이다. 그 중에서 괄호의 모양이 바르게 구성된 문자열을 올바른 괄호 문자열(Valid PS, VPS)이라고 부른다. 한 쌍의 괄호 기호로 된 “( )” 문자열은 기본 VPS 이라고 부른다. 만일 x 가 VPS 라면 이것을 ..

Algorithm/PTUStudy

5주차. 단어 뒤집기

9093. 단어 뒤집기 https://www.acmicpc.net/problem/9093 9093번: 단어 뒤집기 첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있으며, 문장이 하나 주어진다. 단어의 길이는 최대 20, 문장의 길이는 최대 1000이다. 단어와 단어 사이에는 www.acmicpc.net 📌문제 문장이 주어졌을 때, 단어를 모두 뒤집어서 출력하는 프로그램을 작성하시오. 단, 단어의 순서는 바꿀 수 없다. 단어는 영어 알파벳으로만 이루어져 있다. - 예제1 📝입력 첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있으며, 문장이 하나 주어진다. 단어의 길이는 최대 20, 문장의 길이는 최대 1000이다. 단어와 단어 ..

Algorithm/PTUStudy

5주차. 스택

10828. 베르트랑 공준 https://www.acmicpc.net/problem/10828 10828번: 스택 첫째 줄에 주어지는 명령의 수 N (1 ≤ N ≤ 10,000)이 주어진다. 둘째 줄부터 N개의 줄에는 명령이 하나씩 주어진다. 주어지는 정수는 1보다 크거나 같고, 100,000보다 작거나 같다. 문제에 나와있지 www.acmicpc.net 📌문제 정수를 저장하는 스택을 구현한 다음, 입력으로 주어지는 명령을 처리하는 프로그램을 작성하시오. 명령은 총 다섯 가지이다. push X: 정수 X를 스택에 넣는 연산이다. pop: 스택에서 가장 위에 있는 정수를 빼고, 그 수를 출력한다. 만약 스택에 들어있는 정수가 없는 경우에는 -1을 출력한다. size: 스택에 들어있는 정수의 개수를 출력한다..

Algorithm/PTUStudy

5주차. 연결 리스트(역순 연결 리스트)

15. 역순 연결 리스트 https://leetcode.com/problems/reverse-linked-list/ Reverse Linked List - LeetCode Reverse Linked List - Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: [https://assets.leetcode.com/uploads/2021/02/19/rev1ex1.jpg] Input: head = [1,2,3,4,5] Output: [5,4,3,2,1] Example 2: [https://asset leetcode.com 📌문제 연결 리스트를 뒤집어라. - 예제1 📝입력 head = ..

Algorithm/PTUStudy

5주차. 연결 리스트(두 정렬 리스트의 병합)

14. 두 정렬 리스트의 병합 https://leetcode.com/problems/merge-two-sorted-lists/ Merge Two Sorted Lists - LeetCode Merge Two Sorted Lists - You are given the heads of two sorted linked lists list1 and list2. Merge the two lists in a one sorted list. The list should be made by splicing together the nodes of the first two lists. Return the head of the merged linked list. leetcode.com 📌문제 정렬되어 있는 두 연결 리스트를 합..

Algorithm/PTUStudy

5주차. 연결 리스트(팰린드롬 연결 리스트)

13. 팰린드롬 연결 리스트 https://leetcode.com/problems/palindrome-linked-list/ Palindrome Linked List - LeetCode Palindrome Linked List - Given the head of a singly linked list, return true if it is a palindrome or false otherwise. Example 1: [https://assets.leetcode.com/uploads/2021/03/03/pal1linked-list.jpg] Input: head = [1,2,2,1] Output: true Example 2: [https leetcode.com 📌문제 연결 리스트가 팰린드롬 구조인지 판별하라 ..

Algorithm/PTUStudy

4주차. 배열(배열파티션1)

10. 배열 파티션1 https://leetcode.com/problems/array-partition/ Array Partition - LeetCode Array Partition - Given an integer array nums of 2n integers, group these integers into n pairs (a1, b1), (a2, b2), ..., (an, bn) such that the sum of min(ai, bi) for all i is maximized. Return the maximized sum. Example 1: Input: nums = [1,4,3,2] Outpu leetcode.com 📌문제 n개의 페어를 이용한 min(a, b)의 합으로 만들 수 있는 가장 큰 수..

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