## Sherlock and Array

Watson gives Sherlock an array of integers. His challenge is to find an element of the array such that the sum of all elements to the left is equal to the sum of all elements to the right. Function Description Complete the balancedSums function in the editor below. balancedSums has the following parameter(s): int arr[n]: an array of integers Returns string: either YES or NO Input Format The first line contains , the number of test cases. The next pairs of lines each rep

## Maximum Subarray Sum

We define the following: A subarray of array a of length n is a contiguous segment from a[ i ] through a[ j ] where 0 <= i <= j < n. The sum of an array is the sum of its elements. Given an n element array of integers, a, and an integer, m , determine the maximum value of the sum of any of its subarrays modulo m. For example, Assume a = [1, 2, 3 ]and m = 2 . The following table lists all subarrays and their moduli: sum %2 [1] 1 1 [2] 2 0 [3] 3 1 [1,2] 3 1 [2,3] 5 1 [1,2

## Connected Cells in a Grid

Consider a matrix where each cell contains either a 0 or a 1. Any cell containing a 1 is called a filled cell. Two cells are said to be connected if they are adjacent to each other horizontally, vertically, or diagonally. In the following grid, all cells marked X are connected to the cell marked Y. XXX XYX XXX If one or more filled cells are also connected, they form a region. Note that each cell in a region is connected to zero or more cells in the region but is not necessarily dire

## Short Palindrome

Consider a string, , of lowercase English letters where each character, (, denotes the letter at index in . We define an palindromic tuple of to be a sequence of indices in satisfying the following criteria: , meaning the characters located at indices and are the same. , meaning the characters located at indices and are the same. , meaning that , , , and are ascending in value and are valid indices within string . Given , find and print the number of tuples satisfying the above

## Maximizing Mission Points

Xander Cage has a list of cities he can visit on his new top-secret mission. He represents each city as a tuple of . The values of , , and are distinct across all cities. We define a mission as a sequence of cities, , that he visits. We define the total of such a mission to be the sum of the of all the cities in his mission list. Being eccentric, he abides by the following rules on any mission: He can choose the number of cities he will visit (if any). He can start the mission from