New update is available. Click here to update.

Last Updated: 11 Mar, 2021

Difficulty: Easy

```
For the query of type 1, you can assume that the array has at least k values. And at any time, the product of any contiguous sequence of numbers will fit into a single 32-bit integer without overflowing.
```

```
The first line of the input contains ‘T’ denoting the number of test cases.
The first line of each test case contains ‘Q’ denoting the number of queries.
In the next Q lines input is either of the types :
0 X: insert element ‘X’ at the end array.
1 K: find the product of the last 'K' elements in the array.
```

```
For each test case, print a single line containing space-separated integers denoting answers of queries of type - 1.
The output of each test case will be printed in a separate line.
```

```
You do not need to print anything; it has already been taken care of. Just implement the given function.
```

```
1 <= T <= 3
0 <= X <= 100
0 <= QUERIES <=5000
1 <= K <= 5000
Where X denotes the value to be stored in the array.
Time limit: 1 sec.
```

SIMILAR PROBLEMS

Missing Number

Posted: 30 Oct, 2022

Difficulty: Easy

Longest Subarray With Zero Sum

Posted: 3 Nov, 2022

Difficulty: Moderate

Merge Two Sorted Arrays Without Extra Space

Posted: 19 Nov, 2022

Difficulty: Moderate

Ninja And The Strictly Increasing Array

Posted: 27 Nov, 2022

Difficulty: Moderate

Negative To The End

Posted: 16 Dec, 2022

Difficulty: Easy

Popular Interview Problems: