All Posts

Leetcode 1775: Equal Sum Arrays With Minimum Number of Operations

You are given two arrays, nums1 and nums2, with integers between 1 and 6. The lengths of the two arrays can differ. In one operation, you can change any element in either array to any value between 1 and 6. The task is to find the minimum number of operations required to make the sums of the two arrays equal. If it is not possible to make the sums equal, return -1.

Leetcode 1790: Check if One String Swap Can Make Strings Equal

You are given two strings, s1 and s2, of equal length. A string swap is an operation where you choose two indices in a string (not necessarily different) and swap the characters at these indices. Return true if it is possible to make both strings equal by performing at most one string swap on exactly one of the strings. Otherwise, return false.

Leetcode 1814: Count Nice Pairs in an Array

You are given an array of non-negative integers. A pair of indices (i, j) is nice if nums[i] + rev(nums[j]) equals nums[j] + rev(nums[i]). Return the number of nice pairs modulo 10^9 + 7.

Leetcode 1854: Maximum Population Year

You are given a 2D array logs where each entry represents the birth and death years of a person. You need to determine the earliest year that has the maximum population, where population is defined as the number of people alive in a given year.

Leetcode 1876: Substrings of Size Three with Distinct Characters

You are given a string s, and your task is to find the number of substrings of length 3 that contain no repeated characters. A substring is considered ‘good’ if all its characters are unique. Note that if a ‘good’ substring appears more than once, it should be counted multiple times.

Leetcode 1941: Check if All Characters Have Equal Number of Occurrences

Given a string s, determine if it is a ‘good’ string. A string is considered good if every character in it appears the same number of times.