(String nums[], int n,HashSet<String> set, StringBuilder res)
| 13 | return res.toString(); |
| 14 | } |
| 15 | public boolean backtrack(String nums[], int n,HashSet<String> set, StringBuilder res){ |
| 16 | //base case |
| 17 | if(res.length() == n){ |
| 18 | if(!set.contains(res.toString())){ |
| 19 | return true; |
| 20 | } |
| 21 | return false; |
| 22 | } |
| 23 | for(char ch='0';ch<='1';ch++){ |
| 24 | res.append(ch); |
| 25 | if(backtrack(nums,n,set,res)){ |
| 26 | return true; |
| 27 | } |
| 28 | res.deleteCharAt(res.length()-1); |
| 29 | } |
| 30 | return false; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 |
no outgoing calls
no test coverage detected