File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
lcci/05.06.Convert Integer Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,14 @@ impl Solution {
91
91
}
92
92
```
93
93
94
+ ``` swift
95
+ class Solution {
96
+ func convertInteger (_ A : Int , _ B : Int ) -> Int {
97
+ return (Int32 (A) ^ Int32 (B)).nonzeroBitCount
98
+ }
99
+ }
100
+ ```
101
+
94
102
<!-- tabs: end -->
95
103
96
104
<!-- end -->
Original file line number Diff line number Diff line change @@ -108,6 +108,14 @@ impl Solution {
108
108
}
109
109
```
110
110
111
+ ``` swift
112
+ class Solution {
113
+ func convertInteger (_ A : Int , _ B : Int ) -> Int {
114
+ return (Int32 (A) ^ Int32 (B)).nonzeroBitCount
115
+ }
116
+ }
117
+ ```
118
+
111
119
<!-- tabs: end -->
112
120
113
121
<!-- end -->
Original file line number Diff line number Diff line change
1
+ class Solution {
2
+ func convertInteger( _ A: Int , _ B: Int ) -> Int {
3
+ return ( Int32 ( A) ^ Int32 ( B) ) . nonzeroBitCount
4
+ }
5
+ }
You can’t perform that action at this time.
0 commit comments