Nutanix 校园招聘OA

There were two questions. 1 hours 30 mins to complete both of them.


Output for the given input was -
1
17
16

Explanation for 16, 1…14->41->42
One would think of DP but size of X = 10^14 makes things tricky.