Leetcode

1695. Maximum Erasure Value

Understanding the Problem Given an array of integers nums, our task is to find the maximum sum of a contiguous subarray containing only unique elements. Approach We can solve this problem using a sliding window approach. We’ll maintain two pointers, start and end, to define the current subarray. Additionally, we’ll use a HashSet to keep…

Leetcode

49. Group Anagrams

Understanding the Problem Given an array of strings strs, our task is to group the strings that are anagrams of each other together and return them as a list of lists. Approach To efficiently group anagrams, we can leverage the properties of anagrams. Two strings are anagrams of each other if they have the same…