To count the subsequences of length 4 of a string of length n which are divisible by 9.
For example if the input string is 9999 then cnt=1
My approach is similar to Brute Force and takes O(n^3).Any better approach than this?
To count the subsequences of length 4 of a string of length n which are divisible by 9.
For example if the input string is 9999 then cnt=1
My approach is similar to Brute Force and takes O(n^3).Any better approach than this?