How would you like to learn today?
Visualize algorithms in real time, explore them step by step, or challenge yourself with a test.Choose a path to focus—or scroll down to preview all options.
Visualize the algorithm step-by-step with interactive animations in real time.
Read the full explanation, examples, and starter code at your own pace.
Drag and arrange the algorithm steps in the correct execution order.
🧠 Select Active to activate
Follow every state change, comparison, and transformation as the execution unfolds in real time.
📖 Select Passive to activate
You are given:
words: These are lowercase English words.queries: Each query is a range [li, ri].Task:
For each query [li, ri], count how many words in the range (from index li to ri, inclusive) start and end with a vowel.
The vowels are 'a', 'e', 'i', 'o', and 'u'.
Return an array ans where:
ans[i] is the answer to the i-th query.Input: words = ["aba", "bcb", "ece", "aa", "e"], queries = [[0, 2], [1, 4], [1, 1]]
Output: [2, 3, 0]
Words starting and ending with vowels:
"aba", "ece", "aa", "e".
[0, 2]:"aba" and "ece", so the result is 2.[1, 4]:"ece", "aa", "e", so the result is 3.[1, 1]:0.Input: words = ["a","e","i"], queries = [[0,2],[0,1],[2,2]]
Output: [2, 3, 0]
All words start and end with vowels.
[0, 2]:"a", "e", "i") satisfy the condition, so the result is 3.[0, 1]:"a" and "e", so the result is 2.[2, 2]:"i", so the result is 1.words.length): Up to .words[i].length): Up to .queries.length): Up to .🎯 Select Challenge to activate
Drag and arrange the algorithm steps in the correct execution order instead of spending time typing code letter by letter.
The algorithm is divided into three logical parts. Carefully rearrange each section in the correct order to form a complete and valid solution.
Understand Below AlgorithmGreen text means the instruction is placed in the correct position.
Red text means the instruction is in the wrong position.
Instructions with the same background color indicate particular blocks start and end.
A tick mark means the instruction is correct and locked.
🔒 Locked steps cannot be moved. Only unlocked steps are draggable.
🔊 Enable sound for swap feedback and completion effects.