본문 바로가기

Algorithm/자료구조

(126)
(C++, Rust) - LeetCode (easy) 933. Number of Recent Calls https://leetcode.com/problems/number-of-recent-calls/description/ Number of Recent Calls - LeetCode Can you solve this real interview question? Number of Recent Calls - You have a RecentCounter class which counts the number of recent requests within a certain time frame. Implement the RecentCounter class: * RecentCounter() Initializes the counter with ze leetcode.com 자료구조를 이용하거나 이분탐색을 사용해본 문제였습니..
(C++, Rust) - LeetCode (easy) 905. Sort Array By Parity https://leetcode.com/problems/sort-array-by-parity/description/ Sort Array By Parity - LeetCode Can you solve this real interview question? Sort Array By Parity - Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers. Return any array that satisfies this condition. Example 1: Input: leetcode.com 자료구조를 사용해보는 문제였습니다. 📕 풀이방법 📔 입력 및 초기..
(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 📕 풀이방법 📔 입..