Leet code problem 1913: – Maximum Product Difference Between Two Pairs

The product difference between two pairs (a, b) and (c, d) is defined as (a * b) – (c * d). Given an integer array nums, choose four distinct indices w, x, y, and z such that the product difference between pairs (nums[w], nums[x]) and (nums[y], nums[z]) is maximized. Return the maximum such product difference….

Leet code problem 1930: – Unique Length-3 Palindromic Subsequences

Given a string s, return the number of unique palindromes of length three that are a subsequence of s. Note that even if there are multiple ways to obtain the same subsequence, it is still only counted once. A palindrome is a string that reads the same forwards and backwards. A subsequence of a string…

Leet code problem 1805: – Number of Different Integers in a String

You are given a string word that consists of digits and lowercase English letters. You will replace every non-digit character with a space. For example, “a123bc34d8ef34″ will become ” 123 34 8 34″. Notice that you are left with some integers that are separated by at least one space: “123”, “34”, “8”, and “34”. Return…

Leet code 1796: – Second Largest Digit in a String

Given an alphanumeric string s, return the second largest numerical digit that appears in s, or -1 if it does not exist. An alphanumeric string is a string consisting of lowercase English letters and digits. Example 1: Input: s = “dfa12321afd”Output: 2Explanation: The digits that appear in s are [1, 2, 3]. The second largest…