Left Most Digit of a product
Submissions: 235   Accuracy:

32.77%

  Difficulty: Easy   Marks: 2

You will be given an array A[ ] of positive integers, the task is to find the left most digit of the product of the numbers in this array.
 

Input:
The first line of input contains a single integer T denoting the number of test cases.
Then T test cases follow. The first line of each test case consists of N, the size of the array. In the next line are N space separated positive integers which are in array A[ ].

 

Output:
Corresponding to each test case, in a new line, print the left most digit of the product of the numbers in the array A[ ].

 

Constraints:
1 ≤ T ≤ 100
1 ≤ N ≤ 100
1 ≤ A[i] ≤ 1010

 

Example:

Input
1
4
872 742 72578 7857

Output
3

 

** For More Input/Output Examples Use 'Expected Output' option **

Author: Hemang Sarkar


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.