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.
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.
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.
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.
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.