You are given a large number containing digits.If sum of digits in the number is odd than the number is considered good.You can do the following operation any number of times to make the given number good:
Operation -
Divide the number by .
Task :
Return the length of maximum possible good number from the given number, if a good number is not achievable then return .
Assumption :
Approach :
The sum of digits in is if we divide by , will be removed and sum of digits will become and length of becomes so the answer is
Function description:
Complete the function solve provided in the editor. This function takes the following two parameters and returns the required answer:
represents the number of digits in the given number.
represents the given number.
Input format :
Note: This is the input format that you must use to provide custom input (available above the Compile and Test button).
The first line contains denoting the number of test cases. also specifies the number of times you have to run the solve function on a different set of inputs.
For each test case, the first line contains the integer and second line contains the number .
Output format :
For each test case, print the length of good number obtained by using minimum number of operations.
Constraints:
Code snippets (also called starter code/boilerplate code)
This question has code snippets for C, CPP, Java, and Python.
The first line contains the number of test cases.
The first test case is explained in the above example in the question.
In the second test case, the number can't become a good number so answer is .