Skip to content

Commit 4528471

Browse files
committed
Fix
1 parent 548413a commit 4528471

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Rabin-Karp/Rabin-Karp.playground/Contents.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//: Taking our rabin-karp algorithm for a walk
22

3-
// last checked with Xcode 9.0b4
3+
// last checked with Xcode 9.4
44
#if swift(>=4.0)
55
print("Hello, Swift 4!")
66
#endif
@@ -30,8 +30,8 @@ extension Character {
3030
// Find first position of pattern in the text using Rabin Karp algorithm
3131
public func search(text: String, pattern: String) -> Int {
3232
// convert to array of ints
33-
let patternArray = pattern.flatMap { $0.asInt }
34-
let textArray = text.flatMap { $0.asInt }
33+
let patternArray = pattern.compactMap { $0.asInt }
34+
let textArray = text.compactMap { $0.asInt }
3535

3636
if textArray.count < patternArray.count {
3737
return -1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

0 commit comments

Comments
 (0)