Bird
0
0
DSA Cprogramming~10 mins

Minimum Window Substring in DSA C - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize the left pointer for the sliding window.

DSA C
int left = [1];
Drag options to blanks, or click blank then click option'
A0
B1
C-1
Ds.length
Attempts:
3 left
💡 Hint
Common Mistakes
Starting left pointer at 1 instead of 0.
Using negative index which is invalid.
2fill in blank
medium

Complete the code to check if the current character is in the target frequency map.

DSA C
if (target_freq[s[right]] [1] 0) {
Drag options to blanks, or click blank then click option'
A==
B<
C!=
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which only checks equality, not presence.
Using '<' which is incorrect for frequency check.
3fill in blank
hard

Fix the error in the condition to shrink the window when all characters are matched.

DSA C
while (formed [1] required) {
Drag options to blanks, or click blank then click option'
A==
B<
C>
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' which causes incorrect shrinking.
Using '<' or '>' which do not represent the correct condition.
4fill in blank
hard

Fill both blanks to update the minimum window size and start index.

DSA C
if (right - left + 1 [1] min_len) {
    min_len = right - left + 1;
    min_start = [2];
}
Drag options to blanks, or click blank then click option'
A<
B>
Cleft
Dright
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '<' causes wrong window size update.
Setting min_start to right instead of left.
5fill in blank
hard

Fill all three blanks to correctly update the frequency map and formed count when shrinking the window.

DSA C
char c = s[left];
window_freq[c]--;
if (window_freq[c] [1] target_freq[c]) {
    formed [2];
}
left [3] 1;
Drag options to blanks, or click blank then click option'
A<
B--
C+
D++
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '<' in frequency comparison.
Incrementing formed instead of decrementing.
Moving left pointer backward instead of forward.