분류 전체보기 (174) 썸네일형 리스트형 [Leetcode] 961. N-Repeated Element in Size 2N Array https://leetcode.com/problems/n-repeated-element-in-size-2n-array class Solution: def repeatedNTimes(self, nums: List[int]) -> int: for i in nums: if nums.count(i) > 1: return i return -1 [Leetcode] 2670. Find the Distinct Difference Array https://leetcode.com/problems/find-the-distinct-difference-array/ class Solution: def distinctDifferenceArray(self, nums: List[int]) -> List[int]: result = [] for i in range(len(nums)): result.append(len(set(nums[:i+1])) - len(set(nums[i+1:]))) return result [Leetcode] 1207. Unique Number of Occurrences https://leetcode.com/problems/unique-number-of-occurrences Unique Number of Occurrences - LeetCode Can you solve this real interview question? Unique Number of Occurrences - Given an array of integers arr, return true if the number of occurrences of each value in the array is unique or false otherwise. Example 1: Input: arr = [1,2,2,1,1,3] Output: tr leetcode.com class Solution: def uniqueOccurr.. [Leetcode] 1941. Check if All Characters Have Equal Number of Occurrences https://leetcode.com/problems/check-if-all-characters-have-equal-number-of-occurrences/ Check if All Characters Have Equal Number of Occurrences - LeetCode Can you solve this real interview question? Check if All Characters Have Equal Number of Occurrences - Given a string s, return true if s is a good string, or false otherwise. A string s is good if all the characters that appear in s have the.. [Leetcode] 1748. Sum of Unique Elements https://leetcode.com/problems/sum-of-unique-elements class Solution: def sumOfUnique(self, nums: List[int]) -> int: unique = [] for i in nums[:]: if nums.count(i) == 1: unique.append(i) sum = 0 for i in unique: sum += i return sum [Leetcode] 2405. Optimal Partition of String class Solution: def partitionString(self, s: str) -> int: substrings = [] sub = '' for n in s: if n in sub: substrings.append(sub) sub = n else: sub += n substrings.append(sub) return len(substrings) https://leetcode.com/problems/optimal-partition-of-string Optimal Partition of String - LeetCode Can you solve this real interview question? Optimal Partition of String - Level up your coding skills.. [Leetcode] 2215. Find the Difference of Two Arrays https://leetcode.com/problems/find-the-difference-of-two-arrays Find the Difference of Two Arrays - LeetCode Can you solve this real interview question? Find the Difference of Two Arrays - Given two 0-indexed integer arrays nums1 and nums2, return a list answer of size 2 where: * answer[0] is a list of all distinct integers in nums1 which are not present in nums2 leetcode.com class Solution: def.. [Leetcode] 2418. Sort the People https://leetcode.com/problems/sort-the-people Sort the People - LeetCode Can you solve this real interview question? Sort the People - You are given an array of strings names, and an array heights that consists of distinct positive integers. Both arrays are of length n. For each index i, names[i] and heights[i] denote the name leetcode.com class Solution: def sortPeople(self, names: List[str], h.. 이전 1 ··· 6 7 8 9 10 11 12 ··· 22 다음