We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a9bd8a4 commit 9a16d7bCopy full SHA for 9a16d7b
lcof/面试题65. 不用加减乘除做加法/README.md
@@ -159,6 +159,23 @@ public class Solution {
159
}
160
```
161
162
+#### Swift
163
+
164
+```swift
165
+class Solution {
166
+ func add(_ a: Int, _ b: Int) -> Int {
167
+ var a = a
168
+ var b = b
169
+ while b != 0 {
170
+ let c = (a & b) << 1
171
+ a ^= b
172
+ b = c
173
+ }
174
+ return a
175
176
+}
177
+```
178
179
<!-- tabs:end -->
180
181
<!-- solution:end -->
lcof/面试题65. 不用加减乘除做加法/Solution.swift
@@ -0,0 +1,12 @@
1
2
3
4
5
6
7
8
9
10
11
12
0 commit comments