๋ชจ๋“ ๋‚  88

[LeetCode] 622. design_circular_queue (Medium) 2023/5/10

๋ฌธ์ œ ์ œ๋ชฉ ์ •๋‹ต๋ฅ  ๋‚œ์ด๋„ 622. design_circular_queue 51.5% Medium 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 ๋ฌธ์ œ์š”์•ฝ ์›ํ˜• ํ๋ฅผ ๋งŒ๋“ค์–ด๋ผ ์›ํ˜•ํ๊ฐ€ ๋ณดํ†ต์˜ ํ์™€ ๋‹ค๋ฅธ ์ ์€ ์ œ์ผ ๋’ค์˜ ์ฃผ์†Œ..

[LeetCode] 232. implement_queue_using_stacks (Easy) 2023/5/10

๋ฌธ์ œ ์ œ๋ชฉ ์ •๋‹ต๋ฅ  ๋‚œ์ด๋„ 232. implement_queue_using_stacks 63.4% Easy 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 ๋ฌธ์ œ์š”์•ฝ ์Šคํƒ์„ ์ด์šฉํ•ด ํ๋ฅผ ๊ตฌํ˜„ํ•ด๋ผ def __in..

[LeetCode] 225. implement_stack_using_queues (Easy) 2023/5/9

๋ฌธ์ œ ์ œ๋ชฉ ์ •๋‹ต๋ฅ  ๋‚œ์ด๋„ 225. implement_stack_using_queues 58.9% Easy Implement Stack using Queues - LeetCode Can you solve this real interview question? Implement Stack using Queues - Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (push, top, pop, and empty). Implement the leetcode.com ๋ฌธ์ œ์š”์•ฝ ํ๋ฅผ ์ด์šฉํ•ด ์Šคํƒ์„ ๊ตฌํ˜„ํ•ด๋ผ def __in..

[LeetCode] 739. daily_temperatures (Medium) 2023/5/9

๋ฌธ์ œ ์ œ๋ชฉ ์ •๋‹ต๋ฅ  ๋‚œ์ด๋„ 739. daily_temperatures 66.3% Medium 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 ๋ฌธ์ œ์š”์•ฝ ๋ฌธ์žํ˜•์„ ์›์†Œ๋กœ ๊ฐ€์ง€๋Š” ๋ฐฐ์—ด์ด ์ฃผ์–ด์งˆ ๋•Œ, ์˜ค๋Š˜๋ณด๋‹ค ๋” ๋”ฐ๋œปํ•œ ๋‚ ์”จ๋ฅผ ์œ„ํ•ด์„œ๋Š”..

[LeetCode] 316. remove_duplicate_letters (Medium) 2023/5/8

๋ฌธ์ œ ์ œ๋ชฉ ์ •๋‹ต๋ฅ  ๋‚œ์ด๋„ 316. remove_duplicate_letters 45.2% Medium Remove Duplicate Letters - LeetCode Can you solve this real interview question? Remove Duplicate Letters - Given a string s, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible re leetcode.com ๋ฌธ์ œ์š”์•ฝ ๋ฌธ์ž์—ด์ด ์ฃผ์–ด์งˆ ๋•Œ ์ค‘๋ณต ๋ฌธ์ž๋ฅผ ์ œ๊ฑฐํ•œ, ์ œ์ผ ์ž‘์€ ์‚ฌ..

[LeetCode] 20. Valid_Parentheses (Easy) 2023/5/8

๋ฌธ์ œ ์ œ๋ชฉ ์ •๋‹ต๋ฅ  ๋‚œ์ด๋„ 20. Valid_Parentheses 40.5% Easy 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) ๋ฌธ์ž์—ด์€ ์†Œ๊ด„ํ˜ธ (), ์ค‘..

[LeetCode] 2. Add_Two_Numbers (Medium) 2023/5/5

๋ฌธ์ œ ์ œ๋ชฉ ์ •๋‹ต๋ฅ  ๋‚œ์ด๋„ 2. Add-Two-Numbers 40.5% Medium Add Two Numbers - LeetCode Can you solve this real interview question? 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 leetcode.com ๋ฌธ์ œ์š”์•ฝ ์—ญ์ˆœ์œผ๋กœ ์ €์žฅ๋œ ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ์˜ ํ•ฉ์„ ๊ตฌํ•˜์—ฌ๋ผ ์กฐ๊ฑด 1) ๋‘ ๊ฐœ์˜ ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ์˜ ๊ธธ์ด๋Š” 1 ์ด์ƒ ..

[LeetCode] 206. Reverse_Linked_List (Easy) 2023/5/5

