Given a number N, the task is to find the smallest Even number with N digits.
Input: N = 1 Output: 0 Input: N = 2 Output: 10
Case 1 : If N = 1 then answer will be 0.
Case 2 : if N != 1 then answer will be (10^(N-1)) because the series of smallest even numbers will go on like, 0, 10, 100, 1000, 10000, 100000, …..
Below is the implementation of the above approach:
Time Complexity: O(1).
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Find smallest number with given number of digits and sum of digits under given constraints
- Smallest odd digits number not less than N
- Smallest odd number with N digits
- Smallest even digits number not less than N
- Find smallest possible Number from a given large Number with same count of digits
- Smallest number with sum of digits as N and divisible by 10^N
- Find the kth smallest number with sum of digits as m
- Smallest number whose sum of digits is square of N
- Smallest number with at least n digits in factorial
- Find the smallest number whose sum of digits is N
- Smallest number whose square has N digits
- Find the smallest number whose digits multiply to a given number n
- Index of smallest triangular number with N digits
- Smallest number greater than Y with sum of digits equal to X
- Smallest N digit number with none of its digits as its divisor
- Smallest number greater than or equal to N using only digits 1 to K
- Smallest number k such that the product of digits of k is equal to n
- Smallest number by rearranging digits of a given number
- Immediate smallest number after re-arranging the digits of a given number
- Smallest multiple of N with exactly N digits in its Binary number representation
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : ihritik