New update is available. Click here to update.

Posted: 27 Apr, 2021

Difficulty: Hard

```
0 x y
```

```
1 x y
```

```
2 x y
```

```
The first line of the test case contains a single integer ‘N’ denoting the size of the ‘arr’ array.
The second line of each test case contains ‘N’ space-separated integers denoting the elements array ‘arr’.
The third line of each test case contains an integer ‘q’ denoting the number of queries.
The next ‘q’ lines of each test case contain 3 space-separated integers denoting the following:
0 x y - modify the number at index x to y.
1 x y - count the number of even numbers in range x to y inclusive.
2 x y - count the number of odd numbers in range x to y inclusive.
```

```
For each query, print an integer denoting the answer.
The output of each query will be printed in a separate line.
```

```
1 <= N, Q <= 10^5
0 <= l <= r <= N - 1
0 <= arr[i] <= 10 ^ 9
1 <= x <= N
0 <= y <= 10 ^ 9
Where 'arr[i]' denotes the 'ith' element of arr.
Time limit: 1 sec
```

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

SIMILAR PROBLEMS

Ninja Land

Posted: 1 Jul, 2021

Difficulty: Ninja

Ninja Land

Posted: 1 Jul, 2021

Difficulty: Ninja

Ninja Land

Posted: 1 Jul, 2021

Difficulty: Ninja

Sum of Shadows

Posted: 16 Sep, 2021

Difficulty: Moderate

Chocolate and Sweetness

Posted: 9 Oct, 2021

Difficulty: Hard

Chocolate and Sweetness

Posted: 9 Oct, 2021

Difficulty: Hard

Range Minimum Query

Posted: 2 Nov, 2021

Difficulty: Hard

Ninja and Tree

Posted: 5 Feb, 2022

Difficulty: Ninja

Popular Interview Problems: