All Posts

Leetcode 1850: Minimum Adjacent Swaps to Reach the Kth Smallest Number

You are given a string num, representing a large integer, and an integer k. Return the minimum number of adjacent swaps required to transform num into the k-th smallest wonderful integer that is greater than num and is a permutation of its digits.

Leetcode 1859: Sorting the Sentence

You are given a shuffled sentence where each word is tagged with a number that represents its position in the original sentence. Your task is to reconstruct the sentence in its original order and return it.

Leetcode 1869: Longer Contiguous Segments of Ones than Zeros

You are given a binary string s. Your task is to determine whether the longest contiguous segment of 1’s is strictly longer than the longest contiguous segment of 0’s. Return true if this condition holds, otherwise return false.

Leetcode 1871: Jump Game VII

You are given a binary string s and two integers minJump and maxJump. Initially, you are at index 0 of the string s, which is guaranteed to be ‘0’. You can move from index i to index j if: i + minJump <= j <= min(i + maxJump, s.length - 1), and s[j] == ‘0’. Return true if it’s possible to reach the last index of the string (s.length - 1), or false otherwise.

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.