P21821 [GeeksforGeeks] Confused pappu5749
普及-
题目描述

Pappu is confused between 6 & 9. He works in the billing department of abc company and his work is to return the remaining amount to the customers. If the actual remaining amount is given we need to find the maximum possible extra amount given by the pappu to the customers.
Example 1:
Input: amount = 56
Output: 3
Explanation: maximum possible extra
amount = 59 - 56 = 3.
Example 2:
Input: amount = 66
Output: 33
Explanation: maximum possible extra
amount = 99 - 66 = 33.
User Task:
Your task is to complete the function findDiff() which takes single argument(amount) and returns the answer. You need not take any input or print anything.
Expected Time Complexity: O(log_{10}amount).
Expected Auxiliary Space: O(log_{10}amount).
Constraints
1 ≤ N≤ 10000001

输入格式

见题面

输出格式

见题面

样例输入
amount = 56
样例输出
3