Three of my accounts recently achieved the #1, #2 and #3 leetcode ratings in South Korea. lol 😂
Leetcode contest speed-run global rank 2nd
3213. Construct String with Minimum Cost
You are given a string
target
, an array of stringswords
, and an integer arraycosts
, both arrays of the same length.Imagine an empty string
s
.You can perform the following operation any number of times (including zero):
- Choose an index
i
in the range[0, words.length - 1]
.- Append
words[i]
tos
.- The cost of operation is
costs[i]
.Return the minimum cost to make
s
equal totarget
. If it’s not possible, return-1
.
3212. Count Submatrices With Equal Frequency of X and Y
Given a 2D character matrix
grid
, wheregrid[i][j]
is either'X'
,'Y'
, or'.'
, return the number of submatrices that contains:
grid[0][0]
- an equal frequency of
'X'
and'Y'
.- at least one
'X'
.
3211. Generate Binary Strings Without Adjacent Zeros
You are given a positive integer
n
.A binary string
x
is valid if all substrings ofx
of length 2 contain at least one"1"
.Return all valid strings with length
n
, in any order.
3210. Find the Encrypted String
You are given a string
s
and an integerk
. Encrypt the string using the following algorithm:
- For each character
c
ins
, replacec
with thekth
character afterc
in the string (in a cyclic manner).Return the encrypted string.