Skip to content
This repository was archived by the owner on Aug 17, 2022. It is now read-only.

Swift 2.2 #1

Merged
merged 2 commits into from
Dec 12, 2016
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ xcuserdata
## Obj-C/Swift specific
*.hmap
*.ipa
.DS_Store
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode7.1
osx_image: xcode7.3

script:
- xcodebuild -project CodeChallenge.xcodeproj -scheme CodeChallengeTests -destination 'platform=iOS Simulator,name=iPhone 6' test
8 changes: 4 additions & 4 deletions CodeChallenge/Base/CodeChallengeType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import Foundation
*/
protocol CodeChallengeType {
/// The type for the input(s) for the challenge.
typealias InputType
associatedtype InputType
/// The type that the entry's function will return.
typealias OutputType
associatedtype OutputType

/// The heading title for this challenge
var title: String { get }
Expand Down Expand Up @@ -170,9 +170,9 @@ extension CodeChallengeType {
for result in results {
for output in result.outputs {
if verifyOutput(output, forInput: result.input) {
successes++
successes += 1
} else {
failures++
failures += 1
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions CodeChallenge/Challenges/TwoSum/Entries/AlexPersian.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import Foundation

let alexPersianTwoSumEntry = CodeChallengeEntry<TwoSumChallenge>(name: "AlexPersian") { input in
for (var i: Int = 0; i < input.numbers.count; i++) {
for (var j: Int = 0; j < input.numbers.count; j++) {
for i in 0..<input.numbers.count {
for j in 0..<input.numbers.count {
if ((input.numbers[i] + input.numbers[j]) == input.target) {
return (i + 1, j + 1)
}
Expand Down
2 changes: 1 addition & 1 deletion CodeChallenge/Challenges/TwoSum/Entries/BugKrusha.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

let bugkrushaTwoSumEntry = CodeChallengeEntry<TwoSumChallenge>(name: "Jazbo") { input in
for (index, num) in input.numbers.enumerate() {
for var i = index + 1; i < input.numbers.count; i++ {
for i in index + 1 ..< input.numbers.count {
if calculate(input.numbers[i], numTwo: num, calculation: +) == input.target {
return (index + 1, i + 1)
}
Expand Down