1980. Find Unique Binary String - Cantor's Diagonalization

T: O(n)
S: O(n)
```java
class Solution {
    public String findDifferentBinaryString(String[] nums) {
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < nums.length; i++) {
            if (nums[i].charAt(i) == '0') {
                result.append('1');
            } else {
                result.append('0');
            }        
        }
        return result.toString();
    }
}

/**
T: O(n)
S: O(n)
  01. 10
  /.    \
  1      1. -> ans!!!


  ["111","011","001"]
    /      |       \
    0      0        0 -> ans!!!!

 */
```

Last updated