Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 5761 |

@blackshadows | 5715 |

@akhayrutdinov | 5111 |

@mb1973 | 4989 |

@Quandray | 4944 |

@saiujwal13083 | 4506 |

@sanjay05 | 3762 |

@marius_valentin_dragoi | 3516 |

@sushant_a | 3459 |

@verma_ji | 3341 |

@KshamaGupta | 3318 |

Complete Leaderboard | |

Handle | Score |

@aroranayan999 | 1115 |

@bt8816103042 | 739 |

@thealchemist627 | 456 |

@dalwainazism125 | 453 |

@akashkale117 | 453 |

@shivanandp12345678910 | 453 |

@codeantik | 448 |

@SherlockHolmes3 | 447 |

@SHOAIBVIJAPURE | 430 |

@shalinibhataniya1097 | 408 |

@ShamaKhan1 | 392 |

Complete Leaderboard |

Given an array of integers A. A subsequence of A is called Bitonic if it is first increasing then decreasing.

**Input:**

The first line contains an integer T denoting the no of test cases. Each test case consist of two lines. The first line contains an integer N denoting the size of the array. Then in the next line are N space separated values of the array A[].

**Output:**

For each test case in a new line print the max sum bitonic subsequence.

**Constraints:**

1<=T<=100

1<=N<=50

1<=A[]<=100

**Example:
Input:**

2

6

80 60 30 40 20 10

9

1 15 51 45 33 100 12 18 9

**Output:**

210

194

**Explanation:
Testcase2:**

Bi-tonic Sub-sequence are :

{1, 51, 9}

{1, 50, 100, 18, 9}

{1, 15, 51, 100, 18, 9}

{1, 15, 45, 100, 12, 9}

{1, 15, 45, 100, 18, 9} .. so on

Maximum sum Bi-tonic sub-sequence is 1 + 15 + 51 + 100 + 18 + 9 =

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Maximum Sum Bitonic Subsequence

...