All Posts

Leetcode 2815: Max Pair Sum in an Array

You are given an integer array nums, and you need to find the maximum sum of any two distinct numbers in the array such that the largest digit in both numbers is the same.

Leetcode 2830: Maximize the Profit as the Salesman

You are a salesman with n houses placed on a number line, numbered from 0 to n-1. You are given a list of offers where each offer is of the form [start, end, gold], indicating that a buyer wants to purchase all houses from index start to end (inclusive) for gold amount of gold. Your task is to maximize your total earnings by strategically selecting offers such that no two buyers purchase the same house.

Leetcode 2831: Find the Longest Equal Subarray

You are given a list of integers nums and an integer k. Your task is to find the length of the longest subarray where all the elements are equal after you delete at most k elements.

Leetcode 2840: Check if Strings Can be Made Equal With Operations II

You are given two strings s1 and s2, both of length n, consisting of lowercase English letters. You can perform the following operation on any of the two strings: choose any two indices i and j such that i < j and the difference j - i is even, then swap the two characters at those indices in the string. Return true if you can make s1 and s2 equal, and false otherwise.

Leetcode 2841: Maximum Sum of Almost Unique Subarray

You are given an integer array nums and two positive integers m and k. Return the maximum sum out of all almost unique subarrays of length k in nums. A subarray is almost unique if it contains at least m distinct elements. If no such subarray exists, return 0.

Leetcode 2845: Count of Interesting Subarrays

You are given an array of integers ’nums’, a positive integer ‘modulo’, and a non-negative integer ‘k’. Your task is to count the number of subarrays in ’nums’ that are interesting. A subarray ’nums[l..r]’ is interesting if the count of elements ’nums[i]’ such that ’nums[i] % modulo == k’ satisfies the condition ‘cnt % modulo == k’. Return the total count of such interesting subarrays.