← CodeNation questions

Smallest circular substring containing all characters of another string

Filed under CodeNation

The question

Given strings str1 and str2, find the length of the smallest circular substring of str1 containing all characters of str2 (for 'hackerrank' and 'kh' the answer is 2). Expected O(n); a variation of the smallest window problem.

No write-up yet. Related questions below have one.

Related CodeNation questions

Collected from public candidate posts and coding forums. Updated Nov 2026.