본문 바로가기

Algorithm/자료구조

(108)
(C++, Rust) - LeetCode (easy) 897. Increasing Order Search Tree https://leetcode.com/problems/increasing-order-search-tree/description/ Increasing Order Search Tree - LeetCode Can you solve this real interview question? Increasing Order Search Tree - Given the root of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only o leetcode.com tree 순회 문제였습니다. ..
(C++) - LeetCode (easy) 222. Count Complete Tree Nodes https://leetcode.com/problems/count-complete-tree-nodes/description/ Count Complete Tree Nodes - LeetCode Can you solve this real interview question? Count Complete Tree Nodes - Given the root of a complete binary tree, return the number of the nodes in the tree. According to Wikipedia [http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees], every lev leetcode.com 재귀를 이용한 tree 순회 문제였습니다..
(C++) - LeetCode (easy) 884. Uncommon Words from Two Sentences https://leetcode.com/problems/uncommon-words-from-two-sentences/description/ Uncommon Words from Two Sentences - LeetCode Can you solve this real interview question? Uncommon Words from Two Sentences - A sentence is a string of single-space separated words where each word consists only of lowercase letters. A word is uncommon if it appears exactly once in one of the sentences leetcode.com 자료구조를 ..
(C++) - LeetCode (easy) 771. Jewels and Stones https://leetcode.com/problems/jewels-and-stones/ Jewels and Stones - LeetCode Can you solve this real interview question? Jewels and Stones - You're given strings jewels representing the types of stones that are jewels, and stones representing the stones you have. Each character in stones is a type of stone you have. You want to kno leetcode.com 자료구조를 이용한 전수조사 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 보석의 종류를 O..
(C++) - LeetCode (easy) 706. Design HashMap https://leetcode.com/problems/design-hashmap/description/ Design HashMap - LeetCode Can you solve this real interview question? Design HashMap - Design a HashMap without using any built-in hash table libraries. Implement the MyHashMap class: * MyHashMap() initializes the object with an empty map. * void put(int key, int value) inserts a ( leetcode.com map을 사용하는 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 class내 m..
(C++) - LeetCode (easy) 703. Kth Largest Element in a Stream https://leetcode.com/problems/kth-largest-element-in-a-stream/description/ Kth Largest Element in a Stream - LeetCode Can you solve this real interview question? Kth Largest Element in a Stream - Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. Implement KthLargest class: leetcode.com 📕 풀이방법 📔 입..
(C++) - LeetCode (easy) 697. Degree of an Array https://leetcode.com/problems/degree-of-an-array/description/ Degree of an Array - LeetCode Can you solve this real interview question? Degree of an Array - Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your task is to find the smallest possible leng leetcode.com 자료구조를 이용한 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 ..
(C++) - LeetCode (easy) 671. Second Minimum Node In a Binary Tree https://leetcode.com/problems/second-minimum-node-in-a-binary-tree/description/ Second Minimum Node In a Binary Tree - LeetCode Can you solve this real interview question? Second Minimum Node In a Binary Tree - Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. If the node has two sub leetcode.com ..