Given strings `s1`

and `s2`

, return *the minimum contiguous substring part of *`s1`

*, so that *`s2`

* is a subsequence of the part*.

If there is no such window in `s1`

that covers all characters in `s2`

, return the empty string `""`

. If there are multiple such minimum-length windows, return the one with the **left-most starting index**.

**Example 1:**

**Input:** s1 = "abcdebdde", s2 = "bde"

**Output:** "bcde"

**Explanation:**

"bcde" is the answer because it occurs before "bdde" which has the same length.

"deb" is not a smaller window because the elements of s2 in the window must occur in order.

**…**

We are given a set of documents. Each document is submitted by a different individual. However, we suspect that some individuals may have copied from others. Given a plagiarized submitted document, we want to identify the number of documents with which there is a potential match. We have converted each document into a set of tokens based on their content. As mentioned previously, the students could have added dummy statements between the copied content to avoid identification. We’ll have to match the tokens of two students while taking into account that there can be dummy tokens that might not match…

Given an array of positive integers `nums`

and a positive integer `target`

, return the minimal length of a **contiguous subarray** `[numsl, numsl+1, ..., numsr-1, numsr]`

of which the sum is greater than or equal to `target`

. If there is no such subarray, return `0`

instead.

**Example 1:**

**Input:** target = 7, nums = [2,3,1,2,4,3]

**Output:** 2

**Explanation:** The subarray [4,3] has the minimal length under the problem constraint.

**Example 2:**

**Input:** target = 4, nums = [1,4,4]

**Output:** 1

**Example 3:**

**Input:** target = 11, nums = [1,1,1,1,1,1,1,1]

**Output:** 0

**Constraints:**

`1 <= target <= 109`

`1 <= nums.length …`

`Input: arr[] = {1, 3, 6, 10, 11, 15};`

Output: 2

Input: arr[] = {1, 1, 1, 1};

Output: 5

Input: arr[] = {1, 1, 3, 4};

Output: 10

Input: arr[] = {1, 2, 5, 10, 20, 40};

Output: 4

Input: arr[] = {1, 2, 3, 4, 5, 6};

Output: 22

**Solution:**

A **Simple Solution** is to start from value 1 and check all values one by one if they can sum to values in the given array. This solution is very inefficient.

Now let’s try to solve it in O(n).:

Given an array of integers `arr`

, you are initially positioned at the first index of the array.

In one step you can jump from an index `i`

to index:

`i + 1`

where:`i + 1 < arr.length`

.`i - 1`

where:`i - 1 >= 0`

.`j`

where:`arr[i] == arr[j]`

and`i != j`

.

Return *the minimum number of steps* to reach the **last index** of the array.

Notice that you can not jump outside of the array at any time.

**Example 1:**

**Input:** arr = [100,-23,-23,404,100,23,23,23,3,404]

**Output:** 3

**Explanation:** You need three jumps from index 0 --> 4 -->…

We need to develop a display structure for the list of participants attending a MS Teams meeting. As you know, the names of attendees in a MS Teams meeting are displayed in alphabetical order. However, attendees can join or leave a meeting at random, so the order has to be updated continuously. To tackle this issue, MS Team has decided to store the names of attendees in a binary search tree (BST). Additionally, we are specifically working on a meeting’s “Gallery Mode” display., where the participants’ names/videos are paginated (divided into pages that can be scrolled). …

For this feature, we want to suggest products customers can buy to make their orders eligible for free delivery. The minimum order amount to qualify for free shipping varies by customer location. When a customer views their cart and the current total does not qualify for free shipping, we want to show them a pair of products that can be bought together to make the total amount equal to the amount required to be eligible for free delivery. You can assume that it was a corporate decision to show a pair of products instead of a single product. Historical data…

We need to figure out a way to traverse the DOM structure that we obtain from a single web page. The HTML can be represented in a tree structure where the children of the HTML tag become the children of a node in the tree. Each level of the tree can have any number of nodes depending upon the number of nested HTML tags. We need to traverse the nodes in the tree level by level, starting at the root node.

A person has divided their workday into 15-minute time slots numbered as `1, 2, 3, ... n`

. People who want to schedule a meeting with this person choose any available time slot that suits them. Assume that this person’s calendar is now filled with jumbled-up numbers that represent the time slots reserved for meetings. Your task is to find out what the longest consecutive time period in which this person will be busy is.

The following illustration shows how we will be mapping the 15-minute time slots to the numbers given in the input: