New update is available. Click here to update.

Posted: 7 Nov, 2020

Difficulty: Moderate

```
A subsequence of an array/list is obtained by deleting some number of elements (can be zero) from the array/list, leaving the remaining elements in their original order.
```

```
The first line contains a single integer ‘T’ denoting the number of test cases.
The first line of each test case contains a single integer ‘N’ denoting the number of elements in the array.
The second line contains ‘N’ single space-separated integers denoting the elements of the array/list.
```

```
For each test case, print a single integer that denotes the maximum sum of the non-adjacent elements.
Print the 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 <= 500
1 <= N <= 1000
0 <= ARR[i] <= 10^5
Where 'ARR[i]' denotes the 'i-th' element in the array/list.
Time Limit: 1 sec.
```

SIMILAR PROBLEMS

Randomly Sorted

Posted: 13 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

8-Queen Problem

Posted: 19 Dec, 2022

Difficulty: Easy

Categories:

Popular Courses: