Java Lucky Number


I wrote some logic in java to solve this problem but I am unable to run last 2 test cases because of time limit.

In 2 Seconds,to run these 2 test cases it is some what difficult for me.
Test Cases: 64-bit Number (92871036442 3363728910382456)
Biggest Number(1 1000000000000000000)

Did anyone solve this problem?
Please let me know. It will be helpful.


A post was merged into an existing topic: [Community Puzzle] The Lucky Number