Given a digit ‘d’ and a range [L, R] where L < R, print all good numbers in given range that don't contain digit 'd'. A number is good if its every digit is larger than the sum of digits which are on the right side of that digit. For example 9620 is good number… Read More »
Given a number, print words for individual digits. It is not allowed to use if or switch. Examples: Input: n = 123 Output: One Two Three Input: n = 350 Output: Three Five Zero We strongly recommend you to minimize your browser and try this yourself first. The idea is to use an array of… Read More »
Given two integers ‘n’ and ‘sum’, find count of all n digit numbers with sum of digits as ‘sum’. Leading 0’s are not counted as digits. 1
A number is non-decreasing if every digit (except the first one) is greater than or equal to previous digit. For example, 223, 4455567, 899, are non-decreasing numbers.
Given a number x, find sum of digits in all numbers from 1 to n. Examples:
Given a string ‘str’ of digits and an integer ‘n’, build the lowest possible number by removing ‘n’ digits from the string and not changing the order of input digits.
Given a number n, find the smallest number that has same set of digits as n and is greater than n. If x is the greatest possible number with its set of digits, then print “not possible”.
Given a number ‘n’, find the smallest number ‘p’ such that if we multiply all digits of ‘p’, we get ‘n’. The result ‘p’ should have minimum two digits.
Consider a coding system for alphabets to integers where ‘a’ is represented as 1, ‘b’ as 2, .. ‘z’ as 26. Given an array of digits (1 to 9) as input, write a function that prints all valid interpretations of input array.
We strongly recommend that you click here and practice it, before moving on to the solution. Below are the solutions to get sum of the digits.