Question
Given a string s and an integer k, return the number of distinct substrings of s that have exactly length k. If k is greater than len(s) or k <= 0, return 0. For example, in "banana" the length-2 substrings are "ba", "an", "na", "an", "na", of which 3 are distinct. The string can be long, so the intended solution slides a fixed-size window (a rolling hash being one classic way to do it).
distinct_substrings_of_len_k(s: str, k: int) → int["banana",2]out3State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.