**1.** **Task Queue**

Task queues, which allow for asynchronous performance, are an important part of modern processing architectures. Information about a system consisting of several batch processing queues is given.

Each queue has three parameters:

- the maximum number of tasks it can process in a single batch.
- the time it takes to process a single batch of tasks in that queue
- the number of tasks the queue must process

Given this information. calculate the minimum time needed to process a set of tasks by the system.

**Example**

n = 2

batchSize = [4,3]

processingTime = [6,5]

numTasks = [8,8]

Queue 0 can process a max of 4 tasks in 6 minutes, and queue 1 can process a max of 3 tasks in 5 minutes. Each queue has 8 tasks to process. The time required to perform the assigned tasks in the minimu possible time is calculated as follows:

**For queue 0:**

- At time = 0, a new batch of 4 tasks is initiated
- At time = 6, the first batch of tasks is processed and a new batch of 4 tasks is initiated.
- At time = 12, the second batch of tasks is processed. There are no more tasks left to process

**For queue 1:**

- At time=0, a new batch of 3 tasks is initiated.
- At time = 5, the first batch of tasks is processed and a new batch of 3 tasks is initiated
- At time = 10, the second batch of tasks is processed and a new batch of 2 tasks is initiated.

The min time to process all tasks is 15

**Constraints:**

- 1 <= n <= 10^5
- 1 <= batchSize[i] <= 10^9
- 1 <= processingTime[i] <= 10^5
- 1 <= numTasks[i] <= 10^9

**2.** **Picking Tickets**

Consider an array of *n* ticket prices, *tickets*. A number, *m*, is defined as the size of some subsequences, *s*, of tickets where each element covers an unbroken raneg of integers. That is to say, if you were to sort the elements in *s*, the absolute difference between any elements *j* and *j+1* would be either *0* or *1*. Determine the maimum length of a subsequence chosen from the *tickets* array

**Example**

tickets = [8, 5, 4, 8, 4]

Valid subsequences, sorted, are {4,4,5} and {8,8}. These subsequences have *m* values of 3 and 2, respectively. Return 3.

**Constraints**

- 1 <= n <= 10^5
- 1 <= tickets[i] <= 10^9

**3.** **Arranging Numbers**

Jayme has a list of consecutive numbers beginning with 1. Her arrangement of those numbers is called a *beautiful* arrangement if at least one of the following is true:

- The number present at the
*ith* position is divisible by *i*
*i* is divisible by the number present at the *ith* position.

Determine how many beautiful arrangements of her integers is possible. For example, she has n =5 integers, [1,2,3,4,5]. Using **1-based** indexing, there are the following arrangements satisfying the above:

```
[1,2,3,4,5]
[2,1,3,4,5]
[3,2,1,4,5]
[4,2,3,1,5]
[5,2,3,4,1]
[4,1,3,2,5]
[1,4,3,2,5]
[3,4,1,2,5]
[2,4,3,1,5]
[5,4,3,2,1]
```

In the first row, both conditions hold for all elements: each *i* equals the value at index *i*, so each *i* is divisible by the element and each element is divisible by its index *i*. In the next row, where the first two elements have been switched, where *i = 1* and value is 2, *2* is divisible by *i*. In the next position, index *i=2* is divisible by its element value of *1*. Similar logic is applied to form each of the subsequent rows.

**Constraints**