All Posts
Leetcode 1663: Smallest String With A Given Numeric Value
n
and k
. Your task is to return the lexicographically smallest string of length n
with a numeric value equal to k
. The numeric value of a string is the sum of the numeric values of its characters, where ‘a’ = 1, ‘b’ = 2, …, and ‘z’ = 26.
You are given two integers Leetcode 1668: Maximum Repeating Substring
sequence
and word
. A string word
is considered ‘k-repeating’ in sequence
if word
concatenated k
times forms a substring of sequence
. The task is to return the maximum value of k
such that word
repeated k
times appears as a substring in sequence
. If no such substring exists, return 0.
You are given two strings: Leetcode 1678: Goal Parser Interpretation
command
consisting of the characters ‘G’, ‘()’, and ‘(al)’ in some order. The Goal Parser interprets the following patterns: ‘G’ as the string ‘G’, ‘()’ as the string ‘o’, and ‘(al)’ as the string ‘al’. Return the interpreted string after replacing all instances of ‘()’, ‘(al)’, and ‘G’ according to the above rules.
You are given a string Leetcode 1684: Count the Number of Consistent Strings
allowed
consisting of distinct characters, and an array of strings words
. A string is consistent if all characters in the string appear in the string allowed
. Return the number of consistent strings in the array words
.
You are given a string Leetcode 1694: Reformat Phone Number
You are given a phone number as a string. The string consists of digits, spaces, and/or dashes. Your task is to reformat the phone number by removing spaces and dashes, then grouping the digits into blocks of length 3 until there are at most 4 digits left. Afterward, follow specific grouping rules for the remaining digits and join the blocks with dashes.
Leetcode 1702: Maximum Binary String After Change
You are given a binary string consisting of only ‘0’s and ‘1’s. You can perform two types of operations on this string any number of times:
- Operation 1: Replace any occurrence of the substring ‘00’ with ‘10’.
- Operation 2: Replace any occurrence of the substring ‘10’ with ‘01’.
Your goal is to apply these operations and transform the binary string into the largest possible binary string in terms of its decimal value. A string ‘x’ is considered larger than string ‘y’ if the decimal value of ‘x’ is greater than that of ‘y’.