## Problem

Given an array of **distinct** integers `nums`

and a target integer `target`

, return *the number of possible combinations that add up to* `target`

.

The answer is **guaranteed** to fit in a **32-bit** integer.

0%

Given a `matrix`

and a `target`

, return the number of non-empty submatrices that sum to target.

A submatrix `x1, y1, x2, y2`

is the set of all cells `matrix [x][y]`

with `x1 <= x <= x2`

and `y1 <= y <= y2`

.

Two submatrices `(x1, y1, x2, y2)`

and `(x1', y1', x2', y2')`

are different if they have some coordinate that is different: for example, if `x1 != x1'`

.

You are given a string `s`

and an integer `k`

, a `k`

**duplicate removal** consists of choosing `k`

adjacent and equal letters from `s`

and removing them, causing the left and the right side of the deleted substring to concatenate together.

We repeatedly make `k`

**duplicate removals** on `s`

until we no longer can.

Return the final string after all such duplicate removals have been made. It is guaranteed that the answer is unique.

You are given a nested list of integers `nestedList`

. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an iterator to flatten it.

Implement the `NestedIterator`

class:

`NestedIterator (List<NestedInteger> nestedList)`

Initializes the iterator with the nested list`nestedList`

.`int next ()`

Returns the next integer in the nested list.`boolean hasNext ()`

Returns`true`

if there are still some integers in the nested list and`false`

otherwise.

Given two integers `n`

and `k`

, construct a list `answer`

that contains `n`

different positive integers ranging from `1`

to `n`

and obeys the following requirement:

- Suppose this list is
`answer = [a1, a2, a3, ... , an]`

, then the list`[|a1 - a2|, |a2 - a3|, |a3 - a4|, ... , |an-1 - an|]`

has exactly`k`

distinct integers.

Return *the list* `answer`

. If there multiple valid answers, return **any of them**.