반응형 프로그래밍4 [LeetCode] 648. Replace Words ❓ProblemIn English, we have a concept called root, which can be followed by some other word to form another longer word - let's call this word derivative. For example, when the root "help" is followed by the word "ful", we can form a derivative "helpful".Given a dictionary consisting of many roots and a sentence consisting of words separated by spaces, replace all the derivatives in the sentence.. 2024. 6. 7. [LeetCode] 268. Missing Number 268. Missing NumberII ❓ProblemGiven an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array. Example 1:Input: nums = [3,0,1]Output: 2Explanation: n = 3 since there are 3 numbers, so all numbers are in the range [0,3]. 2 is the missing number in the range since it does not appear in nums.Example 2:Input: nums = [0,1]Outpu.. 2024. 5. 23. [LeetCode] 3152. Special Array II 3151. Special Array II ❓ProblemAn array is considered special if every pair of its adjacent elements contains two numbers with different parity.You are given an array of integer nums and a 2D integer matrix queries, where for queries[i] = [fromi, toi] your task is to check that subarray nums[fromi..toi] is special or not.Return an array of booleans answer such that answer[i] is true if nums[from.. 2024. 5. 23. [LeetCode] 3151. Special Array I 3151. Special Array I ❓ProblemAn array is considered special if every pair of its adjacent elements contains two numbers with different parity.You are given an array of integers nums. Return true if nums is a special array, otherwise, return false. Example 1:Input: nums = [1]Output: trueExplanation:There is only one element. So the answer is true.Example 2:Input: nums = [2,1,4]Output: trueExplan.. 2024. 5. 23. 이전 1 다음 728x90