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
16 changes: 16 additions & 0 deletions lcp/LCP 01. 猜数字/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,22 @@ int game(int* guess, int guessSize, int* answer, int answerSize) {
}
```

#### Swift

```swift
class Solution {
func game(_ guess: [Int], _ answer: [Int]) -> Int {
var correctGuesses = 0
for i in 0..<3 {
if guess[i] == answer[i] {
correctGuesses += 1
}
}
return correctGuesses
}
}
```

<!-- tabs:end -->

<!-- solution:end -->
Expand Down
11 changes: 11 additions & 0 deletions lcp/LCP 01. 猜数字/Solution.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Solution {
func game(_ guess: [Int], _ answer: [Int]) -> Int {
var correctGuesses = 0
for i in 0..<3 {
if guess[i] == answer[i] {
correctGuesses += 1
}
}
return correctGuesses
}
}
Loading