๋ฌธ์ œ ์ œ๋ชฉ ์ •๋‹ต๋ฅ  ๋‚œ์ด๋„ 206. Reverse-Linked-List 73.7% Easy Reverse Linked List - LeetCode Can you solve this real interview question? 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] O leetcode.com ๋ฌธ์ œ์š”์•ฝ ๋‹จ์ผ ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ๋ฅผ ๋’ค์ง‘์–ด๋ผ ์กฐ๊ฑด 1) ๋‹จ์ผ ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ์˜ ํ—ค๋”๊ฐ€ ์ฃผ์–ด์ง„๋‹ค ์กฐ๊ฑด 2)..

[LeetCode] 21. Merge_Two_Sorted_Lists (Easy) 2023/5/5

๋ฌธ์ œ ์ œ๋ชฉ ์ •๋‹ต๋ฅ  ๋‚œ์ด๋„ 21. Merge-Two-Sorted-Lists 62.6% Easy Merge Two Sorted Lists - LeetCode Can you solve this real interview question? 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 leetcode.com ๋ฌธ์ œ์š”์•ฝ ์ •๋ ฌ๋˜์–ด ์žˆ๋Š” ๋‘ ๊ฐœ์˜ ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ๋ฅผ ํ•˜๋‚˜์˜ ์ •๋ ฌ๋œ ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ๋กœ ๋ณ‘ํ•ฉ..

[ํŒŒ์ด์ฌ ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ๊ฐœ๋…] 1-1. ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ - ๋Ÿฌ๋„ˆ

Runner ๊ธฐ๋ฒ• Runner ๊ธฐ๋ฒ•์€ '์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ์Šค๋Ÿฌ์šด' ํ’€์ด๋ฅผ ์œ„ํ•ด ์‚ฌ์šฉ๋˜๋ฉฐ ๋น ๋ฅธ ๋Ÿฌ๋„ˆ, ๋Š๋ฆฐ ๋Ÿฌ๋„ˆ 2๊ฐœ์˜ ํฌ์ธํ„ฐ๋ฅผ ์ด์šฉํ•œ๋‹ค. ๋น ๋ฅธ ๋Ÿฌ๋„ˆ(fast runner) : ๋Š๋ฆฐ ๋Ÿฌ๋„ˆ๋ณด๋‹ค 2๋ฐฐ ์•ž์„ ๋‹ค (๋‘ ์นธ์”ฉ ์ด๋™) ๋Š๋ฆฐ ๋Ÿฌ๋„ˆ(slow runner) : ๋น ๋ฅธ ๋Ÿฌ๋„ˆ๋ณด๋‹ค 2๋ฐฐ ๋Š๋ฆฌ๊ฒŒ ๋‚˜์•„๊ฐ„๋‹ค (ํ•œ ์นธ์”ฉ ์ด๋™) ๋น ๋ฅธ ๋Ÿฌ๋„ˆ๋Š” ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ์˜ ์•ž์ชฝ์˜ ๋…ธ๋“œ์˜ ์ ˆ๋ฐ˜์„ ๋ชฉ์ ์— ์•Œ๋งž์€ ์ƒˆ๋กœ์šด ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ๋ฅผ ๋งŒ๋“œ๋Š”๋ฐ, ๋Š๋ฆฐ ๋„ˆ๋Ÿฌ๋Š” ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ์˜ ๋’ค์ชฝ์˜ ๋…ธ๋“œ์˜ ์ ˆ๋ฐ˜์„ ๋น„๊ต๋ฅผ ์œ„ํ•ด ์‚ฌ์šฉํ•œ๋‹ค. (ํ”ํžˆ ์‚ฌ์šฉํ•˜๋Š” ํˆฌ ํฌ์ธํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๊ณผ ์ด์œ ๊ฐ€ ๋น„์Šทํ•˜๋‹ค) ์ž์„ธํ•œ ๊ฒฝ์šฐ์˜ ์ˆ˜๋ฅผ ์‚ดํŽด๋ณด์ž. ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ์˜ ๋…ธ๋“œ์˜ ์ˆ˜๊ฐ€ ํ™€์ˆ˜์ผ ๋•Œ ํ™€์ˆ˜์ผ ๋•Œ๋Š” ์„ธ ๊ฐ€์ง€ ๊ฒฝ์šฐ๋กœ ๋‚˜๋ˆ„์–ด์•ผ ํ•œ๋‹ค. โ‘  ๋น ๋ฅธ ๋Ÿฌ๋„ˆ๊ฐ€ ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ์˜ ๋…ธ๋“œ๋ฅผ ๋ฐฉ๋ฌธํ•˜๋Š” ๊ฒฝ์šฐ while(fast_runn..

728x90