is-power-of-two.hashnode.devLeetCode: Contains Duplicate IIProblem: https://leetcode.com/problems/contains-duplicate-ii/ Code: class Solution: def containsNearbyDuplicate(self, nums: List[int], k: int) -> bool: # window = k seen_in_window = set() for i in range(len(nums)): ...Jan 9·2 min read
is-power-of-two.hashnode.devLeetCode: Rearrange Array Elements by SignProblem: https://leetcode.com/problems/rearrange-array-elements-by-sign/ Code: class Solution: def rearrangeArray(self, nums: List[int]) -> List[int]: non_neg_nums = [] neg_nums = [] result = [] # Segregated non-n...Dec 26, 2025·2 min read
is-power-of-two.hashnode.devGeeksForGeeks: Array LeadersProblem: https://www.geeksforgeeks.org/problems/leaders-in-an-array-1587115620/1 Code: class Solution: def leaders(self, arr): leads = [] n = len(arr) maximum = arr[-1] # till will handle negatives # we will colle...Dec 26, 2025·2 min read
is-power-of-two.hashnode.devLeetCode: Intersection of Two ArraysProblem: https://leetcode.com/problems/intersection-of-two-arrays/ Code: class Solution: def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]: result = set() n2 = set(nums2) for num in nums1: ...Dec 24, 2025·2 min read
is-power-of-two.hashnode.devLeetCode: Repeated Substring PatternProblem: https://leetcode.com/problems/repeated-substring-pattern/ Code: class Solution: def repeatedSubstringPattern(self, s: str) -> bool: return s in (s + s)[1:-1] # Points to note: # - A repeated string will reappear ...Dec 22, 2025·4 min read