
Sum of Even & Odd Digits
You need to determine the sum of even digits and odd digits separately from a given integer.
Input:
The first line of input is an integer T
representing the number of test cases. Each test case consists of a single line with an integer N
.
Output:
For each test case, output two space-separated integers: the sum of even digits and the sum of odd digits, respectively.
Example:
Input:
2
13245
2468
Output:
6 9
20 0
Constraints:
1 <= T <= 5
0 <= N <= 10^{18}
Note:
You do not need to print anything yourself. Just implement the function to return the required values.


Given an integer, find the sum of even and odd digits separately.
Iterate through each digit of the integer and check if it is even or odd
Keep track of the sum of even and odd digits separately
Return t...read more

We can also follow this approach: first perform mergeSort
Then do run a loop on sorted array and and for every index value find the required value by target - arr[i] ,
Then for evry required value -You...read more

Top Delta Air Lines SDE-2 interview questions & answers
Popular interview questions of SDE-2
Reviews
Interviews
Salaries
Users/Month