The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 406 Weeks Ago, 2 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
7
Problem # 7
A number is called a palindrome when it is the same when read from left to right and right to left.
Your task is, given a number K (of less than 106 digits), to find the smallest palindrome that is
larger than K.
Note : The number of digits (i.e. length) of number K can be at max 106 .
7.1
Input Specification
Integer N followed by N test cases. Each test case consists of a single line containing the number
K.
7.2
Output Specification
For each test case output the palindrome on separate line.
7.3
Sample Input
3
2133
4587
99
7.4
Sample Output
2222
4664
101
8
Problem # 8
Given an array of integers, A, find a contiguous sequence in the array which has the maximum sum.
Output the maximum sum.
8.1
Input Specification
Integer N followed by N test cases. Each test case consists of two lines, first line contains an integer
NA (size of the array A) and the second line contains the array A in space separated format.
8.2
Output Specification
For each test case output the maximum sum on separate line.
5
8.3
Sample Input
2
5
10 -2 -3 13 -8
6
12 -23 13 -5 4 2
8.4
Sample Output
18
14
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll