Given a string str consisting of alphanumeric characters, the task is to check whether the string contains all the digits from 1 to 9.
Input: str = “Geeks12345for69708”
All the digits from 0 to 9 are
present in the given string.
Input: str = “Amazing1234”
Approach: Create a frequency array to mark the frequency of each of the digits from 0 to 9. Finally, traverse the frequency array and if there is any digit that is not present in the given string then the answer will be “No” else the answer will be “Yes”.
Below is the implementation of the above approach:
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.
- How to check if string contains only digits in Java
- Check if the Xor of the frequency of all digits of a number N is zero or not
- Check if the frequency of all the digits in a number is same
- String slicing in Python to check if a string can become empty by recursive deletion
- Check if a string can be converted to another string by replacing vowels and consonants
- Check if a string can be formed from another string by at most X circular clockwise shifts
- Number of even substrings in a string of digits
- Check if a string can be obtained by rotating another string 2 places
- Check if any permutation of string is a K times repeated string
- Queries to check if string B exists as substring in string A
- Check if left and right shift of any string results into given string
- Check if a string can become empty by recursively deleting a given sub-string
- Check if a string can be obtained by rotating another string d places
- Check if the given string is shuffled substring of another string
- Check if a string contains a palindromic sub-string of even length
- Check if a given string is a Reverse Bitonic String or not
- Check whether second string can be formed from characters of first string
- Check if a string is a scrambled form of another string
- Check if a string can be repeated to make another string
- Program to count vowels, consonant, digits and special characters in string.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.