All Posts

Leetcode 1604: Alert Using Same Key-Card Three or More Times in a One Hour Period

Employees use key-cards to unlock office doors, and the system records the time of each use. An alert is triggered if a worker uses their key-card three or more times within a one-hour period.

Leetcode 1624: Largest Substring Between Two Equal Characters

Given a string s, find the length of the longest substring between two equal characters, excluding the two characters themselves. If no such substring exists, return -1.

Leetcode 1630: Arithmetic Subarrays

A sequence of numbers is called arithmetic if it consists of at least two elements, and the difference between every two consecutive elements is the same. Given an array of integers nums and two arrays l and r representing m range queries, determine whether the subarray nums[l[i], ..., r[i]] can be rearranged to form an arithmetic sequence.

Leetcode 1638: Count Substrings That Differ by One Character

Given two strings s and t, count the number of ways to choose a non-empty substring of s and replace exactly one character such that the resulting substring becomes a substring of t. In other words, find how many substrings in s differ from substrings in t by exactly one character.

Leetcode 1647: Minimum Deletions to Make Character Frequencies Unique

Given a string s, determine the minimum number of deletions needed to make s ‘good’. A string is ‘good’ if no two characters have the same frequency.

Leetcode 1656: Design an Ordered Stream

You are given a stream of n (id, value) pairs, where id is an integer between 1 and n, and value is a string. The task is to design a stream that returns the values in increasing order of their id. After each insertion, the stream should return the largest possible chunk of values that appear next in the order.