package leetcode;

/**
 * https://leetcode.com/problems/find-unique-binary-string/
 */
public class Problem1980 {
    public String findDifferentBinaryString(String[] nums) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem1980 prob = new Problem1980();
        System.out.println(prob.findDifferentBinaryString(new String[]{"01","10"})); // "11"
        System.out.println(prob.findDifferentBinaryString(new String[]{"00","01"})); // "11"
        System.out.println(prob.findDifferentBinaryString(new String[]{"111","011","001"})); // "101"
    }
}

@@ -12,16 +12,65 @@
 tcode;%0A%0A
+import java.util.HashSet;%0Aimport java.util.Set;%0A%0A
 /**%0A * h
@@ -229,260 +229,219 @@
     
-// TODO%0A        return null
+Set%3CString%3E set = new HashSet%3C%3E()
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1980 prob = new Problem1980();%0A        System.out.println(prob.findDifferentBinaryString(new String%5B%5D%7B%2201%22,%2210%22%7D)); // %2211%22%0A        System.out.println(prob.
+for (String num : nums) %7B%0A            set.add(num);%0A        %7D%0A        return findDifferentBinaryString(set, 0, new char%5Bnums.length%5D);%0A    %7D%0A%0A    private static String 
 find
@@ -466,144 +466,573 @@
 ing(
-new 
+Set%3C
 String
-%5B%5D%7B%2200%22,%2201%22%7D)); // %2211%22%0A        System.out.println(prob.findDifferentBinaryString(new String%5B%5D%7B%22111%22,%22011%22,%22001%22%7D)); // %22101%22
+%3E nums, int index, char%5B%5D chars) %7B%0A        if (index == nums.size()) %7B%0A            String s = new String(chars);%0A            if (nums.contains(s)) %7B%0A                return null;%0A            %7D%0A            return s;%0A        %7D%0A        for (char c : new char%5B%5D%7B'0', '1'%7D)%7B%0A            char tmp = chars%5Bindex%5D;%0A            chars%5Bindex%5D = c;%0A            String s = findDifferentBinaryString(nums, index + 1, chars);%0A            if (s != null) %7B%0A                return s;%0A            %7D%0A            chars%5Bindex%5D = tmp; // Backtrack.%0A        %7D%0A        return null;
 %0A   

Solve problem 1980