## [Solutiuon] 8026. Construct Product Matrix Solution Leetcode

8026. Construct Product Matrix Solution Matrix User Accepted:1027 User Tried:3202 Total Accepted:1073 Total Submissions:7051 Difficulty:Medium Given a 0-indexed 2D integer matrix gridof size n * m, we define a 0-indexed 2D matrix p of size n * m as the product matrix of grid if the following condition is met: Each element p[i][j] is calculated as the product of all elements in grid except for the element grid[i][j]. This product is then taken modulo 12345. … Read more

## [SOLUTION] 100101. Find Indices With Index and Value Difference II Solution Leetcode

100101. Find Indices With Index and Value Difference II Solution Leetcode User Accepted:3190 User Tried:7200 Total Accepted:3258 Total Submissions:14770 Difficulty:Medium You are given a 0-indexed integer array nums having length n, an integer indexDifference, and an integer valueDifference. Your task is to find two indices i and j, both in the range [0, n – 1], that satisfy the following conditions: abs(i – j) >= indexDifference, and abs(nums[i] … Read more

## [solution] 100084. Shortest and Lexicographically Smallest Beautiful String  Solution Leetcode

100084. Shortest and Lexicographically Smallest Beautiful String  Solution Leetcode User Accepted:7442 User Tried:9861 Total Accepted:7648 Total Submissions:22638 Difficulty:Medium You are given a binary string s and a positive integer k. A substring of s is beautiful if the number of 1‘s in it is exactly k. Let len be the length of the shortest beautiful substring. Return the lexicographically smallest beautiful substring of string s with length equal to len. If s doesn’t contain a beautiful … Read more

## [SOLUTION] 100096. Find Indices With Index and Value Difference I Solution Leetcode

100096. Find Indices With Index and Value Difference I Solution Leetcode User Accepted:13291 User Tried:13874 Total Accepted:13792 Total Submissions:21422 Difficulty:Easy You are given a 0-indexed integer array nums having length n, an integer indexDifference, and an integer valueDifference. Your task is to find two indices i and j, both in the range [0, n – 1], that satisfy the following conditions: abs(i – j) >= indexDifference, and abs(nums[i] … Read more

## [SOLUTION] 100029. Count of Sub-Multisets With Bounded Sum Solution Leetcode

100029. Count of Sub-Multisets With Bounded Sum Solution Leetcode User Accepted:3 User Tried:35 Total Accepted:3 Total Submissions:62 Difficulty:Hard You are given a 0-indexed array nums of non-negative integers, and two integers l and r. Return the count of sub-multisets within nums where the sum of elements in each subset falls within the inclusive range of [l, r]. Since the answer may be large, return it modulo 109 + 7. A sub-multiset is … Read more

## [SOLUTION] 100077. Longest Unequal Adjacent Groups Subsequence II Solution Leetcode

100077. Longest Unequal Adjacent Groups Subsequence II Solution Leetcode User Accepted:24 User Tried:59 Total Accepted:24 Total Submissions:78 Difficulty:Medium You are given an integer n, a 0-indexed string array words, and a 0-indexed array groups, both arrays having length n. The hamming distance between two strings of equal length is the number of positions at which the corresponding characters are different. You need to select the longest subsequence from an … Read more

## [solution] 100078. Longest Unequal Adjacent Groups Subsequence I  Solution Leetcode

100078. Longest Unequal Adjacent Groups Subsequence I  Solution Leetcode User Accepted:53 User Tried:67 Total Accepted:54 Total Submissions:76 Difficulty:Medium You are given an integer n, a 0-indexed string array words, and a 0-indexed binary array groups, both arrays having length n. You need to select the longest subsequence from an array of indices [0, 1, …, n – 1], such that for the subsequence denoted as [i0, i1, …, ik … Read more

## [SOLUITION] 100095. Last Visited Integers Solution Leetcode

100095. Last Visited Integers Solution Leetcode User Accepted:5 User Tried:9 Total Accepted:5 Total Submissions:9 Difficulty:Easy Given a 0-indexed array of strings words where words[i] is either a positive integer represented as a string or the string “prev”. Start iterating from the beginning of the array; for every “prev” string seen in words, find the last visited integer in words which is defined as follows: Let k be the number of consecutive “prev” strings … Read more

## [SOLUTION] Count Total Number of Colored Cells Solution Leetcode

2579. Count Total Number of Colored Cells Solution Leetcode User Accepted:9591 User Tried:10482 Total Accepted:9965 Total Submissions:19152 Difficulty:Medium There exists an infinitely large two-dimensional grid of uncolored unit cells. You are given a positive integer n, indicating that you must do the following routine for n minutes: At the first minute, color any arbitrary unit cell blue. Every minute thereafter, … Read more

## [SOLUTION] Split With Minimum Sum Solution Leetcode

2578. Split With Minimum Sum Solution Leetcode User Accepted:9665 User Tried:10951 Total Accepted:9998 Total Submissions:15870 Difficulty:Easy Given a positive integer num, split it into two non-negative integers num1 and num2 such that: The concatenation of num1 and num2 is a permutation of num. In other words, the sum of the number of occurrences of each digit in num1 and num2 is equal to the number of occurrences of that … Read more