2024/04/244 leetcode 3065. Minimum Operations to Exceed Threshold Value I https://leetcode.com/problems/minimum-operations-to-exceed-threshold-value-i/description/ 12345class Solution: def minOperations(self, nums: List[int], k: int) -> int: answer = [1 if num 2024. 4. 24. leetcode 3069. Distribute Elements Into Two Arrays I https://leetcode.com/problems/distribute-elements-into-two-arrays-i/description/ 1 2 3 4 5 6 7 8 9 10 11 class Solution: def resultArray(self, nums: List[int]) -> List[int]: arr1 = [nums[0]] arr2 = [nums[1]] for i in range(2, len(nums)): if arr1[-1] > arr2[-1]: arr1.append(nums[i]) elif arr1[-1] 2024. 4. 24. leetcode 3079. Find the Sum of Encrypted Integers https://leetcode.com/problems/find-the-sum-of-encrypted-integers/description/ 12345678910class Solution: def sumOfEncryptedInt(self, nums: List[int]) -> int: answer = 0 for num in nums: str_num = str(num) max_digit = str(max(map(int, list(str_num)))) tmp_answer = int(max_digit * len(str_num)) answer += tmp_answer return answer Colored by Color Scriptercs 2024. 4. 24. leetcode 3083. Existence of a Substring in a String and Its Reverse https://leetcode.com/problems/existence-of-a-substring-in-a-string-and-its-reverse/description/ 12345678class Solution: def isSubstringPresent(self, s: str) -> bool: reverse_s = s[::-1] for i in range(1, len(s)): if reverse_s[i-1:i+1] in s: return True return Falsecs 2024. 4. 24. 이전 1 다음