전체 글 59

[BFS] Average of Levels in Binary Tree

이진 트리의 수준 평균 Average of Levels in Binary Tree - LeetCode Can you solve this real interview question? Average of Levels in Binary Tree - Given the root of a binary tree, return the average value of the nodes on each level in the form of an array. Answers within 10-5 of the actual answer will be accepted. Examp leetcode.com root이진 트리의 경우 각 수준의 노드 평균 값을 배열 형식으로 반환합니다 . 실제 답변 이내의 답변만 인정됩니다. 10-5 예시 ..

알고리즘 2023.09.08

[leetCode] Kth Smallest Element in a BST

BST의 K번째로 작은 요소 Kth Smallest Element in a BST - LeetCode Can you solve this real interview question? Kth Smallest Element in a BST - Given the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed) of all the values of the nodes in the tree. Example 1: [https://assets.leetco leetcode.com root이진 검색 트리의 와 정수가 주어 지면 트리에 있는 노드의 모든 값 중 가장 작은 값( 1-인덱스k )을 반환합니다 . kth..

알고리즘 2023.09.08

[Binary Search] Find Minimum in Rotated Sorted Array

회전 정렬 배열에서 최소값 찾기 Find Minimum in Rotated Sorted Array - LeetCode Can you solve this real interview question? Find Minimum in Rotated Sorted Array - Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become: * [4,5,6,7,0,1,2] if it leetcode.com n오름차순으로 정렬된 길이의 배열이 및 시간 사이에서 회전 된다고 가정합니다. 예를 들어 배열은 다음과 같을 수 ..

알고리즘 2023.09.04

[Divide & Conquer]Sort List

목록 정렬 Sort List - LeetCode Can you solve this real interview question? Sort List - Given the head of a linked list, return the list after sorting it in ascending order. Example 1: [https://assets.leetcode.com/uploads/2020/09/14/sort_list_1.jpg] Input: head = [4,2,1,3] Output: [1, leetcode.com head연결리스트의 경우 오름차순 으로 정렬한 후 목록을 반환합니다 . 예시 1: 입력: 헤드 = [4,2,1,3] 출력: [1,2,3,4] 예 2: 입력: 헤드 = [-1,5,3,4,0..

알고리즘 2023.09.04

[Hash Table] Ransom Note

랜섬노트 Ransom Note - LeetCode Can you solve this real interview question? Ransom Note - Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from magazine and false otherwise. Each letter in magazine can only be used once in ranso leetcode.com 두 개의 문자열 ransomNoteand 가 주어지면 magazine, trueif 는 and else ransomNote의 문자를 사용하여 구성될 수 있습니다 .magazinef..

알고리즘 2023.09.01

[Hash Table] Two Sum

투섬 Two Sum - LeetCode Can you solve this real interview question? Two Sum - Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not leetcode.com 정수 배열 nums 과 정수가 주어지면 두 숫자의 합이 가 되는 인덱스를target 반환합니다 .target 각 입력에는 정확히 하나의 솔루션이 있다고 가정할 수 있으며 동일한 요소를 두 번 ..

알고리즘 2023.08.31

[Stack] Min Stack

최소 스택 Min Stack - LeetCode Can you solve this real interview question? Min Stack - Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the MinStack class: * MinStack() initializes the stack object. * void push(int val) pushes t leetcode.com 푸시, 팝, 상단 및 일정한 시간에 최소 요소 검색을 지원하는 스택을 설계합니다. 클래스를 구현합니다 MinStack. MinStack()스택 개체를 초기화합니다. void push..

알고리즘 2023.08.31

[Binary Search] Search Insert Position

삽입 위치 검색 Search Insert Position - LeetCode Can you solve this real interview question? Search Insert Position - Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You must w leetcode.com 고유한 정수의 정렬된 배열과 대상 값이 주어지면 대상이 발견되면 인덱스를 반환합니다. 그렇지 않은 경우 순서대로 삽입되었을 경우의 인덱스를 반환합니다. O..

알고리즘 2023.08.28

[Linked List] Linked List Cycle

연결리스트 사이클 Linked List Cycle - LeetCode Can you solve this real interview question? Linked List Cycle - Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the list that can be reached again by continuo leetcode.com 연결된 목록의 선두인 가 주어 head지면 연결된 목록에 순환이 있는지 확인합니다. 포인터 를 계속 따라가면 다시 도달할 수 있는 노드가 목록에 있는 경우 연결..

알고리즘 2023.08.28

[Two Pointers] Valid Palindrome

유효한 회문 Valid Palindrome - LeetCode Can you solve this real interview question? Valid Palindrome - A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric cha leetcode.com 모든 대문자를 소문자 로 변환하고 영숫자가 아닌 모든 문자를 제거한 후 앞뒤로 동일하게 읽는 경우 구문은 회문 입니다. 영숫자 문자에는 문자와 숫자가 포함됩니다. 주어..

알고리즘 2023.08.28