All Posts

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 1880: Check if Word Equals Summation of Two Words

You are given three strings: ‘firstWord’, ‘secondWord’, and ’targetWord’. Each string contains only lowercase English letters from ‘a’ to ‘j’. The value of each letter corresponds to its position in the alphabet starting from ‘a’ as 0 (‘a’ -> 0, ‘b’ -> 1, …, ‘j’ -> 9). The value of a string is the concatenation of the values of its letters, which is then interpreted as an integer. Your task is to check if the sum of the values of ‘firstWord’ and ‘secondWord’ equals the value of ’targetWord’. Return true if it does, and false otherwise.

Leetcode 1886: Determine Whether Matrix Can Be Obtained By Rotation

You are given two n x n binary matrices mat and target. Your task is to determine if it is possible to rotate the matrix mat in 90-degree increments so that it matches the target matrix.

Leetcode 1893: Check if All the Integers in a Range Are Covered

You are given a list of integer ranges and two integers, left and right. Each range is represented by a pair of integers [start, end]. You need to determine if all integers from left to right (inclusive) are covered by at least one of these ranges. An integer x is considered covered by a range [start, end] if start <= x <= end.

Leetcode 1903: Largest Odd Number in String

You are given a string num, which represents a large integer. Your task is to find the largest odd integer that can be formed from any non-empty substring of num. If no odd integer exists, return an empty string.

Leetcode 1913: Maximum Product Difference Between Two Pairs

Given an integer array nums, your goal is to select four distinct indices w, x, y, and z such that the product difference between two pairs of numbers, (nums[w], nums[x]) and (nums[y], nums[z]), is maximized. The product difference is defined as (nums[w] * nums[x]) - (nums[y] * nums[z]). Return the maximum product difference between these two pairs.