Algorithm · Google · Medium
Generating 1‑2 Sum Strings Medium · Recursion, Backtracking, String · No specific company · No hints You are given a positive integer n. Produce every possible string that uses only the characters '1' and '2' and has the property that the sum of the digit values inside the string is exactly n (where '1' contributes 1 and '2' contributes 2). Print one string per line, and output them in lexicographic (dictionary) order, i.e., '1' comes before '2'. Also, as part of your…
Checking your access…