All binary numbers of length n that contain k 1s
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Given two integers, N and K, your task is to generate all binary strings of length N that contain exactly K ones. The output should be in lexicographical order.
Input
You will receive two integers: N and K, where 0 ≤ K ≤ N and 0 ≤ N ≤ 100.
Output
Produce all binary strings of length N with exactly K ones, sorted in lexicographical order. The total size of the output will not exceed 10 megabytes.
Examples
Input #1
Answer #1
Submissions 264
Acceptance rate 36%