We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e216742 commit 0ef2460Copy full SHA for 0ef2460
src/easy/BitwiseOne.go
@@ -0,0 +1,28 @@
1
+package main
2
+
3
+import "fmt"
4
5
+func BitwiseOne(arr []string) string{
6
+ s1 := arr[0]
7
+ s2 := arr[1]
8
9
+ result := ""
10
11
+ for i := 0; i < len(s1); i++ {
12
+ if s1[i] == s2[i] {
13
+ result += string(s1[i])
14
+ }else{
15
+ result += string("1")
16
+ }
17
18
19
+ return result
20
+}
21
22
+func main(){
23
+ // Test cases
24
+ result1 := BitwiseOne([]string{"001110", "100000"})
25
+ fmt.Println(result1)
26
+ result2 := BitwiseOne([]string{"110001", "111100"})
27
+ fmt.Println(result2)
28
0 commit comments