Get Substring

Get Substring is a coding interview problem from Wells_fargo interviews. Given a binary string input_str and an integer k, find a substring that contains exactly k '1's, has the smallest possible length, and, among all minimal-length options, is lexicographically smallest. A concise interview question focused on strict selection criteria.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: