2nd Place on LC ContestRead more

Three of my accounts recently achieved the #1, #2 and #3 leetcode ratings in South Korea. lol 😂

Leetcode contest speed-run global rank 2nd

[LeetCode] Longest Common Suffix QueriesRead more

3093. Longest Common Suffix Queries

You are given two arrays of strings

`wordsContainer`

and`wordsQuery`

.For each

`wordsQuery[i]`

, you need to find a string from`wordsContainer`

that has thelongest common suffixwith`wordsQuery[i]`

. If there are two or more strings in`wordsContainer`

that share the longest common suffix, find the string that is thesmallestin length. If there are two or more such strings that have thesamesmallest length, find the one that occurredearlierin`wordsContainer`

.Return

an array of integers`ans`

, where`ans[i]`

is the index of the string in`wordsContainer`

that has thelongest common suffixwith`wordsQuery[i]`

.

[LeetCode] Most Frequent IDs
Read more

The problem involves tracking the frequency of IDs in a collection that changes over time. You have two integer arrays,

`nums`

and`freq`

, of equal length`n`

. Each element in`nums`

represents an ID, and the corresponding element in`freq`

indicates how many times that ID should be added to or removed from the collection at each step.

Addition of IDs:If`freq[i]`

is positive, it means`freq[i]`

IDs with the value`nums[i]`

are added to the collection at step`i`

.Removal of IDs:If`freq[i]`

is negative, it means`-freq[i]`

IDs with the value`nums[i]`

are removed from the collection at step`i`

.Return an array

`ans`

of length`n`

, where`ans[i]`

represents thecountof themost frequent IDin the collection after the`ith`

step. If the collection is empty at any step,`ans[i]`

should be 0 for that step.

[LeetCode] Apply Operations to Make Sum of Array Greater Than or Equal to kRead more

3091. Apply Operations to Make Sum of Array Greater Than or Equal to k

You are given a

positiveinteger`k`

. Initially, you have an array`nums = [1]`

.You can perform

anyof the following operations on the arrayanynumber of times (possibly zero):

- Choose any element in the array and
increaseits value by`1`

.- Duplicate any element in the array and add it to the end of the array.
Return

theminimumnumber of operations required to make thesumof elements of the final array greater than or equal to`k`

.

[LeetCode] Maximum Length Substring With Two OccurrencesRead more

3090. Maximum Length Substring With Two Occurrences

Given a string

`s`

, return themaximumlength of a substring such that it containsat most two occurrencesof each character.

Algolia