Filter interviews by
posted on 15 Apr 2024
Count the number of letters in a given string
Iterate through each character in the string and check if it is a letter
Increment a counter for each letter found
Return the total count of letters
posted on 19 Jul 2021
posted on 6 Nov 2018
The question asks to count the number of occurrences of each character in a given string, ignoring case and wild card characters.
Convert the string to lowercase to ignore case.
Remove any wild card characters from the string.
Create an array of size 26 to store the count of each character.
Iterate through each character in the string and increment the count in the array accordingly.
Return the array of counts as the result
HashMap is used for efficient key-value pair storage and retrieval.
HashMap provides constant time complexity for basic operations like get and put.
It allows storing unique keys and their corresponding values.
HashMap is suitable for scenarios where fast lookup is required.
Other collections like ArrayList or LinkedList have different use cases and performance characteristics.
Interview experience
Data Analyst
32
salaries
| ₹3 L/yr - ₹10.5 L/yr |
Senior Software Engineer
20
salaries
| ₹12.3 L/yr - ₹21 L/yr |
Software Engineer
19
salaries
| ₹6 L/yr - ₹10.6 L/yr |
Data Scientist
19
salaries
| ₹4 L/yr - ₹14 L/yr |
Senior Consultant
14
salaries
| ₹8 L/yr - ₹22.9 L/yr |
Crisil
ICRA
Genpact
TCS