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
Given a string word and a non-negative integer k, return the total number of substrings of word that satisfy both of the following conditions:
k consonants.The task is to count all contiguous substrings of the input string word that:
a, e, i, o, and u.k consonants (letters that are not vowels).5 <= word.length <= 2 * 10^5word consists only of lowercase English letters.0 <= k <= word.length - 5word = "cuaeio", k = 1"cuaeio". It contains all vowels (u, a, e, i, o) and exactly 1 consonant (c).1word = "aeioubt", k = 2"aeioubt" has all vowels and exactly 2 consonants (b and t). No other substring meets the criteria.1word = "abaeiou", k = 1"baeiou" (from index 1 to 6) contains vowels (a, e, i, o, u) and 1 consonant (b)."abaeiou" (from index 0 to 6) also contains all vowels and exactly 1 consonant (b).2word consists only of lowercase English letters.🎯 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.