Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 98a06a8

Browse files
feat: add swift implementation to lcci problem: No.05.06 (doocs#2669)
1 parent 6c8f08c commit 98a06a8

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

‎lcci/05.06.Convert Integer/README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ impl Solution {
9191
}
9292
```
9393

94+
```swift
95+
class Solution {
96+
func convertInteger(_ A: Int, _ B: Int) -> Int {
97+
return (Int32(A) ^ Int32(B)).nonzeroBitCount
98+
}
99+
}
100+
```
101+
94102
<!-- tabs:end -->
95103

96104
<!-- end -->

‎lcci/05.06.Convert Integer/README_EN.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ impl Solution {
108108
}
109109
```
110110

111+
```swift
112+
class Solution {
113+
func convertInteger(_ A: Int, _ B: Int) -> Int {
114+
return (Int32(A) ^ Int32(B)).nonzeroBitCount
115+
}
116+
}
117+
```
118+
111119
<!-- tabs:end -->
112120

113121
<!-- end -->
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Solution {
2+
func convertInteger(_ A: Int, _ B: Int) -> Int {
3+
return (Int32(A) ^ Int32(B)).nonzeroBitCount
4+
}
5+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /