You are given a large number N in the form of a string, you have to check whether it is divisible by 999 without dividing or finding modulo of number by 999.
N = 1998
Example 2 -
N = 999999999
Your Task :
Complete the function isDivisible999()that receives a string N denoting number and returns true if the n is divisible by 999 and flse otherwise. The driver code itself prints "Divisible" if the returned value is true and returns "Non Divisible" if returned value is false.
Expected Time Complexity : O(len(N)) Expected Space Complexity : O(1)