All Problems

Problem title

Difficulty

Avg time to solve

Strongly Connected Components (Tarjan’s Algorithm)

Hard

15 mins

Common Elements In Three Sorted Arrays

Moderate

35 mins

Minimize Cash Flow

Easy

15 mins

Rat In A Maze

Easy

15 mins

Shopping Options

Easy

--

Subarrays With Zero Sum

Easy

--

Sum Between Zeroes

Easy

20 mins

Diagonal Anagram

Moderate

20 mins

Palindrome Partitioning ll

Hard

40 mins

Second largest element in the array

Easy

15 mins

Problem

Submissions

22

Problem Statement

```
Let ‘ARR’ be: [1, 4, -5]
The subarray [1, 4, -5] has a sum equal to 0. So the count is 1.
```

```
The first line of input contains an integer ‘T’, denoting the number of test cases.
The first line of each test case contains an integer, ‘N’, representing the size of the array.
The second line of each test case contains ‘N’ space-separated integers, representing the array ‘ARR’ elements.
```

```
For each test case, print the sorted array.
Print output of each test case 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 <= 10
1 <= N <= 10^5
-10^5 <= ARR[i] <= 10^5
Time Limit: 1 sec
```

```
2
3
1 4 -5
4
-1 1 0 1
```

```
1
3
```

```
For test case 1:
The subarray [1, 4, -5] has a sum equal to 0.
So the count is 1.
For test case 2:
The subarray [-1, 1], [-1, 1, 0] and [0] has a sum equal to 0.
So the count is 3.
```

```
2
4
-1 0 1 -1
3
-2 0 2
```

```
4
2
```

Java (SE 1.8)

Console

Sample Test Case

Custom Test Case

Download Test Cases

Test Case 1

Test Case 2

Test Case 3

Full Screen Mode

Change Theme

Solution submission not allowed

Save Code

Reset Code