Corner Digits Sum
Basic Accuracy: 36.49% Submissions: 373 Points: 1

Given a number N, find the sum of first and last digit of N.

Example 1:

Input: N = 12345
Output: 6
Explanation: 1st and last digits are 1 and 5.

Example 2:

Input: 98562
Output: 11
Explanation: 1st and last digits are 9 and 2. 


Your Task:
You don't need to read or print anything. Your task is to complete the function corner_digitSum() which takes N as input parameter and returns the sum of first and last digit of N.


Expect Time Compelxity: O(log10(N))
Expected Space Complexity: O(1)

1 <= N <= 109

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Corner Digits Sum

Output Window