Hi, Here is a solution I have coded- http://codepad.org/bPOoakm3
Please let me know if you see any errors. *Logic for decreasing numbers-* Number of 'n' digit valid numbers (say 2), starting with digit 'k' (say 5); will be sum of number of 'n' digit valid numbers starting with 'k-1' and number of 'n-1' digit number starting with 'k' [not k-1 as 55 is a valid decreasing number.]. I have used the same thought process for increasing numbers. ~Shiv. P.S. To avoid using too much memory, I have used only two int[10] arrays. I keep overwriting them. And to know which array is being filled now, I am using even/odd criteria. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
