Company: Flipkart

Difficulty: easy

Problem Statement

Reversed Sum of m-Digit Multiples An auditing tool works with fixed-width account codes. A code of width m is any positive integer that has exactly m decimal digits, i.e. any integer in the inclusive range [10^(m-1), 10^m - 1] . For m = 1 that range is 1 to 9 ; for m = 3 it is 100 to 999 . Given m and a divisor n , add up every m -digit integer that is divisible by n . Call this total S . Report the integer obtained by writing S in decimal and reading its digits from right to left. Leading zeros produced by the reversal are not written, so if S = 1500 the reversal is 0051 , which is reported as 51 . If no m -digit integer is divisible by n , then S = 0 and the answer is 0 . Input Format A single line with two space-separated integers m and n . Output Format A single line with one integer: the reversal of S . Constraints 1 <= m <= 9 1 <= n <= 10^9 S can be as large as 494999999550000000 (about 4.95 * 10^17 ), which exceeds the range of a 32-bit integer. Use a 64-bit integer

More Flipkart OA questionsInterview experiences