Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions solution/1900-1999/1980.Find Unique Binary String/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,25 @@ func findDifferentBinaryString(nums []string) string {
}
```

### **C#**

```cs
public class Solution {
public string FindDifferentBinaryString(string[] nums) {
int mask = 0;
foreach (var x in nums) {
int cnt = x.Count(c => c == '1');
mask |= 1 << cnt;
}
int i = 0;
while ((mask >> i & 1) == 1) {
i++;
}
return string.Format("{0}{1}", new string('1', i), new string('0', nums.Length - i));
}
}
```

### **...**

```
Expand Down
19 changes: 19 additions & 0 deletions solution/1900-1999/1980.Find Unique Binary String/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,25 @@ func findDifferentBinaryString(nums []string) string {
}
```

### **C#**

```cs
public class Solution {
public string FindDifferentBinaryString(string[] nums) {
int mask = 0;
foreach (var x in nums) {
int cnt = x.Count(c => c == '1');
mask |= 1 << cnt;
}
int i = 0;
while ((mask >> i & 1) == 1) {
i++;
}
return string.Format("{0}{1}", new string('1', i), new string('0', nums.Length - i));
}
}
```

### **...**

```
Expand Down
14 changes: 14 additions & 0 deletions solution/1900-1999/1980.Find Unique Binary String/Solution.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
public class Solution {
public string FindDifferentBinaryString(string[] nums) {
int mask = 0;
foreach (var x in nums) {
int cnt = x.Count(c => c == '1');
mask |= 1 << cnt;
}
int i = 0;
while ((mask >> i & 1) == 1) {
i++;
}
return string.Format("{0}{1}", new string('1', i), new string('0', nums.Length - i));
}
}