Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a TypeScript function to count the number of vowels in a string.

Easy

Problem Statement

Write a TypeScript function to count the number of vowels in a string.

Sample Input

"hello world"

Sample Output

Number of vowels: 3

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
function countVowels(str: string): number { // Your logic here } // Call the function
Log in or sign up to run or submit your code.Log inSign up
Input
"hello world"
Expected Output
Number of vowels: 3