File tree 2 files changed +11
-3
lines changed
Rabin-Karp/Rabin-Karp.playground
playground.xcworkspace/xcshareddata
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
//: Taking our rabin-karp algorithm for a walk
2
2
3
- // last checked with Xcode 9.0b4
3
+ // last checked with Xcode 9.4
4
4
#if swift(>=4.0)
5
5
print ( " Hello, Swift 4! " )
6
6
#endif
@@ -30,8 +30,8 @@ extension Character {
30
30
// Find first position of pattern in the text using Rabin Karp algorithm
31
31
public func search( text: String , pattern: String ) -> Int {
32
32
// 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 }
35
35
36
36
if textArray. count < patternArray. count {
37
37
return - 1
Original file line number Diff line number Diff line change
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 >
You can’t perform that action at this time.
0 commit comments