목록PS/LeetCode (576)
넘치게 채우기
https://leetcode.com/problems/last-moment-before-all-ants-fall-out-of-a-plank/description/ Last Moment Before All Ants Fall Out of a Plank - LeetCode Can you solve this real interview question? Last Moment Before All Ants Fall Out of a Plank - We have a wooden plank of the length n units. Some ants are walking on the plank, each ant moves with a speed of 1 unit per second. Some of the ants move ..
https://leetcode.com/problems/build-an-array-with-stack-operations/description/ 1) { for(int i = 0; i < to-from-1; i++) { operators.push_back("Push"); operators.push_back("Pop"); } } operators.push_back("Push"); } vector buildArray(vector& target, int n) { int lastNum = 0; for(int i = 0; i < target.size(); i++) { operate(lastNum, target[i]); lastNum = target[i]; } return operators; } };
https://leetcode.com/problems/count-nodes-equal-to-average-of-subtree/description/ Count Nodes Equal to Average of Subtree - LeetCode Can you solve this real interview question? Count Nodes Equal to Average of Subtree - Given the root of a binary tree, return the number of nodes where the value of the node is equal to the average of the values in its subtree. Note: * The average of n ele leetcod..
https://leetcode.com/problems/find-mode-in-binary-search-tree/description/ Find Mode in Binary Search Tree - LeetCode Can you solve this real interview question? Find Mode in Binary Search Tree - Given the root of a binary search tree (BST) with duplicates, return all the mode(s) [https://en.wikipedia.org/wiki/Mode_(statistics)] (i.e., the most frequently occurred element leetcode.com leetcode -..
https://leetcode.com/problems/find-the-original-array-of-prefix-xor/description/ Find The Original Array of Prefix Xor - LeetCode Can you solve this real interview question? Find The Original Array of Prefix Xor - You are given an integer array pref of size n. Find and return the array arr of size n that satisfies: * pref[i] = arr[0] ^ arr[1] ^ ... ^ arr[i]. Note that ^ denotes the b leetcode.co..
https://leetcode.com/problems/sort-integers-by-the-number-of-1-bits/description/ Sort Integers by The Number of 1 Bits - LeetCode Can you solve this real interview question? Sort Integers by The Number of 1 Bits - You are given an integer array arr. Sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more integ leetcode.com ..
https://leetcode.com/problems/poor-pigs/description/ leetcode - Poor Pigs 문제 유형 : 수학 / 조합 문제 난이도 : Hard 문제 There are buckets buckets of liquid, where exactly one of the buckets is poisonous. To figure out which one is poisonous, you feed some number of (poor) pigs the liquid to see whether they will die or not. Unfortunately, you only have minutesToTest minutes to determine which bucket is poiso..
https://leetcode.com/problems/count-vowels-permutation/description/ Count Vowels Permutation - LeetCode Can you solve this real interview question? Count Vowels Permutation - Given an integer n, your task is to count how many strings of length n can be formed under the following rules: * Each character is a lower case vowel ('a', 'e', 'i', 'o', 'u') * Each leetcode.com leetcode - Count Vowels Pe..
https://leetcode.com/problems/longest-palindromic-substring/ = 0 && right < s.size() && s[left] == s[right]) { left--; right++; } return right - left - 1; } string longestPalindrome(string s) { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); const int n = s.size(); int maxLen = 0; int start = 0; for (int i = 0; i < n; i++) { int len1 = expandAroundCenter(s, i, i); int len2 = expandAroundC..
https://leetcode.com/problems/binary-trees-with-factors/ Binary Trees With Factors - LeetCode Can you solve this real interview question? Binary Trees With Factors - Given an array of unique integers, arr, where each integer arr[i] is strictly greater than 1. We make a binary tree using these integers, and each number may be used for any number of leetcode.com leetcode - 823. Binary Trees With F..