Metadata

Key Value
engine transformers
prompt completion
temp 0.2
top_p 0.95
max_new_tokens 1024
n_completions 10

Solutions

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```swift
// Check if in given array of numbers, are any two numbers closer to each other than
// given threshold.
// hasCloseElements(numbers: [1.0, 2.0, 3.0], threshold: 0.5) == false
// hasCloseElements(numbers: [1.0, 2.8, 3.0, 4.0, 5.0, 2.0], threshold: 0.3) == true
func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```swift
// Check if in given array of numbers, are any two numbers closer to each other than
// given threshold.
// hasCloseElements(numbers: [1.0, 2.0, 3.0], threshold: 0.5) == false
// hasCloseElements(numbers: [1.0, 2.8, 3.0, 4.0, 5.0, 2.0], threshold: 0.3) == true
func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```swift
// Check if in given array of numbers, are any two numbers closer to each other than
// given threshold.
// hasCloseElements(numbers: [1.0, 2.0, 3.0], threshold: 0.5) == false
// hasCloseElements(numbers: [1.0, 2.8, 3.0, 4.0, 5.0, 2.0], threshold: 0.3) == true
func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    guard numbers.count > 1 else { return false }
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```swift
// Check if in given array of numbers, are any two numbers closer to each other than
// given threshold.
// hasCloseElements(numbers: [1.0, 2.0, 3.0], threshold: 0.5) == false
// hasCloseElements(numbers: [1.0, 2.8, 3.0, 4.0, 5.0, 2.0], threshold: 0.3) == true
func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    guard numbers.count > 1 else { return false }
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    guard numbers.count > 1 else { return false }
    for i in 0..<numbers.count - 1 {
        for j in i + 1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```swift
// Check if in given array of numbers, are any two numbers closer to each other than
// given threshold.
// hasCloseElements(numbers: [1.0, 2.0, 3.0], threshold: 0.5) == false
// hasCloseElements(numbers: [1.0, 2.8, 3.0, 4.0, 5.0, 2.0], threshold: 0.3) == true
func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    guard numbers.count > 1 else { return false }
    for i in 0..<numbers.count - 1 {
        for j in i + 1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```swift
// Check if in given array of numbers, are any two numbers closer to each other than
// given threshold.
// hasCloseElements(numbers: [1.0, 2.0, 3.0], threshold: 0.5) == false
// hasCloseElements(numbers: [1.0, 2.8, 3.0, 4.0, 5.0, 2.0], threshold: 0.3) == true
func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```swift
// Check if in given array of numbers, are any two numbers closer to each other than
// given threshold.
// hasCloseElements(numbers: [1.0, 2.0, 3.0], threshold: 0.5) == false
// hasCloseElements(numbers: [1.0, 2.8, 3.0, 4.0, 5.0, 2.0], threshold: 0.3) == true
func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    guard numbers.count > 1 else { return false }
    let sortedNumbers = numbers.sorted()
    for i in 0..<sortedNumbers.count - 1 {
        let currentNumber = sortedNumbers[i]
        let nextNumber = sortedNumbers[i + 1]
        if nextNumber - currentNumber < threshold {
            return true
        }
    }
    return false
}
```swift
// Check if in given array of numbers, are any two numbers closer to each other than
// given threshold.
// hasCloseElements(numbers: [1.0, 2.0, 3.0], threshold: 0.5) == false
// hasCloseElements(numbers: [1.0, 2.8, 3.0, 4.0, 5.0, 2.0], threshold: 0.3) == true
func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    guard numbers.count > 1 else { return false }
    let sortedNumbers = numbers.sorted()
    for i in 0..<sortedNumbers.count - 1 {
        let currentNumber = sortedNumbers[i]
        let nextNumber = sortedNumbers[i + 1]
        if nextNumber - currentNumber < threshold {
            return true
        }
    }
    return false
}
```

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```swift
// Check if in given array of numbers, are any two numbers closer to each other than
// given threshold.
// hasCloseElements(numbers: [1.0, 2.0, 3.0], threshold: 0.5) == false
// hasCloseElements(numbers: [1.0, 2.8, 3.0, 4.0, 5.0, 2.0], threshold: 0.3) == true
func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```swift
// Check if in given array of numbers, are any two numbers closer to each other than
// given threshold.
// hasCloseElements(numbers: [1.0, 2.0, 3.0], threshold: 0.5) == false
// hasCloseElements(numbers: [1.0, 2.8, 3.0, 4.0, 5.0, 2.0], threshold: 0.3) == true
func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```

func separateParenGroups(parenString: String) -> [String] {
    var result: [String] = []
    var currentGroup: String = ""
    var openBraces: Int = 0
    for character in parenString {
        switch character {
        case "(":
            openBraces += 1
            currentGroup += character
        case ")":
            openBraces -= 1
            currentGroup += character
            if openBraces == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        default:
            currentGroup += character
        }
    }
    return result
}
```swift
// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    var result: [String] = []
    var currentGroup: String = ""
    var openBraces: Int = 0
    for character in parenString {
        switch character {
        case "(":
            openBraces += 1
            currentGroup += character
        case ")":
            openBraces -= 1
            currentGroup += character
            if openBraces == 0 {
                result.append(currentGroup)
                currentGroup = ""
            }
        default:
            currentGroup += character
        }
    }
    return result
}
```
currentGroup += character // cannot convert value of type 'Character' to expected argument type 'String'
currentGroup += character // cannot convert value of type 'Character' to expected argument type 'String'
currentGroup += character // cannot convert value of type 'Character' to expected argument type 'String'

func separateParenGroups(parenString: String) -> [String] {
    let parenString = parenString.trimmingCharacters(in: .whitespacesAndNewlines)
    let parenStrings = parenString.split(separator: "(")
    var result = [String]()
    for parenString in parenStrings {
        var parenString = String(parenString)
        while parenString.contains("(") {
            let index = parenString.firstIndex(of: "(")!
            let indexEnd = parenString.index(after: index)
            let indexEnd = parenString.firstIndex(of: ")", range: indexEnd..<parenString.endIndex)!
            let substring = parenString[index..<indexEnd]
            result.append(substring)
            parenString = String(parenString[indexEnd...])
        }
    }
    return result
}
```swift
// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    let parenString = parenString.trimmingCharacters(in: .whitespacesAndNewlines)
    let parenStrings = parenString.split(separator: "(")
    var result = [String]()
    for parenString in parenStrings {
        var parenString = String(parenString)
        while parenString.contains("(") {
            let index = parenString.firstIndex(of: "(")!
            let indexEnd = parenString.index(after: index)
            let indexEnd = parenString.firstIndex(of: ")", range: indexEnd..<parenString.endIndex)!
            let substring = parenString[index..<indexEnd]
            result.append(substring)
            parenString = String(parenString[indexEnd...])
        }
    }
    return result
}
```
let indexEnd = parenString.firstIndex(of: ")", range: indexEnd..<parenString.endIndex)! // extra argument 'range' in call
parenString = String(parenString[indexEnd...]) // type '()' cannot conform to 'RangeExpression'

func separateParenGroups(parenString: String) -> [String] {
    // TODO: Write your code here
    return []
}
```swift
// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    // TODO: Write your code here
    return []
}
```
 // XCTAssertTrue failed

func separateParenGroups(parenString: String) -> [String] {
    var result = [String]()
    var currentGroup = ""
    var openBraces = 0
    for character in parenString {
        if character == "(" {
            openBraces += 1
        } else if character == ")" {
            openBraces -= 1
        }
        currentGroup.append(character)
        if openBraces == 0 {
            result.append(currentGroup)
            currentGroup = ""
        }
    }
    return result
}
```swift
// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    var result = [String]()
    var currentGroup = ""
    var openBraces = 0
    for character in parenString {
        if character == "(" {
            openBraces += 1
        } else if character == ")" {
            openBraces -= 1
        }
        currentGroup.append(character)
        if openBraces == 0 {
            result.append(currentGroup)
            currentGroup = ""
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func separateParenGroups(parenString: String) -> [String] {
    // TODO: Implement this function
    return []
}
```swift
// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    // TODO: Implement this function
    return []
}
```
 // XCTAssertTrue failed

func separateParenGroups(parenString: String) -> [String] {
    // TODO: Write your code here
    return []
}
```swift
// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    // TODO: Write your code here
    return []
}

// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    // TODO: Write your code here
    return []
}

// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    // TODO: Write your code here
    return []
}

// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    // TODO: Write your code here
    return []
}

// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    // TODO: Write your code here
    return []
}

// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    // TODO: Write your code here
    return []
}

// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    // TODO: Write your code here
    return []
}

// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    // TODO: Write your code here
    return []
}

// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace
 // XCTAssertTrue failed

func separateParenGroups(parenString: String) -> [String] {
    // TODO: Write your code here
    return []
}
```swift
// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    // TODO: Write your code here
    return []
}
```
 // XCTAssertTrue failed

func separateParenGroups(parenString: String) -> [String] {
    var stack = [Character]()
    var result = [String]()
    var currentString = ""
    for char in parenString {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            stack.removeLast()
        }
        currentString.append(char)
        if stack.isEmpty {
            result.append(currentString)
            currentString = ""
        }
    }
    return result
}
```swift
// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    var stack = [Character]()
    var result = [String]()
    var currentString = ""
    for char in parenString {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            stack.removeLast()
        }
        currentString.append(char)
        if stack.isEmpty {
            result.append(currentString)
            currentString = ""
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func separateParenGroups(parenString: String) -> [String] {
    let parenString = parenString.trimmingCharacters(in: .whitespaces)
    var parenStack = [Character]()
    var parenGroups = [String]()
    for char in parenString {
        if char == "(" {
            parenStack.append(char)
        } else if char == ")" {
            if let last = parenStack.popLast() {
                if last != "(" {
                    return []
                }
            } else {
                return []
            }
        }
    }
    if parenStack.isEmpty {
        return parenGroups
    } else {
        return []
    }
}
```swift
// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    let parenString = parenString.trimmingCharacters(in: .whitespaces)
    var parenStack = [Character]()
    var parenGroups = [String]()
    for char in parenString {
        if char == "(" {
            parenStack.append(char)
        } else if char == ")" {
            if let last = parenStack.popLast() {
                if last != "(" {
                    return []
                }
            } else {
                return []
            }
        }
    }
    if parenStack.isEmpty {
        return parenGroups
    } else {
        return []
    }
}
```
var parenGroups = [String]() // variable 'parenGroups' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func separateParenGroups(parenString: String) -> [String] {
    var result: [String] = []
    var currentGroup: String = ""
    var openBraces: Int = 0
    for character in parenString {
        if character == "(" {
            openBraces += 1
        } else if character == ")" {
            openBraces -= 1
        }
        currentGroup.append(character)
        if openBraces == 0 {
            result.append(currentGroup)
            currentGroup = ""
        }
    }
    return result
}
```swift
// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the array of those.
// Separate groups are balanced (each open brace is properly closed) and not nested within each other
// Ignore any spaces in the input string.
// separateParenGroups(parenString: "( ) (( )) (( )( ))") == ["()", "(())", "(()())"]
func separateParenGroups(parenString: String) -> [String] {
    var result: [String] = []
    var currentGroup: String = ""
    var openBraces: Int = 0
    for character in parenString {
        if character == "(" {
            openBraces += 1
        } else if character == ")" {
            openBraces -= 1
        }
        currentGroup.append(character)
        if openBraces == 0 {
            result.append(currentGroup)
            currentGroup = ""
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func truncateNumber(number: Double) -> Double {
    return number - floor(number)
}

func truncateNumber(number: Double) -> Double {
    return floor(number)
}
```swift
// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the decimal part of the number.
// truncateNumber(number: 3.5) == 0.5
func truncateNumber(number: Double) -> Double {
    return number - floor(number)
}

// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the integer part of the number.
// truncateNumber(number: 3.5) == 3
func truncateNumber(number: Double) -> Double {
    return floor(number)
}
```
func truncateNumber(number: Double) -> Double { // invalid redeclaration of 'truncateNumber(number:)'

func truncateNumber(number: Double) -> Double {
    return number - Int(number)
}

func truncateNumber(number: Double) -> Double {
    return Int(number)
}

func truncateNumber(number: Double) -> Double {
    return number.rounded(.down)
}

func truncateNumber(number: Double) -> Double {
    return number.rounded(.towardZero)
}

func truncateNumber(number: Double) -> Double {
    return number.rounded(.toNearestOrAwayFromZero)
}

func truncateNumber(number: Double) -> Double {
    return number.rounded(.up)
}
```swift
// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the decimal part of the number.
// truncateNumber(number: 3.5) == 0.5
func truncateNumber(number: Double) -> Double {
    return number - Int(number)
}

// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the integer part of the number.
// truncateNumber(number: 3.5) == 3
func truncateNumber(number: Double) -> Double {
    return Int(number)
}

// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the integer part of the number.
// truncateNumber(number: 3.5) == 3
func truncateNumber(number: Double) -> Double {
    return number.rounded(.down)
}

// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the integer part of the number.
// truncateNumber(number: 3.5) == 3
func truncateNumber(number: Double) -> Double {
    return number.rounded(.towardZero)
}

// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the integer part of the number.
// truncateNumber(number: 3.5) == 3
func truncateNumber(number: Double) -> Double {
    return number.rounded(.toNearestOrAwayFromZero)
}

// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the integer part of the number.
// truncateNumber(number: 3.5) == 3
func truncateNumber(number: Double) -> Double {
    return number.rounded(.up)
}
```
return number - Int(number) // cannot convert value of type 'Int' to expected argument type 'Double'
func truncateNumber(number: Double) -> Double { // invalid redeclaration of 'truncateNumber(number:)'
return Int(number) // cannot convert return expression of type 'Int' to return type 'Double'
func truncateNumber(number: Double) -> Double { // invalid redeclaration of 'truncateNumber(number:)'
func truncateNumber(number: Double) -> Double { // invalid redeclaration of 'truncateNumber(number:)'
func truncateNumber(number: Double) -> Double { // invalid redeclaration of 'truncateNumber(number:)'
func truncateNumber(number: Double) -> Double { // invalid redeclaration of 'truncateNumber(number:)'

func truncateNumber(number: Double) -> Double {
    return number - floor(number)
}

func truncateNumber(number: Double) -> Double {
    return floor(number)
}
```swift
// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the decimal part of the number.
// truncateNumber(number: 3.5) == 0.5
func truncateNumber(number: Double) -> Double {
    return number - floor(number)
}

// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the integer part of the number.
// truncateNumber(number: 3.5) == 3
func truncateNumber(number: Double) -> Double {
    return floor(number)
}
```
func truncateNumber(number: Double) -> Double { // invalid redeclaration of 'truncateNumber(number:)'

func truncateNumber(number: Double) -> Double {
    return number - floor(number)
}
```swift
// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the decimal part of the number.
// truncateNumber(number: 3.5) == 0.5
func truncateNumber(number: Double) -> Double {
    return number - floor(number)
}
```

func truncateNumber(number: Double) -> Double {
    return number - Double(Int(number))
}
```swift
// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the decimal part of the number.
// truncateNumber(number: 3.5) == 0.5
func truncateNumber(number: Double) -> Double {
    return number - Double(Int(number))
}
```

func truncateNumber(number: Double) -> Double {
    return number - floor(number)
}
```swift
// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the decimal part of the number.
// truncateNumber(number: 3.5) == 0.5
func truncateNumber(number: Double) -> Double {
    return number - floor(number)
}
```

func truncateNumber(number: Double) -> Double {
    return number - Double(Int(number))
}
```swift
// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the decimal part of the number.
// truncateNumber(number: 3.5) == 0.5
func truncateNumber(number: Double) -> Double {
    return number - Double(Int(number))
}
```

func truncateNumber(number: Double) -> Double {
  return number - floor(number)
}
```swift
// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the decimal part of the number.
// truncateNumber(number: 3.5) == 0.5
func truncateNumber(number: Double) -> Double {
  return number - floor(number)
}
```

func truncateNumber(number: Double) -> Double {
    let integer = Int(number)
    return number - Double(integer)
}

func truncateNumber(number: Double) -> Int {
    return Int(number)
}
```swift
// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the decimal part of the number.
// truncateNumber(number: 3.5) == 0.5
func truncateNumber(number: Double) -> Double {
    let integer = Int(number)
    return number - Double(integer)
}

// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the integer part of the number.
// truncateNumber(number: 3.5) == 3
func truncateNumber(number: Double) -> Int {
    return Int(number)
}

// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the integer part of the number.
// truncateNumber(number: 3.5) == 3
func truncateNumber(number: Double) -> Int {
    return Int(number)
}
```

func truncateNumber(number: Double) -> Double {
    return number - floor(number)
}
```swift
// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the decimal part of the number.
// truncateNumber(number: 3.5) == 0.5
func truncateNumber(number: Double) -> Double {
    return number - floor(number)
}
```

func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        if operation < 0 {
            balance += operation
        } else {
            balance -= operation
        }
        if balance < 0 {
            return true
        }
    }
    return false
}
```swift
// You're given an array of deposit and withdrawal operations on a bank account that starts with
// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
// at that point function should return true. Otherwise it should return false.
// belowZero(operations: [1, 2, 3]) == false
// belowZero(operations: [1, 2, -4, 5]) == true
func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        if operation < 0 {
            balance += operation
        } else {
            balance -= operation
        }
        if balance < 0 {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        balance += operation
        if balance < 0 {
            return true
        }
    }
    return false
}
```swift
// You're given an array of deposit and withdrawal operations on a bank account that starts with
// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
// at that point function should return true. Otherwise it should return false.
// belowZero(operations: [1, 2, 3]) == false
// belowZero(operations: [1, 2, -4, 5]) == true
func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        balance += operation
        if balance < 0 {
            return true
        }
    }
    return false
}
```

func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        balance += operation
        if balance < 0 {
            return true
        }
    }
    return false
}
```swift
// You're given an array of deposit and withdrawal operations on a bank account that starts with
// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
// at that point function should return true. Otherwise it should return false.
// belowZero(operations: [1, 2, 3]) == false
// belowZero(operations: [1, 2, -4, 5]) == true
func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        balance += operation
        if balance < 0 {
            return true
        }
    }
    return false
}
```

func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        if operation < 0 {
            balance += operation
        } else {
            balance += operation
        }
        if balance < 0 {
            return true
        }
    }
    return false
}
```swift
// You're given an array of deposit and withdrawal operations on a bank account that starts with
// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
// at that point function should return true. Otherwise it should return false.
// belowZero(operations: [1, 2, 3]) == false
// belowZero(operations: [1, 2, -4, 5]) == true
func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        if operation < 0 {
            balance += operation
        } else {
            balance += operation
        }
        if balance < 0 {
            return true
        }
    }
    return false
}
```

func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        balance += operation
        if balance < 0 {
            return true
        }
    }
    return false
}
```swift
// You're given an array of deposit and withdrawal operations on a bank account that starts with
// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
// at that point function should return true. Otherwise it should return false.
// belowZero(operations: [1, 2, 3]) == false
// belowZero(operations: [1, 2, -4, 5]) == true
func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        balance += operation
        if balance < 0 {
            return true
        }
    }
    return false
}
```

func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        if operation > 0 {
            balance += operation
        } else {
            balance -= operation
        }
        if balance < 0 {
            return true
        }
    }
    return false
}
```swift
// You're given an array of deposit and withdrawal operations on a bank account that starts with
// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
// at that point function should return true. Otherwise it should return false.
// belowZero(operations: [1, 2, 3]) == false
// belowZero(operations: [1, 2, -4, 5]) == true
func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        if operation > 0 {
            balance += operation
        } else {
            balance -= operation
        }
        if balance < 0 {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        balance += operation
        if balance < 0 {
            return true
        }
    }
    return false
}
```swift
// You're given an array of deposit and withdrawal operations on a bank account that starts with
// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
// at that point function should return true. Otherwise it should return false.
// belowZero(operations: [1, 2, 3]) == false
// belowZero(operations: [1, 2, -4, 5]) == true
func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        balance += operation
        if balance < 0 {
            return true
        }
    }
    return false
}
```

func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        balance += operation
        if balance < 0 {
            return true
        }
    }
    return false
}
```swift
// You're given an array of deposit and withdrawal operations on a bank account that starts with
// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
// at that point function should return true. Otherwise it should return false.
// belowZero(operations: [1, 2, 3]) == false
// belowZero(operations: [1, 2, -4, 5]) == true
func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        balance += operation
        if balance < 0 {
            return true
        }
    }
    return false
}
```

func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        if operation < 0 {
            balance += operation
        } else {
            balance -= operation
        }
        if balance < 0 {
            return true
        }
    }
    return false
}
```swift
// You're given an array of deposit and withdrawal operations on a bank account that starts with
// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
// at that point function should return true. Otherwise it should return false.
// belowZero(operations: [1, 2, 3]) == false
// belowZero(operations: [1, 2, -4, 5]) == true
func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        if operation < 0 {
            balance += operation
        } else {
            balance -= operation
        }
        if balance < 0 {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        if operation < 0 {
            balance += operation
        } else {
            balance -= operation
        }
        if balance < 0 {
            return true
        }
    }
    return false
}
```swift
// You're given an array of deposit and withdrawal operations on a bank account that starts with
// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
// at that point function should return true. Otherwise it should return false.
// belowZero(operations: [1, 2, 3]) == false
// belowZero(operations: [1, 2, -4, 5]) == true
func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        if operation < 0 {
            balance += operation
        } else {
            balance -= operation
        }
        if balance < 0 {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0.0, +) / Double(numbers.count)
}
```swift
// For a given array of input numbers, calculate Mean Absolute Deviation
// around the mean of this dataset.
// Mean Absolute Deviation is the average absolute difference between each
// element and a centerpoint (mean in this case):
// MAD = average | x - x_mean |
// meanAbsoluteDeviation(numbers: [1.0, 2.0, 3.0, 4.0]) == 1.0
func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0.0, +) / Double(numbers.count)
}
```

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0.0, +) / Double(numbers.count)
}
```swift
// For a given array of input numbers, calculate Mean Absolute Deviation
// around the mean of this dataset.
// Mean Absolute Deviation is the average absolute difference between each
// element and a centerpoint (mean in this case):
// MAD = average | x - x_mean |
// meanAbsoluteDeviation(numbers: [1.0, 2.0, 3.0, 4.0]) == 1.0
func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0.0, +) / Double(numbers.count)
}
```

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    guard !numbers.isEmpty else { return 0.0 }
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    return numbers.reduce(0.0) { $0 + abs($1 - mean) } / Double(numbers.count)
}
```swift
// For a given array of input numbers, calculate Mean Absolute Deviation
// around the mean of this dataset.
// Mean Absolute Deviation is the average absolute difference between each
// element and a centerpoint (mean in this case):
// MAD = average | x - x_mean |
// meanAbsoluteDeviation(numbers: [1.0, 2.0, 3.0, 4.0]) == 1.0
func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    guard !numbers.isEmpty else { return 0.0 }
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    return numbers.reduce(0.0) { $0 + abs($1 - mean) } / Double(numbers.count)
}
```

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0.0, +) / Double(numbers.count)
}
```swift
// For a given array of input numbers, calculate Mean Absolute Deviation
// around the mean of this dataset.
// Mean Absolute Deviation is the average absolute difference between each
// element and a centerpoint (mean in this case):
// MAD = average | x - x_mean |
// meanAbsoluteDeviation(numbers: [1.0, 2.0, 3.0, 4.0]) == 1.0
func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0.0, +) / Double(numbers.count)
}
```

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    return numbers.map { abs($0 - mean) }.reduce(0.0, +) / Double(numbers.count)
}
```swift
// For a given array of input numbers, calculate Mean Absolute Deviation
// around the mean of this dataset.
// Mean Absolute Deviation is the average absolute difference between each
// element and a centerpoint (mean in this case):
// MAD = average | x - x_mean |
// meanAbsoluteDeviation(numbers: [1.0, 2.0, 3.0, 4.0]) == 1.0
func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    return numbers.map { abs($0 - mean) }.reduce(0.0, +) / Double(numbers.count)
}
```

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    return numbers.map { abs($0 - mean) }.reduce(0.0, +) / Double(numbers.count)
}
```swift
// For a given array of input numbers, calculate Mean Absolute Deviation
// around the mean of this dataset.
// Mean Absolute Deviation is the average absolute difference between each
// element and a centerpoint (mean in this case):
// MAD = average | x - x_mean |
// meanAbsoluteDeviation(numbers: [1.0, 2.0, 3.0, 4.0]) == 1.0
func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    return numbers.map { abs($0 - mean) }.reduce(0.0, +) / Double(numbers.count)
}
```

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0.0, +) / Double(numbers.count)
}
```swift
// For a given array of input numbers, calculate Mean Absolute Deviation
// around the mean of this dataset.
// Mean Absolute Deviation is the average absolute difference between each
// element and a centerpoint (mean in this case):
// MAD = average | x - x_mean |
// meanAbsoluteDeviation(numbers: [1.0, 2.0, 3.0, 4.0]) == 1.0
func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0.0, +) / Double(numbers.count)
}
```

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    return numbers.map { abs($0 - mean) }.reduce(0.0, +) / Double(numbers.count)
}
```swift
// For a given array of input numbers, calculate Mean Absolute Deviation
// around the mean of this dataset.
// Mean Absolute Deviation is the average absolute difference between each
// element and a centerpoint (mean in this case):
// MAD = average | x - x_mean |
// meanAbsoluteDeviation(numbers: [1.0, 2.0, 3.0, 4.0]) == 1.0
func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    return numbers.map { abs($0 - mean) }.reduce(0.0, +) / Double(numbers.count)
}
```

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    guard !numbers.isEmpty else { return 0.0 }
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0.0, +) / Double(numbers.count)
}
```swift
// For a given array of input numbers, calculate Mean Absolute Deviation
// around the mean of this dataset.
// Mean Absolute Deviation is the average absolute difference between each
// element and a centerpoint (mean in this case):
// MAD = average | x - x_mean |
// meanAbsoluteDeviation(numbers: [1.0, 2.0, 3.0, 4.0]) == 1.0
func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    guard !numbers.isEmpty else { return 0.0 }
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0.0, +) / Double(numbers.count)
}
```

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0.0, +) / Double(numbers.count)
}
```swift
// For a given array of input numbers, calculate Mean Absolute Deviation
// around the mean of this dataset.
// Mean Absolute Deviation is the average absolute difference between each
// element and a centerpoint (mean in this case):
// MAD = average | x - x_mean |
// meanAbsoluteDeviation(numbers: [1.0, 2.0, 3.0, 4.0]) == 1.0
func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = numbers.reduce(0.0, +) / Double(numbers.count)
    let deviations = numbers.map { abs($0 - mean) }
    return deviations.reduce(0.0, +) / Double(numbers.count)
}
```

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    guard !numbers.isEmpty else { return [] }
    var result = [Int]()
    result.append(numbers[0])
    for index in 1..<numbers.count {
        result.append(delimeter)
        result.append(numbers[index])
    }
    return result
}
```swift
// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    guard !numbers.isEmpty else { return [] }
    var result = [Int]()
    result.append(numbers[0])
    for index in 1..<numbers.count {
        result.append(delimeter)
        result.append(numbers[index])
    }
    return result
}
```

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```swift
// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```swift
// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```swift
// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    guard !numbers.isEmpty else { return [] }
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```swift
// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    guard !numbers.isEmpty else { return [] }
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    guard !numbers.isEmpty else { return numbers }
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```swift
// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    guard !numbers.isEmpty else { return numbers }
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    guard numbers.count > 1 else { return numbers }
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```swift
// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    guard numbers.count > 1 else { return numbers }
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```swift
// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```swift
// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index != numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}

// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```swift
// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerated() {
        result.append(number)
        if index < numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```

func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var stack = [Int]()
    var level = 0
    for char in parenString {
        switch char {
        case "(":
            stack.append(level)
            level += 1
        case ")":
            level = stack.removeLast()
        default:
            break
        }
        result.append(level)
    }
    return result
}
```swift
// Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
// For each of the group, output the deepest level of nesting of parentheses.
// E.g. (()()) has maximum two levels of nesting while ((())) has three.
// parseNestedParens(parenString: "(()()) ((())) () ((())()())") == [2, 3, 1, 3]
func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var stack = [Int]()
    var level = 0
    for char in parenString {
        switch char {
        case "(":
            stack.append(level)
            level += 1
        case ")":
            level = stack.removeLast()
        default:
            break
        }
        result.append(level)
    }
    return result
}
```
 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var stack = [Int]()
    for char in parenString {
        switch char {
        case "(":
            stack.append(stack.last ?? 0) + 1
        case ")":
            stack.removeLast()
        default:
            break
        }
        result.append(stack.last ?? 0)
    }
    return result
}
```swift
// Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
// For each of the group, output the deepest level of nesting of parentheses.
// E.g. (()()) has maximum two levels of nesting while ((())) has three.
// parseNestedParens(parenString: "(()()) ((())) () ((())()())") == [2, 3, 1, 3]
func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var stack = [Int]()
    for char in parenString {
        switch char {
        case "(":
            stack.append(stack.last ?? 0) + 1
        case ")":
            stack.removeLast()
        default:
            break
        }
        result.append(stack.last ?? 0)
    }
    return result
}
```
stack.append(stack.last ?? 0) + 1 // cannot convert value of type '()' to expected argument type 'Int'

func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var level = 0
    for char in parenString {
        switch char {
        case "(":
            level += 1
        case ")":
            level -= 1
        default:
            break
        }
        result.append(level)
    }
    return result
}
```swift
// Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
// For each of the group, output the deepest level of nesting of parentheses.
// E.g. (()()) has maximum two levels of nesting while ((())) has three.
// parseNestedParens(parenString: "(()()) ((())) () ((())()())") == [2, 3, 1, 3]
func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var level = 0
    for char in parenString {
        switch char {
        case "(":
            level += 1
        case ")":
            level -= 1
        default:
            break
        }
        result.append(level)
    }
    return result
}
```
 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var stack = [Int]()
    var level = 0
    for char in parenString {
        switch char {
        case "(":
            stack.append(level)
            level += 1
        case ")":
            level = stack.removeLast()
        default:
            break
        }
        result.append(level)
    }
    return result
}
```swift
// Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
// For each of the group, output the deepest level of nesting of parentheses.
// E.g. (()()) has maximum two levels of nesting while ((())) has three.
// parseNestedParens(parenString: "(()()) ((())) () ((())()())") == [2, 3, 1, 3]
func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var stack = [Int]()
    var level = 0
    for char in parenString {
        switch char {
        case "(":
            stack.append(level)
            level += 1
        case ")":
            level = stack.removeLast()
        default:
            break
        }
        result.append(level)
    }
    return result
}
```
 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    let parenStrings = parenString.split(separator: " ")
    var result = [Int]()
    for parenString in parenStrings {
        result.append(parseParenString(parenString: String(parenString)))
    }
    return result
}

func parseParenString(parenString: String) -> Int {
    var result = 0
    var level = 0
    for char in parenString {
        if char == "(" {
            level += 1
        } else if char == ")" {
            level -= 1
        }
        result = max(result, level)
    }
    return result
}
```swift
// Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
// For each of the group, output the deepest level of nesting of parentheses.
// E.g. (()()) has maximum two levels of nesting while ((())) has three.
// parseNestedParens(parenString: "(()()) ((())) () ((())()())") == [2, 3, 1, 3]
func parseNestedParens(parenString: String) -> [Int] {
    let parenStrings = parenString.split(separator: " ")
    var result = [Int]()
    for parenString in parenStrings {
        result.append(parseParenString(parenString: String(parenString)))
    }
    return result
}

func parseParenString(parenString: String) -> Int {
    var result = 0
    var level = 0
    for char in parenString {
        if char == "(" {
            level += 1
        } else if char == ")" {
            level -= 1
        }
        result = max(result, level)
    }
    return result
}
```

func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var level = 0
    for char in parenString {
        switch char {
        case "(":
            level += 1
        case ")":
            level -= 1
        default:
            break
        }
        result.append(level)
    }
    return result
}
```swift
// Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
// For each of the group, output the deepest level of nesting of parentheses.
// E.g. (()()) has maximum two levels of nesting while ((())) has three.
// parseNestedParens(parenString: "(()()) ((())) () ((())()())") == [2, 3, 1, 3]
func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var level = 0
    for char in parenString {
        switch char {
        case "(":
            level += 1
        case ")":
            level -= 1
        default:
            break
        }
        result.append(level)
    }
    return result
}
```
 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var level = 0
    for c in parenString {
        if c == "(" {
            level += 1
        } else if c == ")" {
            level -= 1
        }
        result.append(level)
    }
    return result
}
```swift
// Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
// For each of the group, output the deepest level of nesting of parentheses.
// E.g. (()()) has maximum two levels of nesting while ((())) has three.
// parseNestedParens(parenString: "(()()) ((())) () ((())()())") == [2, 3, 1, 3]
func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var level = 0
    for c in parenString {
        if c == "(" {
            level += 1
        } else if c == ")" {
            level -= 1
        }
        result.append(level)
    }
    return result
}
```
 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var level = 0
    for char in parenString {
        if char == "(" {
            level += 1
        } else if char == ")" {
            level -= 1
        }
        result.append(level)
    }
    return result
}
```swift
// Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
// For each of the group, output the deepest level of nesting of parentheses.
// E.g. (()()) has maximum two levels of nesting while ((())) has three.
// parseNestedParens(parenString: "(()()) ((())) () ((())()())") == [2, 3, 1, 3]
func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var level = 0
    for char in parenString {
        if char == "(" {
            level += 1
        } else if char == ")" {
            level -= 1
        }
        result.append(level)
    }
    return result
}
```
 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var level = 0
    var maxLevel = 0
    for char in parenString {
        switch char {
        case "(":
            level += 1
            maxLevel = max(level, maxLevel)
        case ")":
            level -= 1
        default:
            break
        }
        if level == 0 {
            result.append(maxLevel)
            maxLevel = 0
        }
    }
    return result
}
```swift
// Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
// For each of the group, output the deepest level of nesting of parentheses.
// E.g. (()()) has maximum two levels of nesting while ((())) has three.
// parseNestedParens(parenString: "(()()) ((())) () ((())()())") == [2, 3, 1, 3]
func parseNestedParens(parenString: String) -> [Int] {
    var result = [Int]()
    var level = 0
    var maxLevel = 0
    for char in parenString {
        switch char {
        case "(":
            level += 1
            maxLevel = max(level, maxLevel)
        case ")":
            level -= 1
        default:
            break
        }
        if level == 0 {
            result.append(maxLevel)
            maxLevel = 0
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func parseNestedParens(parenString: String) -> [Int] {
    // TODO: Write your code here
    return []
}
```swift
// Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
// For each of the group, output the deepest level of nesting of parentheses.
// E.g. (()()) has maximum two levels of nesting while ((())) has three.
// parseNestedParens(parenString: "(()()) ((())) () ((())()())") == [2, 3, 1, 3]
func parseNestedParens(parenString: String) -> [Int] {
    // TODO: Write your code here
    return []
}
```
 // XCTAssertTrue failed

func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```swift
// Filter an input array of strings only for ones that contain given substring
// filterBySubstring(strings: [] as [String], substring: "a") == [] as [String]
// filterBySubstring(strings: ["abc", "bacd", "cde", "array"], substring: "a") == ["abc", "bacd", "array"]
func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```

func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```swift
// Filter an input array of strings only for ones that contain given substring
// filterBySubstring(strings: [] as [String], substring: "a") == [] as [String]
// filterBySubstring(strings: ["abc", "bacd", "cde", "array"], substring: "a") == ["abc", "bacd", "array"]
func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```

func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```swift
// Filter an input array of strings only for ones that contain given substring
// filterBySubstring(strings: [] as [String], substring: "a") == [] as [String]
// filterBySubstring(strings: ["abc", "bacd", "cde", "array"], substring: "a") == ["abc", "bacd", "array"]
func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```

func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```swift
// Filter an input array of strings only for ones that contain given substring
// filterBySubstring(strings: [] as [String], substring: "a") == [] as [String]
// filterBySubstring(strings: ["abc", "bacd", "cde", "array"], substring: "a") == ["abc", "bacd", "array"]
func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```

func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```swift
// Filter an input array of strings only for ones that contain given substring
// filterBySubstring(strings: [] as [String], substring: "a") == [] as [String]
// filterBySubstring(strings: ["abc", "bacd", "cde", "array"], substring: "a") == ["abc", "bacd", "array"]
func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```

func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```swift
// Filter an input array of strings only for ones that contain given substring
// filterBySubstring(strings: [] as [String], substring: "a") == [] as [String]
// filterBySubstring(strings: ["abc", "bacd", "cde", "array"], substring: "a") == ["abc", "bacd", "array"]
func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```

func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```swift
// Filter an input array of strings only for ones that contain given substring
// filterBySubstring(strings: [] as [String], substring: "a") == [] as [String]
// filterBySubstring(strings: ["abc", "bacd", "cde", "array"], substring: "a") == ["abc", "bacd", "array"]
func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```

func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```swift
// Filter an input array of strings only for ones that contain given substring
// filterBySubstring(strings: [] as [String], substring: "a") == [] as [String]
// filterBySubstring(strings: ["abc", "bacd", "cde", "array"], substring: "a") == ["abc", "bacd", "array"]
func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```

func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```swift
// Filter an input array of strings only for ones that contain given substring
// filterBySubstring(strings: [] as [String], substring: "a") == [] as [String]
// filterBySubstring(strings: ["abc", "bacd", "cde", "array"], substring: "a") == ["abc", "bacd", "array"]
func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```

func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```swift
// Filter an input array of strings only for ones that contain given substring
// filterBySubstring(strings: [] as [String], substring: "a") == [] as [String]
// filterBySubstring(strings: ["abc", "bacd", "cde", "array"], substring: "a") == ["abc", "bacd", "array"]
func filterBySubstring(strings: [String], substring: String) -> [String] {
    return strings.filter { $0.contains(substring) }
}
```

func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```swift
// For a given array of integers, return a tuple consisting of a sum and a product of all the integers in an array.
// Empty sum should be equal to 0 and empty product should be equal to 1.
// sumProduct(numbers: [] as [Int]) == (0, 1)
// sumProduct(numbers: [1, 2, 3, 4]) == (10, 24)
func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```

func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```swift
// For a given array of integers, return a tuple consisting of a sum and a product of all the integers in an array.
// Empty sum should be equal to 0 and empty product should be equal to 1.
// sumProduct(numbers: [] as [Int]) == (0, 1)
// sumProduct(numbers: [1, 2, 3, 4]) == (10, 24)
func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```

func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```swift
// For a given array of integers, return a tuple consisting of a sum and a product of all the integers in an array.
// Empty sum should be equal to 0 and empty product should be equal to 1.
// sumProduct(numbers: [] as [Int]) == (0, 1)
// sumProduct(numbers: [1, 2, 3, 4]) == (10, 24)
func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```

func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```swift
// For a given array of integers, return a tuple consisting of a sum and a product of all the integers in an array.
// Empty sum should be equal to 0 and empty product should be equal to 1.
// sumProduct(numbers: [] as [Int]) == (0, 1)
// sumProduct(numbers: [1, 2, 3, 4]) == (10, 24)
func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```

func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```swift
// For a given array of integers, return a tuple consisting of a sum and a product of all the integers in an array.
// Empty sum should be equal to 0 and empty product should be equal to 1.
// sumProduct(numbers: [] as [Int]) == (0, 1)
// sumProduct(numbers: [1, 2, 3, 4]) == (10, 24)
func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```

func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```swift
// For a given array of integers, return a tuple consisting of a sum and a product of all the integers in an array.
// Empty sum should be equal to 0 and empty product should be equal to 1.
// sumProduct(numbers: [] as [Int]) == (0, 1)
// sumProduct(numbers: [1, 2, 3, 4]) == (10, 24)
func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```

func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```swift
// For a given array of integers, return a tuple consisting of a sum and a product of all the integers in an array.
// Empty sum should be equal to 0 and empty product should be equal to 1.
// sumProduct(numbers: [] as [Int]) == (0, 1)
// sumProduct(numbers: [1, 2, 3, 4]) == (10, 24)
func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```

func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```swift
// For a given array of integers, return a tuple consisting of a sum and a product of all the integers in an array.
// Empty sum should be equal to 0 and empty product should be equal to 1.
// sumProduct(numbers: [] as [Int]) == (0, 1)
// sumProduct(numbers: [1, 2, 3, 4]) == (10, 24)
func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```

func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```swift
// For a given array of integers, return a tuple consisting of a sum and a product of all the integers in an array.
// Empty sum should be equal to 0 and empty product should be equal to 1.
// sumProduct(numbers: [] as [Int]) == (0, 1)
// sumProduct(numbers: [1, 2, 3, 4]) == (10, 24)
func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for number in numbers {
        sum += number
        product *= number
    }
    return (sum, product)
}
```

func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    
    for number in numbers {
        sum += number
        product *= number
    }
    
    return (sum, product)
}
```swift
// For a given array of integers, return a tuple consisting of a sum and a product of all the integers in an array.
// Empty sum should be equal to 0 and empty product should be equal to 1.
// sumProduct(numbers: [] as [Int]) == (0, 1)
// sumProduct(numbers: [1, 2, 3, 4]) == (10, 24)
func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    
    for number in numbers {
        sum += number
        product *= number
    }
    
    return (sum, product)
}
```

func rollingMax(numbers: [Int]) -> [Int] {
    var max = numbers.first ?? 0
    var result = [Int]()
    for number in numbers {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}
```swift
// From a given array of integers, generate an array of rolling maximum element found until given moment
// in the sequence.
// rollingMax(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 3, 3, 3, 4, 4]
func rollingMax(numbers: [Int]) -> [Int] {
    var max = numbers.first ?? 0
    var result = [Int]()
    for number in numbers {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}
```

func rollingMax(numbers: [Int]) -> [Int] {
    var rollingMax = [Int]()
    var max = numbers.first!
    for number in numbers {
        max = max > number ? max : number
        rollingMax.append(max)
    }
    return rollingMax
}
```swift
// From a given array of integers, generate an array of rolling maximum element found until given moment
// in the sequence.
// rollingMax(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 3, 3, 3, 4, 4]
func rollingMax(numbers: [Int]) -> [Int] {
    var rollingMax = [Int]()
    var max = numbers.first!
    for number in numbers {
        max = max > number ? max : number
        rollingMax.append(max)
    }
    return rollingMax
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func rollingMax(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var max = 0
    for number in numbers {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}
```swift
// From a given array of integers, generate an array of rolling maximum element found until given moment
// in the sequence.
// rollingMax(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 3, 3, 3, 4, 4]
func rollingMax(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var max = 0
    for number in numbers {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}
```

func rollingMax(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var max = numbers.first ?? 0
    for number in numbers {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}
```swift
// From a given array of integers, generate an array of rolling maximum element found until given moment
// in the sequence.
// rollingMax(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 3, 3, 3, 4, 4]
func rollingMax(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var max = numbers.first ?? 0
    for number in numbers {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}
```

func rollingMax(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var max = numbers.first ?? 0
    for number in numbers {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}
```swift
// From a given array of integers, generate an array of rolling maximum element found until given moment
// in the sequence.
// rollingMax(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 3, 3, 3, 4, 4]
func rollingMax(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var max = numbers.first ?? 0
    for number in numbers {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}
```

func rollingMax(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var max = 0
    for number in numbers {
        max = max < number ? number : max
        result.append(max)
    }
    return result
}
```swift
// From a given array of integers, generate an array of rolling maximum element found until given moment
// in the sequence.
// rollingMax(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 3, 3, 3, 4, 4]
func rollingMax(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var max = 0
    for number in numbers {
        max = max < number ? number : max
        result.append(max)
    }
    return result
}
```

func rollingMax(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var max = numbers[0]
    for number in numbers {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}
```swift
// From a given array of integers, generate an array of rolling maximum element found until given moment
// in the sequence.
// rollingMax(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 3, 3, 3, 4, 4]
func rollingMax(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var max = numbers[0]
    for number in numbers {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}
```
 // Fatal error: Index out of range

func rollingMax(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var max = numbers.first!
    for number in numbers {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}

func rollingMin(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var min = numbers.first!
    for number in numbers {
        min = min < number ? min : number
        result.append(min)
    }
    return result
}

func rollingSum(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var sum = numbers.first!
    for number in numbers {
        sum += number
        result.append(sum)
    }
    return result
}

func rollingProduct(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var product = numbers.first!
    for number in numbers {
        product *= number
        result.append(product)
    }
    return result
}

func rollingCount(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var count = numbers.first!
    for number in numbers {
        count += 1
        result.append(count)
    }
    return result
}

func rollingUniqueCount(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var count = numbers.first!
    var uniqueCount = numbers.first!
    for number in numbers {
        count += 1
        if number != uniqueCount {
            uniqueCount = number
            count = 1
        }
        result.append(count)
    }
    return result
}

func rollingCountOfUniqueElements(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var count = numbers.first!
    var uniqueCount = numbers.first!
    for number in numbers {
        count += 1
        if number != uniqueCount {
            uniqueCount = number
            count = 1
        }
        result.append(uniqueCount)
    }
    return result
}
```swift
// From a given array of integers, generate an array of rolling maximum element found until given moment
// in the sequence.
// rollingMax(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 3, 3, 3, 4, 4]
func rollingMax(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var max = numbers.first!
    for number in numbers {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}

// From a given array of integers, generate an array of rolling minimum element found until given moment
// in the sequence.
// rollingMin(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 1, 1, 2, 2, 2, 2]
func rollingMin(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var min = numbers.first!
    for number in numbers {
        min = min < number ? min : number
        result.append(min)
    }
    return result
}

// From a given array of integers, generate an array of rolling sum until given moment in the sequence.
// rollingSum(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 3, 6, 8, 10, 14, 16]
func rollingSum(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var sum = numbers.first!
    for number in numbers {
        sum += number
        result.append(sum)
    }
    return result
}

// From a given array of integers, generate an array of rolling product until given moment in the sequence.
// rollingProduct(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 6, 12, 24, 48, 48]
func rollingProduct(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var product = numbers.first!
    for number in numbers {
        product *= number
        result.append(product)
    }
    return result
}

// From a given array of integers, generate an array of rolling count until given moment in the sequence.
// rollingCount(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 3, 3, 4, 5, 6]
func rollingCount(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var count = numbers.first!
    for number in numbers {
        count += 1
        result.append(count)
    }
    return result
}

// From a given array of integers, generate an array of rolling count of unique elements until given moment in the sequence.
// rollingUniqueCount(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 3, 2, 3, 4, 2]
func rollingUniqueCount(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var count = numbers.first!
    var uniqueCount = numbers.first!
    for number in numbers {
        count += 1
        if number != uniqueCount {
            uniqueCount = number
            count = 1
        }
        result.append(count)
    }
    return result
}

// From a given array of integers, generate an array of rolling count of unique elements until given moment in the sequence.
// rollingCountOfUniqueElements(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 3, 2, 3, 4, 2]
func rollingCountOfUniqueElements(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var count = numbers.first!
    var uniqueCount = numbers.first!
    for number in numbers {
        count += 1
        if number != uniqueCount {
            uniqueCount = number
            count = 1
        }
        result.append(uniqueCount)
    }
    return result
}

// From a given array of integers, generate an array of rolling count of unique elements until given moment in the sequence.
// rollingCountOfUniqueElements(numbers: [1, 2, 3, 2, 3, 4,
for number in numbers { // immutable value 'number' was never used; consider replacing with '_' or removing it
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func rollingMax(numbers: [Int]) -> [Int] {
    var max = numbers[0]
    var result = [max]
    for number in numbers[1..<numbers.count] {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}
```swift
// From a given array of integers, generate an array of rolling maximum element found until given moment
// in the sequence.
// rollingMax(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 3, 3, 3, 4, 4]
func rollingMax(numbers: [Int]) -> [Int] {
    var max = numbers[0]
    var result = [max]
    for number in numbers[1..<numbers.count] {
        max = max > number ? max : number
        result.append(max)
    }
    return result
}
```
 // Fatal error: Index out of range

func rollingMax(numbers: [Int]) -> [Int] {
    var max: Int = 0
    var result: [Int] = []
    for number in numbers {
        if number > max {
            max = number
        }
        result.append(max)
    }
    return result
}
```swift
// From a given array of integers, generate an array of rolling maximum element found until given moment
// in the sequence.
// rollingMax(numbers: [1, 2, 3, 2, 3, 4, 2]) == [1, 2, 3, 3, 3, 4, 4]
func rollingMax(numbers: [Int]) -> [Int] {
    var max: Int = 0
    var result: [Int] = []
    for number in numbers {
        if number > max {
            max = number
        }
        result.append(max)
    }
    return result
}
```

func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return "" }
    
    let suffix = longestPalindromeSuffix(string: string)
    let prefix = longestPalindromePrefix(string: string)
    
    return string + String(prefix.reversed())
}

func longestPalindromeSuffix(string: String) -> String {
    guard !string.isEmpty else { return "" }
    
    var suffix = string
    var reversedSuffix = suffix.reversed()
    
    while suffix != reversedSuffix {
        suffix = suffix.dropFirst()
        reversedSuffix = reversedSuffix.dropLast()
    }
    
    return suffix
}

func longestPalindromePrefix(string: String) -> String {
    guard !string.isEmpty else { return "" }
    
    var prefix = string
    var reversedPrefix = prefix.reversed()
    
    while prefix != reversedPrefix {
        prefix = prefix.dropLast()
        reversedPrefix = reversedPrefix.dropFirst()
    }
    
    return prefix
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return "" }
    
    let suffix = longestPalindromeSuffix(string: string)
    let prefix = longestPalindromePrefix(string: string)
    
    return string + String(prefix.reversed())
}

// Find the longest palindrome suffix of a supplied string.
// Algorithm idea is simple:
// - Find the longest palindrome suffix of the string.
// - If the suffix is not a palindrome, return the empty string.
// longestPalindromeSuffix(string: "") == ""
// longestPalindromeSuffix(string: "cat") == "t"
// longestPalindromeSuffix(string: "cata") == "ata"
func longestPalindromeSuffix(string: String) -> String {
    guard !string.isEmpty else { return "" }
    
    var suffix = string
    var reversedSuffix = suffix.reversed()
    
    while suffix != reversedSuffix {
        suffix = suffix.dropFirst()
        reversedSuffix = reversedSuffix.dropLast()
    }
    
    return suffix
}

// Find the longest palindrome prefix of a supplied string.
// Algorithm idea is simple:
// - Find the longest palindrome prefix of the string.
// - If the prefix is not a palindrome, return the empty string.
// longestPalindromePrefix(string: "") == ""
// longestPalindromePrefix(string: "cat") == "c"
// longestPalindromePrefix(string: "cata") == "cat"
func longestPalindromePrefix(string: String) -> String {
    guard !string.isEmpty else { return "" }
    
    var prefix = string
    var reversedPrefix = prefix.reversed()
    
    while prefix != reversedPrefix {
        prefix = prefix.dropLast()
        reversedPrefix = reversedPrefix.dropFirst()
    }
    
    return prefix
}
```
let suffix = longestPalindromeSuffix(string: string) // initialization of immutable value 'suffix' was never used; consider replacing with assignment to '_' or removing it
while suffix != reversedSuffix { // cannot convert value of type 'ReversedCollection<String>' to expected argument type 'String'
suffix = suffix.dropFirst() // no 'dropFirst' candidates produce the expected contextual result type 'String'
reversedSuffix = reversedSuffix.dropLast() // no 'dropLast' candidates produce the expected contextual result type 'ReversedCollection<String>'
while prefix != reversedPrefix { // cannot convert value of type 'ReversedCollection<String>' to expected argument type 'String'
prefix = prefix.dropLast() // no 'dropLast' candidates produce the expected contextual result type 'String'
reversedPrefix = reversedPrefix.dropFirst() // no 'dropFirst' candidates produce the expected contextual result type 'ReversedCollection<String>'

func makePalindrome(string: String) -> String {
    let reversedString = String(string.reversed())
    let longestCommonSuffix = longestCommonSuffix(string, reversedString)
    let prefix = string.prefix(string.count - longestCommonSuffix.count)
    return prefix + longestCommonSuffix + String(prefix.reversed())
}

func longestCommonSuffix(_ string1: String, _ string2: String) -> String {
    var longestSuffix = ""
    var index = 0
    while index < string1.count && index < string2.count {
        if string1[string1.index(string1.startIndex, offsetBy: index)] == string2[string2.index(string2.startIndex, offsetBy: index)] {
            longestSuffix = string1[string1.index(string1.startIndex, offsetBy: index)...]
            index += 1
        } else {
            break
        }
    }
    return longestSuffix
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    let reversedString = String(string.reversed())
    let longestCommonSuffix = longestCommonSuffix(string, reversedString)
    let prefix = string.prefix(string.count - longestCommonSuffix.count)
    return prefix + longestCommonSuffix + String(prefix.reversed())
}

// Find the longest common suffix of two strings.
// Algorithm idea is simple:
// - Find the longest prefix of the first string that is also a prefix of the second string.
// - Return the suffix of the first string that comes after the prefix.
// longestCommonSuffix("cat", "cata") == "a"
// longestCommonSuffix("cat", "cats") == ""
// longestCommonSuffix("cats", "cata") == "a"
func longestCommonSuffix(_ string1: String, _ string2: String) -> String {
    var longestSuffix = ""
    var index = 0
    while index < string1.count && index < string2.count {
        if string1[string1.index(string1.startIndex, offsetBy: index)] == string2[string2.index(string2.startIndex, offsetBy: index)] {
            longestSuffix = string1[string1.index(string1.startIndex, offsetBy: index)...]
            index += 1
        } else {
            break
        }
    }
    return longestSuffix
}
```
longestSuffix = string1[string1.index(string1.startIndex, offsetBy: index)...] // cannot assign value of type 'String.SubSequence' (aka 'Substring') to type 'String'

func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return string }
    let reversedString = string.reversed()
    guard let index = string.range(of: reversedString, options: .anchored) else { return string }
    return String(string.prefix(upTo: index.lowerBound)) + reversedString
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return string }
    let reversedString = string.reversed()
    guard let index = string.range(of: reversedString, options: .anchored) else { return string }
    return String(string.prefix(upTo: index.lowerBound)) + reversedString
}
```
guard let index = string.range(of: reversedString, options: .anchored) else { return string } // instance method 'range(of:options:range:locale:)' requires that 'ReversedCollection<String>' conform to 'StringProtocol'

func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return "" }
    
    let suffix = longestPalindromeSuffix(string: string)
    let prefix = longestPalindromePrefix(string: string.dropLast(suffix.count))
    
    return String(prefix + suffix + suffix.reversed())
}

func longestPalindromeSuffix(string: String) -> String {
    var string = string
    var suffix = ""
    
    while !string.isEmpty {
        if string.dropFirst().reversed() == string.dropLast() {
            suffix = string
            break
        }
        
        string.removeLast()
    }
    
    return suffix
}

func longestPalindromePrefix(string: String) -> String {
    var string = string
    var prefix = ""
    
    while !string.isEmpty {
        if string.dropFirst().reversed() == string.dropLast() {
            prefix = string
            break
        }
        
        string.removeFirst()
    }
    
    return prefix
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return "" }
    
    let suffix = longestPalindromeSuffix(string: string)
    let prefix = longestPalindromePrefix(string: string.dropLast(suffix.count))
    
    return String(prefix + suffix + suffix.reversed())
}

func longestPalindromeSuffix(string: String) -> String {
    var string = string
    var suffix = ""
    
    while !string.isEmpty {
        if string.dropFirst().reversed() == string.dropLast() {
            suffix = string
            break
        }
        
        string.removeLast()
    }
    
    return suffix
}

func longestPalindromePrefix(string: String) -> String {
    var string = string
    var prefix = ""
    
    while !string.isEmpty {
        if string.dropFirst().reversed() == string.dropLast() {
            prefix = string
            break
        }
        
        string.removeFirst()
    }
    
    return prefix
}
```
let prefix = longestPalindromePrefix(string: string.dropLast(suffix.count)) // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'

func makePalindrome(string: String) -> String {
    let reversed = String(string.reversed())
    if string == reversed {
        return string
    }
    let prefix = longestCommonPrefix(string, reversed)
    let suffix = longestCommonSuffix(string, reversed)
    return string + suffix + String(suffix.reversed())
}

func longestCommonPrefix(_ string: String, _ reversed: String) -> String {
    var prefix = ""
    for (i, char) in string.enumerated() {
        if char != reversed[i] {
            return prefix
        }
        prefix.append(char)
    }
    return prefix
}

func longestCommonSuffix(_ string: String, _ reversed: String) -> String {
    var suffix = ""
    for (i, char) in reversed.enumerated() {
        if char != string[i] {
            return suffix
        }
        suffix.append(char)
    }
    return suffix
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    let reversed = String(string.reversed())
    if string == reversed {
        return string
    }
    let prefix = longestCommonPrefix(string, reversed)
    let suffix = longestCommonSuffix(string, reversed)
    return string + suffix + String(suffix.reversed())
}

func longestCommonPrefix(_ string: String, _ reversed: String) -> String {
    var prefix = ""
    for (i, char) in string.enumerated() {
        if char != reversed[i] {
            return prefix
        }
        prefix.append(char)
    }
    return prefix
}

func longestCommonSuffix(_ string: String, _ reversed: String) -> String {
    var suffix = ""
    for (i, char) in reversed.enumerated() {
        if char != string[i] {
            return suffix
        }
        suffix.append(char)
    }
    return suffix
}
```
let prefix = longestCommonPrefix(string, reversed) // initialization of immutable value 'prefix' was never used; consider replacing with assignment to '_' or removing it
if char != reversed[i] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if char != string[i] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return string }
    
    let suffix = longestPalindromicSuffix(string)
    let prefix = longestPalindromicPrefix(string.dropLast(suffix.count))
    
    return String(prefix + suffix + suffix.reversed())
}

func longestPalindromicSuffix(_ string: String) -> String {
    var longestSuffix = ""
    for i in stride(from: string.count - 1, through: 0, by: -1) {
        let suffix = String(string[string.index(string.startIndex, offsetBy: i)...])
        if isPalindrome(suffix) && suffix.count > longestSuffix.count {
            longestSuffix = suffix
        }
    }
    return longestSuffix
}

func longestPalindromicPrefix(_ string: String) -> String {
    var longestPrefix = ""
    for i in 0..<string.count {
        let prefix = String(string[string.startIndex..<string.index(string.startIndex, offsetBy: i)])
        if isPalindrome(prefix) && prefix.count > longestPrefix.count {
            longestPrefix = prefix
        }
    }
    return longestPrefix
}

func isPalindrome(_ string: String) -> Bool {
    for i in 0..<string.count {
        if string[string.index(string.startIndex, offsetBy: i)] != string[string.index(string.endIndex, offsetBy: -i)] {
            return false
        }
    }
    return true
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return string }
    
    let suffix = longestPalindromicSuffix(string)
    let prefix = longestPalindromicPrefix(string.dropLast(suffix.count))
    
    return String(prefix + suffix + suffix.reversed())
}

func longestPalindromicSuffix(_ string: String) -> String {
    var longestSuffix = ""
    for i in stride(from: string.count - 1, through: 0, by: -1) {
        let suffix = String(string[string.index(string.startIndex, offsetBy: i)...])
        if isPalindrome(suffix) && suffix.count > longestSuffix.count {
            longestSuffix = suffix
        }
    }
    return longestSuffix
}

func longestPalindromicPrefix(_ string: String) -> String {
    var longestPrefix = ""
    for i in 0..<string.count {
        let prefix = String(string[string.startIndex..<string.index(string.startIndex, offsetBy: i)])
        if isPalindrome(prefix) && prefix.count > longestPrefix.count {
            longestPrefix = prefix
        }
    }
    return longestPrefix
}

func isPalindrome(_ string: String) -> Bool {
    for i in 0..<string.count {
        if string[string.index(string.startIndex, offsetBy: i)] != string[string.index(string.endIndex, offsetBy: -i)] {
            return false
        }
    }
    return true
}
```
let prefix = longestPalindromicPrefix(string.dropLast(suffix.count)) // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'

func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return "" }
    let reversedString = string.reversed()
    let longestPalindrome = longestPalindrome(string: string)
    let prefix = string.prefix(string.count - longestPalindrome.count)
    return String(prefix + longestPalindrome + reversedString)
}

func longestPalindrome(string: String) -> String {
    guard !string.isEmpty else { return "" }
    let reversedString = string.reversed()
    var longestPalindrome = ""
    for i in 0..<string.count {
        for j in 0..<string.count {
            let substring = String(string[i...j])
            if substring == substring.reversed() && substring.count > longestPalindrome.count {
                longestPalindrome = substring
            }
        }
    }
    return longestPalindrome
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return "" }
    let reversedString = string.reversed()
    let longestPalindrome = longestPalindrome(string: string)
    let prefix = string.prefix(string.count - longestPalindrome.count)
    return String(prefix + longestPalindrome + reversedString)
}

func longestPalindrome(string: String) -> String {
    guard !string.isEmpty else { return "" }
    let reversedString = string.reversed()
    var longestPalindrome = ""
    for i in 0..<string.count {
        for j in 0..<string.count {
            let substring = String(string[i...j])
            if substring == substring.reversed() && substring.count > longestPalindrome.count {
                longestPalindrome = substring
            }
        }
    }
    return longestPalindrome
}
```
let substring = String(string[i...j]) // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.
if substring == substring.reversed() && substring.count > longestPalindrome.count { // cannot convert value of type 'ReversedCollection<String>' to expected argument type 'String'

func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return "" }
    let reversedString = string.reversed()
    let prefix = string.prefix(while: { $0 == reversedString.first })
    let suffix = string.suffix(while: { $0 == reversedString.last })
    return String(prefix) + String(suffix.reversed()) + String(reversedString.dropFirst())
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return "" }
    let reversedString = string.reversed()
    let prefix = string.prefix(while: { $0 == reversedString.first })
    let suffix = string.suffix(while: { $0 == reversedString.last })
    return String(prefix) + String(suffix.reversed()) + String(reversedString.dropFirst())
}
```
let suffix = string.suffix(while: { $0 == reversedString.last }) // no exact matches in call to instance method 'suffix'

func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return string }
    guard let longestSuffix = longestPalindromeSuffix(string: string) else { return string }
    let prefix = string.prefix(string.count - longestSuffix.count)
    return prefix + longestSuffix + String(prefix.reversed())
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return string }
    guard let longestSuffix = longestPalindromeSuffix(string: string) else { return string }
    let prefix = string.prefix(string.count - longestSuffix.count)
    return prefix + longestSuffix + String(prefix.reversed())
}

// Find the longest palindromic suffix of a supplied string.
// - If the string is empty, return nil.
// - If the string is a palindrome, return the string.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
// - If the string is not a palindrome, find the longest palindromic suffix.
guard let longestSuffix = longestPalindromeSuffix(string: string) else { return string } // cannot find 'longestPalindromeSuffix' in scope

func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return "" }

    let reversedString = string.reversed()
    let longestSuffix = longestPalindromicSuffix(string: string)
    let longestSuffixReversed = longestSuffix.reversed()

    let prefix = string.dropLast(longestSuffix.count)
    let prefixReversed = prefix.reversed()

    let suffix = longestSuffixReversed.dropFirst(longestSuffix.count)

    return String(prefixReversed) + suffix + longestSuffix
}

func longestPalindromicSuffix(string: String) -> String {
    guard !string.isEmpty else { return "" }

    let reversedString = string.reversed()
    var longestSuffix = ""

    for i in 0..<string.count {
        let prefix = string.dropFirst(i)
        let suffix = reversedString.dropFirst(i)

        if prefix == suffix {
            longestSuffix = prefix
        }
    }

    return longestSuffix
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    guard !string.isEmpty else { return "" }

    let reversedString = string.reversed()
    let longestSuffix = longestPalindromicSuffix(string: string)
    let longestSuffixReversed = longestSuffix.reversed()

    let prefix = string.dropLast(longestSuffix.count)
    let prefixReversed = prefix.reversed()

    let suffix = longestSuffixReversed.dropFirst(longestSuffix.count)

    return String(prefixReversed) + suffix + longestSuffix
}

func longestPalindromicSuffix(string: String) -> String {
    guard !string.isEmpty else { return "" }

    let reversedString = string.reversed()
    var longestSuffix = ""

    for i in 0..<string.count {
        let prefix = string.dropFirst(i)
        let suffix = reversedString.dropFirst(i)

        if prefix == suffix {
            longestSuffix = prefix
        }
    }

    return longestSuffix
}
```
let reversedString = string.reversed() // initialization of immutable value 'reversedString' was never used; consider replacing with assignment to '_' or removing it
if prefix == suffix { // cannot convert value of type 'ReversedCollection<String>.SubSequence' (aka 'Slice<ReversedCollection<String>>') to expected argument type 'String.SubSequence' (aka 'Substring')
longestSuffix = prefix // cannot assign value of type 'String.SubSequence' (aka 'Substring') to type 'String'

func stringXor(a: String, b: String) -> String {
    var result = ""
    for (i, char) in a.enumerated() {
        let aChar = char == "1" ? 1 : 0
        let bChar = b[i] == "1" ? 1 : 0
        result.append(aChar ^ bChar == 1 ? "1" : "0")
    }
    return result
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    var result = ""
    for (i, char) in a.enumerated() {
        let aChar = char == "1" ? 1 : 0
        let bChar = b[i] == "1" ? 1 : 0
        result.append(aChar ^ bChar == 1 ? "1" : "0")
    }
    return result
}
```
let bChar = b[i] == "1" ? 1 : 0 // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func stringXor(a: String, b: String) -> String {
    let aArray = Array(a)
    let bArray = Array(b)
    var result = ""
    for i in 0..<aArray.count {
        let aChar = aArray[i]
        let bChar = bArray[i]
        if aChar == bChar {
            result.append("0")
        } else {
            result.append("1")
        }
    }
    return result
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    let aArray = Array(a)
    let bArray = Array(b)
    var result = ""
    for i in 0..<aArray.count {
        let aChar = aArray[i]
        let bChar = bArray[i]
        if aChar == bChar {
            result.append("0")
        } else {
            result.append("1")
        }
    }
    return result
}
```

func stringXor(a: String, b: String) -> String {
    let a = a.map { $0 == "1" ? "1" : "0" }
    let b = b.map { $0 == "1" ? "1" : "0" }
    return zip(a, b).map { $0 == $1 ? "0" : "1" }.joined()
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    let a = a.map { $0 == "1" ? "1" : "0" }
    let b = b.map { $0 == "1" ? "1" : "0" }
    return zip(a, b).map { $0 == $1 ? "0" : "1" }.joined()
}
```

func stringXor(a: String, b: String) -> String {
    var result = ""
    for (i, j) in zip(a, b) {
        result.append(i != j ? "1" : "0")
    }
    return result
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    var result = ""
    for (i, j) in zip(a, b) {
        result.append(i != j ? "1" : "0")
    }
    return result
}
```

func stringXor(a: String, b: String) -> String {
    return String(a.unicodeScalars.lazy.map { a in
        let b = b[a.unicodeScalars.indices.first!]
        return a == b ? "0" : "1"
    })
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    return String(a.unicodeScalars.lazy.map { a in
        let b = b[a.unicodeScalars.indices.first!]
        return a == b ? "0" : "1"
    })
}
```
let b = b[a.unicodeScalars.indices.first!] // value of type 'LazySequence<String.UnicodeScalarView>.Element' (aka 'Unicode.Scalar') has no member 'unicodeScalars'

func stringXor(a: String, b: String) -> String {
    return zip(a, b).map { $0.0 ^ $0.1 }.map { String($0) }.joined()
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    return zip(a, b).map { $0.0 ^ $0.1 }.map { String($0) }.joined()
}
```
return zip(a, b).map { $0.0 ^ $0.1 }.map { String($0) }.joined() // binary operator '^' cannot be applied to two 'String.Element' (aka 'Character') operands

func stringXor(a: String, b: String) -> String {
    let a = Array(a)
    let b = Array(b)
    var result = ""
    for i in 0..<a.count {
        if a[i] == b[i] {
            result.append("0")
        } else {
            result.append("1")
        }
    }
    return result
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    let a = Array(a)
    let b = Array(b)
    var result = ""
    for i in 0..<a.count {
        if a[i] == b[i] {
            result.append("0")
        } else {
            result.append("1")
        }
    }
    return result
}
```

func stringXor(a: String, b: String) -> String {
    let aArray = Array(a)
    let bArray = Array(b)
    var result = ""
    for i in 0..<aArray.count {
        if aArray[i] == bArray[i] {
            result.append("0")
        } else {
            result.append("1")
        }
    }
    return result
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    let aArray = Array(a)
    let bArray = Array(b)
    var result = ""
    for i in 0..<aArray.count {
        if aArray[i] == bArray[i] {
            result.append("0")
        } else {
            result.append("1")
        }
    }
    return result
}
```

func stringXor(a: String, b: String) -> String {
    return zip(a, b).map { $0 ^ $1 }.map { String($0) }.joined()
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    return zip(a, b).map { $0 ^ $1 }.map { String($0) }.joined()
}
```
return zip(a, b).map { $0 ^ $1 }.map { String($0) }.joined() // binary operator '^' cannot be applied to two 'String.Element' (aka 'Character') operands

func stringXor(a: String, b: String) -> String {
    return String(a.unicodeScalars.lazy.map { a in
        let b = b[b.index(b.startIndex, offsetBy: a.unicodeScalars.distance(of: a, in: a.unicodeScalars)) % b.count]
        return a.unicodeScalars.distance(of: a, in: a.unicodeScalars) % 2 == b.unicodeScalars.distance(of: b, in: b.unicodeScalars) % 2 ? "0" : "1"
    })
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    return String(a.unicodeScalars.lazy.map { a in
        let b = b[b.index(b.startIndex, offsetBy: a.unicodeScalars.distance(of: a, in: a.unicodeScalars)) % b.count]
        return a.unicodeScalars.distance(of: a, in: a.unicodeScalars) % 2 == b.unicodeScalars.distance(of: b, in: b.unicodeScalars) % 2 ? "0" : "1"
    })
}
```
let b = b[b.index(b.startIndex, offsetBy: a.unicodeScalars.distance(of: a, in: a.unicodeScalars)) % b.count] // value of type 'LazySequence<String.UnicodeScalarView>.Element' (aka 'Unicode.Scalar') has no member 'unicodeScalars'
let b = b[b.index(b.startIndex, offsetBy: a.unicodeScalars.distance(of: a, in: a.unicodeScalars)) % b.count] // value of type 'LazySequence<String.UnicodeScalarView>.Element' (aka 'Unicode.Scalar') has no member 'unicodeScalars'
let b = b[b.index(b.startIndex, offsetBy: a.unicodeScalars.distance(of: a, in: a.unicodeScalars)) % b.count] // cannot convert value of type 'String.Index' to expected argument type 'Int'

func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    var longest = strings[0]
    for string in strings {
        if string.count > longest.count {
            longest = string
        }
    }
    return longest
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    var longest = strings[0]
    for string in strings {
        if string.count > longest.count {
            longest = string
        }
    }
    return longest
}
```

func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max { $0.count < $1.count }
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max { $0.count < $1.count }
}
```

func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max { $0.count < $1.count }
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max { $0.count < $1.count }
}
```

func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    var longest = strings[0]
    for string in strings {
        if string.count > longest.count {
            longest = string
        }
    }
    return longest
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    var longest = strings[0]
    for string in strings {
        if string.count > longest.count {
            longest = string
        }
    }
    return longest
}
```

func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max(by: { $0.count > $1.count })
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max(by: { $0.count > $1.count })
}
```
 // XCTAssertTrue failed

func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max(by: { $0.count < $1.count })
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max(by: { $0.count < $1.count })
}
```

func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    var longest = strings[0]
    for string in strings {
        if string.count > longest.count {
            longest = string
        }
    }
    return longest
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    var longest = strings[0]
    for string in strings {
        if string.count > longest.count {
            longest = string
        }
    }
    return longest
}
```

func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max { $0.count < $1.count }
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max { $0.count < $1.count }
}
```

func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max { $0.count < $1.count }
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max { $0.count < $1.count }
}
```

func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max { $0.count < $1.count }
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    guard !strings.isEmpty else { return nil }
    return strings.max { $0.count < $1.count }
}
```

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    } else if b == 0 {
        return a
    }

    var a = a
    var b = b

    if a < b {
        (a, b) = (b, a)
    }

    var remainder = a % b

    while remainder != 0 {
        a = b
        b = remainder
        remainder = a % b
    }

    return b
}
```swift
// Return a greatest common divisor of two integers a and b
// greatestCommonDivisor(a: 3, b: 5) == 1
// greatestCommonDivisor(a: 25, b: 15) == 5
func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    } else if b == 0 {
        return a
    }

    var a = a
    var b = b

    if a < b {
        (a, b) = (b, a)
    }

    var remainder = a % b

    while remainder != 0 {
        a = b
        b = remainder
        remainder = a % b
    }

    return b
}
```

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    } else if b == 0 {
        return a
    }
    if a < b {
        return greatestCommonDivisor(a: b, b: a)
    }
    let remainder = a % b
    if remainder == 0 {
        return b
    }
    return greatestCommonDivisor(a: b, b: remainder)
}
```swift
// Return a greatest common divisor of two integers a and b
// greatestCommonDivisor(a: 3, b: 5) == 1
// greatestCommonDivisor(a: 25, b: 15) == 5
func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    } else if b == 0 {
        return a
    }
    if a < b {
        return greatestCommonDivisor(a: b, b: a)
    }
    let remainder = a % b
    if remainder == 0 {
        return b
    }
    return greatestCommonDivisor(a: b, b: remainder)
}
```

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    }
    if b == 0 {
        return a
    }
    if a == b {
        return a
    }
    if a > b {
        return greatestCommonDivisor(a: a - b, b: b)
    } else {
        return greatestCommonDivisor(a: a, b: b - a)
    }
}
```swift
// Return a greatest common divisor of two integers a and b
// greatestCommonDivisor(a: 3, b: 5) == 1
// greatestCommonDivisor(a: 25, b: 15) == 5
func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    }
    if b == 0 {
        return a
    }
    if a == b {
        return a
    }
    if a > b {
        return greatestCommonDivisor(a: a - b, b: b)
    } else {
        return greatestCommonDivisor(a: a, b: b - a)
    }
}
```

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    } else if b == 0 {
        return a
    }

    var a = a
    var b = b

    if a < b {
        (a, b) = (b, a)
    }

    var remainder = a % b

    while remainder != 0 {
        a = b
        b = remainder
        remainder = a % b
    }

    return b
}
```swift
// Return a greatest common divisor of two integers a and b
// greatestCommonDivisor(a: 3, b: 5) == 1
// greatestCommonDivisor(a: 25, b: 15) == 5
func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    } else if b == 0 {
        return a
    }

    var a = a
    var b = b

    if a < b {
        (a, b) = (b, a)
    }

    var remainder = a % b

    while remainder != 0 {
        a = b
        b = remainder
        remainder = a % b
    }

    return b
}
```

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 || b == 0 {
        return 0
    }
    if a == b {
        return a
    }
    if a > b {
        return greatestCommonDivisor(a: a - b, b: b)
    }
    return greatestCommonDivisor(a: a, b: b - a)
}
```swift
// Return a greatest common divisor of two integers a and b
// greatestCommonDivisor(a: 3, b: 5) == 1
// greatestCommonDivisor(a: 25, b: 15) == 5
func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 || b == 0 {
        return 0
    }
    if a == b {
        return a
    }
    if a > b {
        return greatestCommonDivisor(a: a - b, b: b)
    }
    return greatestCommonDivisor(a: a, b: b - a)
}
```

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 || b == 0 {
        return 0
    }
    if a == b {
        return a
    }
    if a > b {
        return greatestCommonDivisor(a: a - b, b: b)
    }
    return greatestCommonDivisor(a: a, b: b - a)
}
```swift
// Return a greatest common divisor of two integers a and b
// greatestCommonDivisor(a: 3, b: 5) == 1
// greatestCommonDivisor(a: 25, b: 15) == 5
func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 || b == 0 {
        return 0
    }
    if a == b {
        return a
    }
    if a > b {
        return greatestCommonDivisor(a: a - b, b: b)
    }
    return greatestCommonDivisor(a: a, b: b - a)
}
```

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    }
    if b == 0 {
        return a
    }
    if a == b {
        return a
    }
    if a > b {
        return greatestCommonDivisor(a: a - b, b: b)
    }
    return greatestCommonDivisor(a: a, b: b - a)
}
```swift
// Return a greatest common divisor of two integers a and b
// greatestCommonDivisor(a: 3, b: 5) == 1
// greatestCommonDivisor(a: 25, b: 15) == 5
func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    }
    if b == 0 {
        return a
    }
    if a == b {
        return a
    }
    if a > b {
        return greatestCommonDivisor(a: a - b, b: b)
    }
    return greatestCommonDivisor(a: a, b: b - a)
}
```

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    }
    return greatestCommonDivisor(a: b % a, b: a)
}
```swift
// Return a greatest common divisor of two integers a and b
// greatestCommonDivisor(a: 3, b: 5) == 1
// greatestCommonDivisor(a: 25, b: 15) == 5
func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    }
    return greatestCommonDivisor(a: b % a, b: a)
}
```

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    }
    if b == 0 {
        return a
    }
    if a == b {
        return a
    }
    if a > b {
        return greatestCommonDivisor(a: a - b, b: b)
    }
    return greatestCommonDivisor(a: a, b: b - a)
}
```swift
// Return a greatest common divisor of two integers a and b
// greatestCommonDivisor(a: 3, b: 5) == 1
// greatestCommonDivisor(a: 25, b: 15) == 5
func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    }
    if b == 0 {
        return a
    }
    if a == b {
        return a
    }
    if a > b {
        return greatestCommonDivisor(a: a - b, b: b)
    }
    return greatestCommonDivisor(a: a, b: b - a)
}
```

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    }
    if b == 0 {
        return a
    }
    if a == b {
        return a
    }
    if a > b {
        return greatestCommonDivisor(a: a - b, b: b)
    }
    return greatestCommonDivisor(a: a, b: b - a)
}
```swift
// Return a greatest common divisor of two integers a and b
// greatestCommonDivisor(a: 3, b: 5) == 1
// greatestCommonDivisor(a: 25, b: 15) == 5
func greatestCommonDivisor(a: Int, b: Int) -> Int {
    if a == 0 {
        return b
    }
    if b == 0 {
        return a
    }
    if a == b {
        return a
    }
    if a > b {
        return greatestCommonDivisor(a: a - b, b: b)
    }
    return greatestCommonDivisor(a: a, b: b - a)
}
```

func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { i in
        let prefix = string[..<i]
        return String(prefix)
    }
}
```swift
// Return array of all prefixes from shortest to longest of the input string
// allPrefixes(string: "abc") == ["a", "ab", "abc"]
func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { i in
        let prefix = string[..<i]
        return String(prefix)
    }
}
```
let prefix = string[..<i] // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { string[$0..<string.count] }
}
```swift
// Return array of all prefixes from shortest to longest of the input string
// allPrefixes(string: "abc") == ["a", "ab", "abc"]
func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { string[$0..<string.count] }
}
```
return (0..<string.count).map { string[$0..<string.count] } // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { string.prefix(upTo: $0) }
}
```swift
// Return array of all prefixes from shortest to longest of the input string
// allPrefixes(string: "abc") == ["a", "ab", "abc"]
func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { string.prefix(upTo: $0) }
}
```
return (0..<string.count).map { string.prefix(upTo: $0) } // cannot convert value of type 'Int' to expected argument type 'String.Index'

func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { i in
        return String(string[string.startIndex..<string.index(string.startIndex, offsetBy: i)])
    }
}
```swift
// Return array of all prefixes from shortest to longest of the input string
// allPrefixes(string: "abc") == ["a", "ab", "abc"]
func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { i in
        return String(string[string.startIndex..<string.index(string.startIndex, offsetBy: i)])
    }
}
```
 // XCTAssertTrue failed

func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { string.prefix(upTo: $0) }
}
```swift
// Return array of all prefixes from shortest to longest of the input string
// allPrefixes(string: "abc") == ["a", "ab", "abc"]
func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { string.prefix(upTo: $0) }
}
```
return (0..<string.count).map { string.prefix(upTo: $0) } // cannot convert value of type 'Int' to expected argument type 'String.Index'

func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { string[$0..<string.count] }
}
```swift
// Return array of all prefixes from shortest to longest of the input string
// allPrefixes(string: "abc") == ["a", "ab", "abc"]
func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { string[$0..<string.count] }
}
```
return (0..<string.count).map { string[$0..<string.count] } // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func allPrefixes(string: String) -> [String] {
    var prefixes = [String]()
    for i in 0...string.count {
        prefixes.append(String(string.prefix(i)))
    }
    return prefixes
}
```swift
// Return array of all prefixes from shortest to longest of the input string
// allPrefixes(string: "abc") == ["a", "ab", "abc"]
func allPrefixes(string: String) -> [String] {
    var prefixes = [String]()
    for i in 0...string.count {
        prefixes.append(String(string.prefix(i)))
    }
    return prefixes
}
```
 // XCTAssertTrue failed

func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { i in
        return String(string[string.startIndex..<string.index(string.startIndex, offsetBy: i)])
    }
}
```swift
// Return array of all prefixes from shortest to longest of the input string
// allPrefixes(string: "abc") == ["a", "ab", "abc"]
func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { i in
        return String(string[string.startIndex..<string.index(string.startIndex, offsetBy: i)])
    }
}
```
 // XCTAssertTrue failed

func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { i in
        return String(string[string.startIndex..<string.index(string.startIndex, offsetBy: i)])
    }
}
```swift
// Return array of all prefixes from shortest to longest of the input string
// allPrefixes(string: "abc") == ["a", "ab", "abc"]
func allPrefixes(string: String) -> [String] {
    return (0..<string.count).map { i in
        return String(string[string.startIndex..<string.index(string.startIndex, offsetBy: i)])
    }
}
```
 // XCTAssertTrue failed

func allPrefixes(string: String) -> [String] {
    var prefixes = [String]()
    for i in 0...string.count {
        prefixes.append(String(string[string.startIndex..<string.index(string.startIndex, offsetBy: i)]))
    }
    return prefixes
}
```swift
// Return array of all prefixes from shortest to longest of the input string
// allPrefixes(string: "abc") == ["a", "ab", "abc"]
func allPrefixes(string: String) -> [String] {
    var prefixes = [String]()
    for i in 0...string.count {
        prefixes.append(String(string[string.startIndex..<string.index(string.startIndex, offsetBy: i)]))
    }
    return prefixes
}
```
 // XCTAssertTrue failed

func stringSequence(n: Int) -> String {
  var result = ""
  for i in 0...n {
    result += "\(i) "
  }
  return result
}
```swift
// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
// stringSequence(n: 0) == "0"
// stringSequence(n: 5) == "0 1 2 3 4 5"
func stringSequence(n: Int) -> String {
  var result = ""
  for i in 0...n {
    result += "\(i) "
  }
  return result
}
```
 // XCTAssertTrue failed

func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0...n {
        result += "\(i) "
    }
    return result
}
```swift
// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
// stringSequence(n: 0) == "0"
// stringSequence(n: 5) == "0 1 2 3 4 5"
func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0...n {
        result += "\(i) "
    }
    return result
}
```
 // XCTAssertTrue failed

func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0...n {
        result += "\(i) "
    }
    return result
}
```swift
// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
// stringSequence(n: 0) == "0"
// stringSequence(n: 5) == "0 1 2 3 4 5"
func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0...n {
        result += "\(i) "
    }
    return result
}
```
 // XCTAssertTrue failed

func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0...n {
        result += "\(i) "
    }
    return result
}
```swift
// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
// stringSequence(n: 0) == "0"
// stringSequence(n: 5) == "0 1 2 3 4 5"
func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0...n {
        result += "\(i) "
    }
    return result
}
```
 // XCTAssertTrue failed

func stringSequence(n: Int) -> String {
    let numbers = (0...n).map { String($0) }
    return numbers.joined(separator: " ")
}
```swift
// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
// stringSequence(n: 0) == "0"
// stringSequence(n: 5) == "0 1 2 3 4 5"
func stringSequence(n: Int) -> String {
    let numbers = (0...n).map { String($0) }
    return numbers.joined(separator: " ")
}
```

func stringSequence(n: Int) -> String {
    return (0...n).map { String($0) }.joined(separator: " ")
}
```swift
// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
// stringSequence(n: 0) == "0"
// stringSequence(n: 5) == "0 1 2 3 4 5"
func stringSequence(n: Int) -> String {
    return (0...n).map { String($0) }.joined(separator: " ")
}
```

func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0...n {
        result += "\(i) "
    }
    return result
}
```swift
// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
// stringSequence(n: 0) == "0"
// stringSequence(n: 5) == "0 1 2 3 4 5"
func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0...n {
        result += "\(i) "
    }
    return result
}
```
 // XCTAssertTrue failed

func stringSequence(n: Int) -> String {
    let numbers = (0...n).map { String($0) }
    return numbers.joined(separator: " ")
}
```swift
// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
// stringSequence(n: 0) == "0"
// stringSequence(n: 5) == "0 1 2 3 4 5"
func stringSequence(n: Int) -> String {
    let numbers = (0...n).map { String($0) }
    return numbers.joined(separator: " ")
}
```

func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0...n {
        result += "\(i) "
    }
    return result
}
```swift
// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
// stringSequence(n: 0) == "0"
// stringSequence(n: 5) == "0 1 2 3 4 5"
func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0...n {
        result += "\(i) "
    }
    return result
}
```
 // XCTAssertTrue failed

func stringSequence(n: Int) -> String {
    let numbers = (0...n).map { String($0) }
    return numbers.joined(separator: " ")
}
```swift
// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
// stringSequence(n: 0) == "0"
// stringSequence(n: 5) == "0 1 2 3 4 5"
func stringSequence(n: Int) -> String {
    let numbers = (0...n).map { String($0) }
    return numbers.joined(separator: " ")
}
```

func countDistinctCharacters(string: String) -> Int {
    var set = Set<Character>()
    for char in string {
        set.insert(char)
    }
    return set.count
}
```swift
// Given a string, find out how many distinct characters (regardless of case) does it consist of
// countDistinctCharacters(string: "xyzXYZ") == 3
// countDistinctCharacters(string: "Jerry") == 4
func countDistinctCharacters(string: String) -> Int {
    var set = Set<Character>()
    for char in string {
        set.insert(char)
    }
    return set.count
}
```
 // XCTAssertTrue failed

func countDistinctCharacters(string: String) -> Int {
    let lowercasedString = string.lowercased()
    var distinctCharacters = Set<Character>()
    for character in lowercasedString {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```swift
// Given a string, find out how many distinct characters (regardless of case) does it consist of
// countDistinctCharacters(string: "xyzXYZ") == 3
// countDistinctCharacters(string: "Jerry") == 4
func countDistinctCharacters(string: String) -> Int {
    let lowercasedString = string.lowercased()
    var distinctCharacters = Set<Character>()
    for character in lowercasedString {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```

func countDistinctCharacters(string: String) -> Int {
    let lowercasedString = string.lowercased()
    var distinctCharacters = Set<Character>()
    for character in lowercasedString {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```swift
// Given a string, find out how many distinct characters (regardless of case) does it consist of
// countDistinctCharacters(string: "xyzXYZ") == 3
// countDistinctCharacters(string: "Jerry") == 4
func countDistinctCharacters(string: String) -> Int {
    let lowercasedString = string.lowercased()
    var distinctCharacters = Set<Character>()
    for character in lowercasedString {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```

func countDistinctCharacters(string: String) -> Int {
    let lowercasedString = string.lowercased()
    var distinctCharacters = Set<Character>()
    for character in lowercasedString {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```swift
// Given a string, find out how many distinct characters (regardless of case) does it consist of
// countDistinctCharacters(string: "xyzXYZ") == 3
// countDistinctCharacters(string: "Jerry") == 4
func countDistinctCharacters(string: String) -> Int {
    let lowercasedString = string.lowercased()
    var distinctCharacters = Set<Character>()
    for character in lowercasedString {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```

func countDistinctCharacters(string: String) -> Int {
    var set = Set<Character>()
    for character in string {
        set.insert(character)
    }
    return set.count
}
```swift
// Given a string, find out how many distinct characters (regardless of case) does it consist of
// countDistinctCharacters(string: "xyzXYZ") == 3
// countDistinctCharacters(string: "Jerry") == 4
func countDistinctCharacters(string: String) -> Int {
    var set = Set<Character>()
    for character in string {
        set.insert(character)
    }
    return set.count
}
```
 // XCTAssertTrue failed

func countDistinctCharacters(string: String) -> Int {
    var set = Set<Character>()
    for char in string {
        set.insert(char)
    }
    return set.count
}
```swift
// Given a string, find out how many distinct characters (regardless of case) does it consist of
// countDistinctCharacters(string: "xyzXYZ") == 3
// countDistinctCharacters(string: "Jerry") == 4
func countDistinctCharacters(string: String) -> Int {
    var set = Set<Character>()
    for char in string {
        set.insert(char)
    }
    return set.count
}
```
 // XCTAssertTrue failed

func countDistinctCharacters(string: String) -> Int {
    let lowercasedString = string.lowercased()
    var distinctCharacters = Set<Character>()
    for character in lowercasedString {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```swift
// Given a string, find out how many distinct characters (regardless of case) does it consist of
// countDistinctCharacters(string: "xyzXYZ") == 3
// countDistinctCharacters(string: "Jerry") == 4
func countDistinctCharacters(string: String) -> Int {
    let lowercasedString = string.lowercased()
    var distinctCharacters = Set<Character>()
    for character in lowercasedString {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```

func countDistinctCharacters(string: String) -> Int {
    let lowercased = string.lowercased()
    var distinctCharacters = Set<Character>()
    for character in lowercased {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```swift
// Given a string, find out how many distinct characters (regardless of case) does it consist of
// countDistinctCharacters(string: "xyzXYZ") == 3
// countDistinctCharacters(string: "Jerry") == 4
func countDistinctCharacters(string: String) -> Int {
    let lowercased = string.lowercased()
    var distinctCharacters = Set<Character>()
    for character in lowercased {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```

func countDistinctCharacters(string: String) -> Int {
    var distinctCharacters = Set<Character>()
    for character in string {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```swift
// Given a string, find out how many distinct characters (regardless of case) does it consist of
// countDistinctCharacters(string: "xyzXYZ") == 3
// countDistinctCharacters(string: "Jerry") == 4
func countDistinctCharacters(string: String) -> Int {
    var distinctCharacters = Set<Character>()
    for character in string {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```
 // XCTAssertTrue failed

func countDistinctCharacters(string: String) -> Int {
    let lowercasedString = string.lowercased()
    var distinctCharacters = Set<Character>()
    for character in lowercasedString {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```swift
// Given a string, find out how many distinct characters (regardless of case) does it consist of
// countDistinctCharacters(string: "xyzXYZ") == 3
// countDistinctCharacters(string: "Jerry") == 4
func countDistinctCharacters(string: String) -> Int {
    let lowercasedString = string.lowercased()
    var distinctCharacters = Set<Character>()
    for character in lowercasedString {
        distinctCharacters.insert(character)
    }
    return distinctCharacters.count
}
```

func parseMusic(musicString: String) -> [Int] {
    var result: [Int] = []
    var currentBeat: Int = 0
    var currentNote: String = ""
    for character in musicString {
        if character == "o" {
            currentNote = "o"
        } else if character == "o" {
            currentNote = "o|"
        } else if character == "." {
            currentNote = ".|"
        }
        if currentNote == "o" {
            currentBeat += 4
        } else if currentNote == "o|" {
            currentBeat += 2
        } else if currentNote == ".|" {
            currentBeat += 1
        }
        result.append(currentBeat)
    }
    return result
}
```swift
// Input to this function is a string representing musical notes in a special ASCII format.
// Your task is to parse this string and return array of integers corresponding to how many beats does each
// not last.
// Here is a legend:
// 'o' - whole note, lasts four beats
// 'o|' - half note, lasts two beats
// '.|' - quater note, lasts one beat
// parseMusic(musicString: "o o| .| o| o| .| .| .| .| o o") == [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
func parseMusic(musicString: String) -> [Int] {
    var result: [Int] = []
    var currentBeat: Int = 0
    var currentNote: String = ""
    for character in musicString {
        if character == "o" {
            currentNote = "o"
        } else if character == "o" {
            currentNote = "o|"
        } else if character == "." {
            currentNote = ".|"
        }
        if currentNote == "o" {
            currentBeat += 4
        } else if currentNote == "o|" {
            currentBeat += 2
        } else if currentNote == ".|" {
            currentBeat += 1
        }
        result.append(currentBeat)
    }
    return result
}
```
 // XCTAssertTrue failed

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 4
    for character in musicString {
        switch character {
        case "o":
            currentBeat = 4
        case "o", "|":
            currentBeat = 2
        case ".":
            currentBeat = 1
        default:
            break
        }
        result.append(currentBeat)
    }
    return result
}
```swift
// Input to this function is a string representing musical notes in a special ASCII format.
// Your task is to parse this string and return array of integers corresponding to how many beats does each
// not last.
// Here is a legend:
// 'o' - whole note, lasts four beats
// 'o|' - half note, lasts two beats
// '.|' - quater note, lasts one beat
// parseMusic(musicString: "o o| .| o| o| .| .| .| .| o o") == [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 4
    for character in musicString {
        switch character {
        case "o":
            currentBeat = 4
        case "o", "|":
            currentBeat = 2
        case ".":
            currentBeat = 1
        default:
            break
        }
        result.append(currentBeat)
    }
    return result
}
```
case "o", "|": // literal value is already handled by previous pattern; consider removing it
 // XCTAssertTrue failed

func parseMusic(musicString: String) -> [Int] {
    let notes = musicString.components(separatedBy: " ")
    var result = [Int]()
    for note in notes {
        switch note {
        case "o":
            result.append(4)
        case "o|":
            result.append(2)
        case ".|":
            result.append(1)
        default:
            break
        }
    }
    return result
}
```swift
// Input to this function is a string representing musical notes in a special ASCII format.
// Your task is to parse this string and return array of integers corresponding to how many beats does each
// not last.
// Here is a legend:
// 'o' - whole note, lasts four beats
// 'o|' - half note, lasts two beats
// '.|' - quater note, lasts one beat
// parseMusic(musicString: "o o| .| o| o| .| .| .| .| o o") == [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
func parseMusic(musicString: String) -> [Int] {
    let notes = musicString.components(separatedBy: " ")
    var result = [Int]()
    for note in notes {
        switch note {
        case "o":
            result.append(4)
        case "o|":
            result.append(2)
        case ".|":
            result.append(1)
        default:
            break
        }
    }
    return result
}
```

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 4
    for character in musicString {
        switch character {
        case "o":
            result.append(currentBeat)
            currentBeat = 4
        case "o", "|":
            result.append(currentBeat / 2)
            currentBeat = currentBeat / 2
        case ".":
            result.append(currentBeat / 4)
            currentBeat = currentBeat / 4
        default:
            break
        }
    }
    return result
}
```swift
// Input to this function is a string representing musical notes in a special ASCII format.
// Your task is to parse this string and return array of integers corresponding to how many beats does each
// not last.
// Here is a legend:
// 'o' - whole note, lasts four beats
// 'o|' - half note, lasts two beats
// '.|' - quater note, lasts one beat
// parseMusic(musicString: "o o| .| o| o| .| .| .| .| o o") == [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 4
    for character in musicString {
        switch character {
        case "o":
            result.append(currentBeat)
            currentBeat = 4
        case "o", "|":
            result.append(currentBeat / 2)
            currentBeat = currentBeat / 2
        case ".":
            result.append(currentBeat / 4)
            currentBeat = currentBeat / 4
        default:
            break
        }
    }
    return result
}
```
case "o", "|": // literal value is already handled by previous pattern; consider removing it
 // XCTAssertTrue failed

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 4
    var currentNote = ""
    for character in musicString {
        if character == " " {
            result.append(currentBeat)
            currentBeat = 4
            currentNote = ""
        } else if character == "|" {
            if currentNote == "o" {
                currentBeat /= 2
            } else if currentNote == "." {
                currentBeat /= 4
            }
        } else {
            currentNote += String(character)
        }
    }
    result.append(currentBeat)
    return result
}
```swift
// Input to this function is a string representing musical notes in a special ASCII format.
// Your task is to parse this string and return array of integers corresponding to how many beats does each
// not last.
// Here is a legend:
// 'o' - whole note, lasts four beats
// 'o|' - half note, lasts two beats
// '.|' - quater note, lasts one beat
// parseMusic(musicString: "o o| .| o| o| .| .| .| .| o o") == [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 4
    var currentNote = ""
    for character in musicString {
        if character == " " {
            result.append(currentBeat)
            currentBeat = 4
            currentNote = ""
        } else if character == "|" {
            if currentNote == "o" {
                currentBeat /= 2
            } else if currentNote == "." {
                currentBeat /= 4
            }
        } else {
            currentNote += String(character)
        }
    }
    result.append(currentBeat)
    return result
}
```
 // XCTAssertTrue failed

func parseMusic(musicString: String) -> [Int] {
    let notes = musicString.split(separator: " ")
    var result = [Int]()
    for note in notes {
        switch note {
        case "o":
            result.append(4)
        case "o|":
            result.append(2)
        case ".|":
            result.append(1)
        default:
            break
        }
    }
    return result
}
```swift
// Input to this function is a string representing musical notes in a special ASCII format.
// Your task is to parse this string and return array of integers corresponding to how many beats does each
// not last.
// Here is a legend:
// 'o' - whole note, lasts four beats
// 'o|' - half note, lasts two beats
// '.|' - quater note, lasts one beat
// parseMusic(musicString: "o o| .| o| o| .| .| .| .| o o") == [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
func parseMusic(musicString: String) -> [Int] {
    let notes = musicString.split(separator: " ")
    var result = [Int]()
    for note in notes {
        switch note {
        case "o":
            result.append(4)
        case "o|":
            result.append(2)
        case ".|":
            result.append(1)
        default:
            break
        }
    }
    return result
}
```

func parseMusic(musicString: String) -> [Int] {
    let notes = musicString.components(separatedBy: " ")
    var beats = [Int]()
    for note in notes {
        switch note {
        case "o":
            beats.append(4)
        case "o|":
            beats.append(2)
        case ".|":
            beats.append(1)
        default:
            break
        }
    }
    return beats
}
```swift
// Input to this function is a string representing musical notes in a special ASCII format.
// Your task is to parse this string and return array of integers corresponding to how many beats does each
// not last.
// Here is a legend:
// 'o' - whole note, lasts four beats
// 'o|' - half note, lasts two beats
// '.|' - quater note, lasts one beat
// parseMusic(musicString: "o o| .| o| o| .| .| .| .| o o") == [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
func parseMusic(musicString: String) -> [Int] {
    let notes = musicString.components(separatedBy: " ")
    var beats = [Int]()
    for note in notes {
        switch note {
        case "o":
            beats.append(4)
        case "o|":
            beats.append(2)
        case ".|":
            beats.append(1)
        default:
            break
        }
    }
    return beats
}
```

func parseMusic(musicString: String) -> [Int] {
    return []
}
```swift
// Input to this function is a string representing musical notes in a special ASCII format.
// Your task is to parse this string and return array of integers corresponding to how many beats does each
// not last.
// Here is a legend:
// 'o' - whole note, lasts four beats
// 'o|' - half note, lasts two beats
// '.|' - quater note, lasts one beat
// parseMusic(musicString: "o o| .| o| o| .| .| .| .| o o") == [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
func parseMusic(musicString: String) -> [Int] {
    return []
}
```
 // XCTAssertTrue failed

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 4
    for character in musicString {
        switch character {
        case "o":
            result.append(currentBeat)
            currentBeat = 4
        case "o":
            result.append(currentBeat)
            currentBeat = 4
        case "|":
            currentBeat /= 2
        case ".":
            currentBeat /= 4
        default:
            break
        }
    }
    return result
}
```swift
// Input to this function is a string representing musical notes in a special ASCII format.
// Your task is to parse this string and return array of integers corresponding to how many beats does each
// not last.
// Here is a legend:
// 'o' - whole note, lasts four beats
// 'o|' - half note, lasts two beats
// '.|' - quater note, lasts one beat
// parseMusic(musicString: "o o| .| o| o| .| .| .| .| o o") == [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 4
    for character in musicString {
        switch character {
        case "o":
            result.append(currentBeat)
            currentBeat = 4
        case "o":
            result.append(currentBeat)
            currentBeat = 4
        case "|":
            currentBeat /= 2
        case ".":
            currentBeat /= 4
        default:
            break
        }
    }
    return result
}
```
case "o": // literal value is already handled by previous pattern; consider removing it
 // XCTAssertTrue failed

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var beat = 4
    for character in musicString {
        switch character {
        case "o":
            beat = 4
        case "o":
            beat = 2
        case ".":
            beat = 1
        default:
            break
        }
        result.append(beat)
    }
    return result
}
```swift
// Input to this function is a string representing musical notes in a special ASCII format.
// Your task is to parse this string and return array of integers corresponding to how many beats does each
// not last.
// Here is a legend:
// 'o' - whole note, lasts four beats
// 'o|' - half note, lasts two beats
// '.|' - quater note, lasts one beat
// parseMusic(musicString: "o o| .| o| o| .| .| .| .| o o") == [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var beat = 4
    for character in musicString {
        switch character {
        case "o":
            beat = 4
        case "o":
            beat = 2
        case ".":
            beat = 1
        default:
            break
        }
        result.append(beat)
    }
    return result
}
```
case "o": // literal value is already handled by previous pattern; consider removing it
 // XCTAssertTrue failed

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var startIndex = string.startIndex
    while let range = string.range(of: substring, range: startIndex..<string.endIndex) {
        count += 1
        startIndex = range.upperBound
    }
    return count
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var startIndex = string.startIndex
    while let range = string.range(of: substring, range: startIndex..<string.endIndex) {
        count += 1
        startIndex = range.upperBound
    }
    return count
}
```
 // XCTAssertTrue failed

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index != string.endIndex {
        let range = string.range(of: substring, options: .literal, range: index..<string.endIndex)
        if let range = range {
            count += 1
            index = range.upperBound
        } else {
            break
        }
    }
    return count
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index != string.endIndex {
        let range = string.range(of: substring, options: .literal, range: index..<string.endIndex)
        if let range = range {
            count += 1
            index = range.upperBound
        } else {
            break
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index != string.endIndex {
        let range = string.range(of: substring, options: .literal, range: index..<string.endIndex)
        if let range = range {
            count += 1
            index = range.upperBound
        } else {
            break
        }
    }
    return count
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index != string.endIndex {
        let range = string.range(of: substring, options: .literal, range: index..<string.endIndex)
        if let range = range {
            count += 1
            index = range.upperBound
        } else {
            break
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index != string.endIndex {
        let range = string.range(of: substring, options: .literal, range: index..<string.endIndex)
        if let range = range {
            index = range.upperBound
            count += 1
        } else {
            break
        }
    }
    return count
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index != string.endIndex {
        let range = string.range(of: substring, options: .literal, range: index..<string.endIndex)
        if let range = range {
            index = range.upperBound
            count += 1
        } else {
            break
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var startIndex = string.startIndex
    while let range = string.range(of: substring, options: .anchored, range: startIndex..<string.endIndex) {
        count += 1
        startIndex = range.upperBound
    }
    return count
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var startIndex = string.startIndex
    while let range = string.range(of: substring, options: .anchored, range: startIndex..<string.endIndex) {
        count += 1
        startIndex = range.upperBound
    }
    return count
}
```
 // XCTAssertTrue failed

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var startIndex = string.startIndex
    while startIndex < string.endIndex {
        let range = string.range(of: substring, options: .literal, range: startIndex..<string.endIndex)
        if let range = range {
            count += 1
            startIndex = range.upperBound
        } else {
            break
        }
    }
    return count
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var startIndex = string.startIndex
    while startIndex < string.endIndex {
        let range = string.range(of: substring, options: .literal, range: startIndex..<string.endIndex)
        if let range = range {
            count += 1
            startIndex = range.upperBound
        } else {
            break
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var startIndex = string.startIndex
    while let range = string.range(of: substring, range: startIndex..<string.endIndex) {
        count += 1
        startIndex = range.upperBound
    }
    return count
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var startIndex = string.startIndex
    while let range = string.range(of: substring, range: startIndex..<string.endIndex) {
        count += 1
        startIndex = range.upperBound
    }
    return count
}
```
 // XCTAssertTrue failed

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index != string.endIndex {
        let range = string.range(of: substring, options: .literal, range: index..<string.endIndex)
        if let range = range {
            count += 1
            index = range.upperBound
        } else {
            break
        }
    }
    return count
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index != string.endIndex {
        let range = string.range(of: substring, options: .literal, range: index..<string.endIndex)
        if let range = range {
            count += 1
            index = range.upperBound
        } else {
            break
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func howManyTimes(string: String, substring: String) -> Int {
    let count = string.count
    let subCount = substring.count
    if subCount == 0 {
        return count
    }
    if subCount > count {
        return 0
    }
    var result = 0
    for i in 0..<count {
        let sub = string.substring(from: i)
        if sub.hasPrefix(substring) {
            result += 1
        }
    }
    return result
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    let count = string.count
    let subCount = substring.count
    if subCount == 0 {
        return count
    }
    if subCount > count {
        return 0
    }
    var result = 0
    for i in 0..<count {
        let sub = string.substring(from: i)
        if sub.hasPrefix(substring) {
            result += 1
        }
    }
    return result
}
```
let sub = string.substring(from: i) // cannot convert value of type 'Int' to expected argument type 'String.Index'

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var startIndex = string.startIndex
    while let range = string.range(of: substring, range: startIndex..<string.endIndex) {
        count += 1
        startIndex = range.upperBound
    }
    return count
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var startIndex = string.startIndex
    while let range = string.range(of: substring, range: startIndex..<string.endIndex) {
        count += 1
        startIndex = range.upperBound
    }
    return count
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    let numbersArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numbersArray.sorted(by: { $0 < $1 })
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numbersArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numbersArray.sorted(by: { $0 < $1 })
    return sortedNumbers.joined(separator: " ")
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    let sortedNumbers = numbers.components(separatedBy: " ").sorted()
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let sortedNumbers = numbers.components(separatedBy: " ").sorted()
    return sortedNumbers.joined(separator: " ")
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    let numbersArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numbersArray.sorted()
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numbersArray = numbers.components(separatedBy: " ")
    let sortedNumbers = numbersArray.sorted()
    return sortedNumbers.joined(separator: " ")
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    let sortedNumbers = numbers.split(separator: " ").sorted(by: { $0.localizedStandardCompare($1) == .orderedAscending })
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let sortedNumbers = numbers.split(separator: " ").sorted(by: { $0.localizedStandardCompare($1) == .orderedAscending })
    return sortedNumbers.joined(separator: " ")
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    let numbers = numbers.split(separator: " ")
    let sortedNumbers = numbers.sorted()
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numbers = numbers.split(separator: " ")
    let sortedNumbers = numbers.sorted()
    return sortedNumbers.joined(separator: " ")
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    let sorted = numbers.components(separatedBy: " ").sorted()
    return sorted.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let sorted = numbers.components(separatedBy: " ").sorted()
    return sorted.joined(separator: " ")
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    return numbers.split(separator: " ").sorted().map { String($0) }.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    return numbers.split(separator: " ").sorted().map { String($0) }.joined(separator: " ")
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    let sortedNumbers = numbers.components(separatedBy: " ").sorted()
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let sortedNumbers = numbers.components(separatedBy: " ").sorted()
    return sortedNumbers.joined(separator: " ")
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    let numbersArray = numbers.components(separatedBy: " ")
    let sortedNumbersArray = numbersArray.sorted(by: { $0 < $1 })
    return sortedNumbersArray.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numbersArray = numbers.components(separatedBy: " ")
    let sortedNumbersArray = numbersArray.sorted(by: { $0 < $1 })
    return sortedNumbersArray.joined(separator: " ")
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    let sortedNumbers = numbers.split(separator: " ").sorted { $0.lowercased() < $1.lowercased() }
    return sortedNumbers.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let sortedNumbers = numbers.split(separator: " ").sorted { $0.lowercased() < $1.lowercased() }
    return sortedNumbers.joined(separator: " ")
}
```
 // XCTAssertTrue failed

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var minDiff = Double.infinity
    var minDiffIndex = 0
    var maxDiffIndex = 0
    var minDiffValue = numbers[0]
    var maxDiffValue = numbers[0]
    for i in 1..<numbers.count {
        let diff = abs(numbers[i] - numbers[i - 1])
        if diff < minDiff {
            minDiff = diff
            minDiffIndex = i
            minDiffValue = numbers[i]
        }
        if diff > maxDiff {
            maxDiff = diff
            maxDiffIndex = i
            maxDiffValue = numbers[i]
        }
    }
    return (minDiffValue, maxDiffValue)
}
```swift
// From a supplied array of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var minDiff = Double.infinity
    var minDiffIndex = 0
    var maxDiffIndex = 0
    var minDiffValue = numbers[0]
    var maxDiffValue = numbers[0]
    for i in 1..<numbers.count {
        let diff = abs(numbers[i] - numbers[i - 1])
        if diff < minDiff {
            minDiff = diff
            minDiffIndex = i
            minDiffValue = numbers[i]
        }
        if diff > maxDiff {
            maxDiff = diff
            maxDiffIndex = i
            maxDiffValue = numbers[i]
        }
    }
    return (minDiffValue, maxDiffValue)
}
```
if diff > maxDiff { // cannot find 'maxDiff' in scope
maxDiff = diff // cannot find 'maxDiff' in scope

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    let sorted = numbers.sorted()
    let min = sorted[0]
    let max = sorted[sorted.count - 1]
    var minIndex = 0
    var maxIndex = 0
    var minDistance = Double.infinity
    var maxDistance = Double.infinity
    for i in 0..<sorted.count {
        let distance = abs(min - sorted[i])
        if distance < minDistance {
            minDistance = distance
            minIndex = i
        }
        let distance = abs(max - sorted[i])
        if distance < maxDistance {
            maxDistance = distance
            maxIndex = i
        }
    }
    return (sorted[minIndex], sorted[maxIndex])
}
```swift
// From a supplied array of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
func findClosestElements(numbers: [Double]) -> (Double, Double) {
    let sorted = numbers.sorted()
    let min = sorted[0]
    let max = sorted[sorted.count - 1]
    var minIndex = 0
    var maxIndex = 0
    var minDistance = Double.infinity
    var maxDistance = Double.infinity
    for i in 0..<sorted.count {
        let distance = abs(min - sorted[i])
        if distance < minDistance {
            minDistance = distance
            minIndex = i
        }
        let distance = abs(max - sorted[i])
        if distance < maxDistance {
            maxDistance = distance
            maxIndex = i
        }
    }
    return (sorted[minIndex], sorted[maxIndex])
}
```
let distance = abs(max - sorted[i]) // invalid redeclaration of 'distance'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var minDiff = Double.infinity
    var minDiffIndex = 0
    var maxDiffIndex = 0
    var min = numbers[0]
    var max = numbers[0]
    for i in 1..<numbers.count {
        let diff = abs(numbers[i] - numbers[i - 1])
        if diff < minDiff {
            minDiff = diff
            minDiffIndex = i - 1
            maxDiffIndex = i
        }
        if numbers[i] < numbers[i - 1] {
            min = numbers[i]
            max = numbers[i - 1]
        } else {
            min = numbers[i - 1]
            max = numbers[i]
        }
    }
    return (min, max)
}
```swift
// From a supplied array of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var minDiff = Double.infinity
    var minDiffIndex = 0
    var maxDiffIndex = 0
    var min = numbers[0]
    var max = numbers[0]
    for i in 1..<numbers.count {
        let diff = abs(numbers[i] - numbers[i - 1])
        if diff < minDiff {
            minDiff = diff
            minDiffIndex = i - 1
            maxDiffIndex = i
        }
        if numbers[i] < numbers[i - 1] {
            min = numbers[i]
            max = numbers[i - 1]
        } else {
            min = numbers[i - 1]
            max = numbers[i]
        }
    }
    return (min, max)
}
```
var minDiffIndex = 0 // variable 'minDiffIndex' was written to, but never read
var maxDiffIndex = 0 // variable 'maxDiffIndex' was written to, but never read
 // XCTAssertTrue failed

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var closest = (Double.greatestFiniteMagnitude, Double.greatestFiniteMagnitude)
    var minDiff = Double.greatestFiniteMagnitude
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let diff = abs(numbers[i] - numbers[j])
            if diff < minDiff {
                minDiff = diff
                closest = (numbers[i], numbers[j])
            }
        }
    }
    return closest
}
```swift
// From a supplied array of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var closest = (Double.greatestFiniteMagnitude, Double.greatestFiniteMagnitude)
    var minDiff = Double.greatestFiniteMagnitude
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let diff = abs(numbers[i] - numbers[j])
            if diff < minDiff {
                minDiff = diff
                closest = (numbers[i], numbers[j])
            }
        }
    }
    return closest
}
```
 // XCTAssertTrue failed

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: Implement
    return (0.0, 0.0)
}
```swift
// From a supplied array of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: Implement
    return (0.0, 0.0)
}
```
 // XCTAssertTrue failed

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: Implement
    return (0.0, 0.0)
}
```swift
// From a supplied array of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: Implement
    return (0.0, 0.0)
}
```
 // XCTAssertTrue failed

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var minDiff = Double.infinity
    var minDiffIndex = 0
    var maxDiff = Double.infinity
    var maxDiffIndex = 0
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let diff = abs(numbers[i] - numbers[j])
            if diff < minDiff {
                minDiff = diff
                minDiffIndex = i
            }
            if diff > maxDiff {
                maxDiff = diff
                maxDiffIndex = i
            }
        }
    }
    return (numbers[minDiffIndex], numbers[maxDiffIndex])
}
```swift
// From a supplied array of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var minDiff = Double.infinity
    var minDiffIndex = 0
    var maxDiff = Double.infinity
    var maxDiffIndex = 0
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            let diff = abs(numbers[i] - numbers[j])
            if diff < minDiff {
                minDiff = diff
                minDiffIndex = i
            }
            if diff > maxDiff {
                maxDiff = diff
                maxDiffIndex = i
            }
        }
    }
    return (numbers[minDiffIndex], numbers[maxDiffIndex])
}
```
 // XCTAssertTrue failed

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var minDiff = Double.infinity
    var min1 = 0.0
    var min2 = 0.0
    for i in 0..<numbers.count-1 {
        for j in i+1..<numbers.count {
            let diff = abs(numbers[i] - numbers[j])
            if diff < minDiff {
                minDiff = diff
                min1 = numbers[i]
                min2 = numbers[j]
            }
        }
    }
    return (min1, min2)
}
```swift
// From a supplied array of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var minDiff = Double.infinity
    var min1 = 0.0
    var min2 = 0.0
    for i in 0..<numbers.count-1 {
        for j in i+1..<numbers.count {
            let diff = abs(numbers[i] - numbers[j])
            if diff < minDiff {
                minDiff = diff
                min1 = numbers[i]
                min2 = numbers[j]
            }
        }
    }
    return (min1, min2)
}
```
 // XCTAssertTrue failed

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: Implement
    return (0.0, 0.0)
}
```swift
// From a supplied array of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: Implement
    return (0.0, 0.0)
}
```
 // XCTAssertTrue failed

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var numbers = numbers
    var minDiff = Double.infinity
    var min1: Double?
    var min2: Double?
    for i in 0..<numbers.count - 1 {
        for j in i + 1..<numbers.count {
            let diff = abs(numbers[i] - numbers[j])
            if diff < minDiff {
                minDiff = diff
                min1 = numbers[i]
                min2 = numbers[j]
            }
        }
    }
    return (min1!, min2!)
}
```swift
// From a supplied array of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var numbers = numbers
    var minDiff = Double.infinity
    var min1: Double?
    var min2: Double?
    for i in 0..<numbers.count - 1 {
        for j in i + 1..<numbers.count {
            let diff = abs(numbers[i] - numbers[j])
            if diff < minDiff {
                minDiff = diff
                min1 = numbers[i]
                min2 = numbers[j]
            }
        }
    }
    return (min1!, min2!)
}
```
var numbers = numbers // variable 'numbers' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    let range = max - min
    return numbers.map { ($0 - min) / range }
}
```swift
// Given array of numbers (of at least two elements), apply a linear transform to that array,
// such that the smallest number will become 0 and the largest will become 1
// rescaleToUnit(numbers: [1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    let range = max - min
    return numbers.map { ($0 - min) / range }
}
```

func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    let range = max - min
    return numbers.map { ($0 - min) / range }
}
```swift
// Given array of numbers (of at least two elements), apply a linear transform to that array,
// such that the smallest number will become 0 and the largest will become 1
// rescaleToUnit(numbers: [1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    let range = max - min
    return numbers.map { ($0 - min) / range }
}
```

func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    let range = max - min
    return numbers.map { ($0 - min) / range }
}
```swift
// Given array of numbers (of at least two elements), apply a linear transform to that array,
// such that the smallest number will become 0 and the largest will become 1
// rescaleToUnit(numbers: [1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    let range = max - min
    return numbers.map { ($0 - min) / range }
}
```

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.min()!
    let max = numbers.max()!
    return numbers.map { (number) -> Double in
        return (number - min) / (max - min)
    }
}
```swift
// Given array of numbers (of at least two elements), apply a linear transform to that array,
// such that the smallest number will become 0 and the largest will become 1
// rescaleToUnit(numbers: [1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.min()!
    let max = numbers.max()!
    return numbers.map { (number) -> Double in
        return (number - min) / (max - min)
    }
}
```

func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    return numbers.map { ($0 - min) / (max - min) }
}
```swift
// Given array of numbers (of at least two elements), apply a linear transform to that array,
// such that the smallest number will become 0 and the largest will become 1
// rescaleToUnit(numbers: [1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    return numbers.map { ($0 - min) / (max - min) }
}
```

func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    return numbers.map { (number) -> Double in
        return (number - min) / (max - min)
    }
}
```swift
// Given array of numbers (of at least two elements), apply a linear transform to that array,
// such that the smallest number will become 0 and the largest will become 1
// rescaleToUnit(numbers: [1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    return numbers.map { (number) -> Double in
        return (number - min) / (max - min)
    }
}
```

func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    let range = max - min
    return numbers.map { ($0 - min) / range }
}
```swift
// Given array of numbers (of at least two elements), apply a linear transform to that array,
// such that the smallest number will become 0 and the largest will become 1
// rescaleToUnit(numbers: [1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    let range = max - min
    return numbers.map { ($0 - min) / range }
}
```

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.min() ?? 0.0
    let max = numbers.max() ?? 1.0
    return numbers.map { (number) -> Double in
        return (number - min) / (max - min)
    }
}
```swift
// Given array of numbers (of at least two elements), apply a linear transform to that array,
// such that the smallest number will become 0 and the largest will become 1
// rescaleToUnit(numbers: [1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.min() ?? 0.0
    let max = numbers.max() ?? 1.0
    return numbers.map { (number) -> Double in
        return (number - min) / (max - min)
    }
}
```

func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    return numbers.map { (number) -> Double in
        return (number - min) / (max - min)
    }
}
```swift
// Given array of numbers (of at least two elements), apply a linear transform to that array,
// such that the smallest number will become 0 and the largest will become 1
// rescaleToUnit(numbers: [1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else { return numbers }
    let min = numbers.min()!
    let max = numbers.max()!
    return numbers.map { (number) -> Double in
        return (number - min) / (max - min)
    }
}
```

func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else {
        return numbers
    }

    let min = numbers.min()!
    let max = numbers.max()!

    return numbers.map { (number) -> Double in
        return (number - min) / (max - min)
    }
}
```swift
// Given array of numbers (of at least two elements), apply a linear transform to that array,
// such that the smallest number will become 0 and the largest will become 1
// rescaleToUnit(numbers: [1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
func rescaleToUnit(numbers: [Double]) -> [Double] {
    guard numbers.count > 1 else {
        return numbers
    }

    let min = numbers.min()!
    let max = numbers.max()!

    return numbers.map { (number) -> Double in
        return (number - min) / (max - min)
    }
}
```

func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.filter { $0 is Int }.map { $0 as! Int }
}
```swift
// Filter given array of any swiftthon values only for integers
// filterIntegers(values: ["a", 3.14, 5]) == [5]
// filterIntegers(values: [1, 2, 3, "abc", [:] as [AnyHashable : AnyHashable], [] as [AnyHashable]]) == [1, 2, 3]
func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.filter { $0 is Int }.map { $0 as! Int }
}
```

func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.filter { (value) -> Bool in
        if let integer = value as? Int {
            return true
        } else {
            return false
        }
    }
}
```swift
// Filter given array of any swiftthon values only for integers
// filterIntegers(values: ["a", 3.14, 5]) == [5]
// filterIntegers(values: [1, 2, 3, "abc", [:] as [AnyHashable : AnyHashable], [] as [AnyHashable]]) == [1, 2, 3]
func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.filter { (value) -> Bool in
        if let integer = value as? Int {
            return true
        } else {
            return false
        }
    }
}
```
return values.filter { (value) -> Bool in // cannot convert return expression of type '[AnyHashable]' to return type '[Int]'

func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.compactMap { $0 as? Int }
}
```swift
// Filter given array of any swiftthon values only for integers
// filterIntegers(values: ["a", 3.14, 5]) == [5]
// filterIntegers(values: [1, 2, 3, "abc", [:] as [AnyHashable : AnyHashable], [] as [AnyHashable]]) == [1, 2, 3]
func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.compactMap { $0 as? Int }
}
```

func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.compactMap { $0 as? Int }
}
```swift
// Filter given array of any swiftthon values only for integers
// filterIntegers(values: ["a", 3.14, 5]) == [5]
// filterIntegers(values: [1, 2, 3, "abc", [:] as [AnyHashable : AnyHashable], [] as [AnyHashable]]) == [1, 2, 3]
func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.compactMap { $0 as? Int }
}
```

func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.compactMap { $0 as? Int }
}
```swift
// Filter given array of any swiftthon values only for integers
// filterIntegers(values: ["a", 3.14, 5]) == [5]
// filterIntegers(values: [1, 2, 3, "abc", [:] as [AnyHashable : AnyHashable], [] as [AnyHashable]]) == [1, 2, 3]
func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.compactMap { $0 as? Int }
}
```

func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.compactMap { $0 as? Int }
}
```swift
// Filter given array of any swiftthon values only for integers
// filterIntegers(values: ["a", 3.14, 5]) == [5]
// filterIntegers(values: [1, 2, 3, "abc", [:] as [AnyHashable : AnyHashable], [] as [AnyHashable]]) == [1, 2, 3]
func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.compactMap { $0 as? Int }
}
```

func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.filter { $0 is Int }.map { $0 as! Int }
}
```swift
// Filter given array of any swiftthon values only for integers
// filterIntegers(values: ["a", 3.14, 5]) == [5]
// filterIntegers(values: [1, 2, 3, "abc", [:] as [AnyHashable : AnyHashable], [] as [AnyHashable]]) == [1, 2, 3]
func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.filter { $0 is Int }.map { $0 as! Int }
}
```

func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.compactMap { $0 as? Int }
}
```swift
// Filter given array of any swiftthon values only for integers
// filterIntegers(values: ["a", 3.14, 5]) == [5]
// filterIntegers(values: [1, 2, 3, "abc", [:] as [AnyHashable : AnyHashable], [] as [AnyHashable]]) == [1, 2, 3]
func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.compactMap { $0 as? Int }
}
```

func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.compactMap { $0 as? Int }
}
```swift
// Filter given array of any swiftthon values only for integers
// filterIntegers(values: ["a", 3.14, 5]) == [5]
// filterIntegers(values: [1, 2, 3, "abc", [:] as [AnyHashable : AnyHashable], [] as [AnyHashable]]) == [1, 2, 3]
func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.compactMap { $0 as? Int }
}
```

func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.filter { $0 is Int }.compactMap { $0 as? Int }
}
```swift
// Filter given array of any swiftthon values only for integers
// filterIntegers(values: ["a", 3.14, 5]) == [5]
// filterIntegers(values: [1, 2, 3, "abc", [:] as [AnyHashable : AnyHashable], [] as [AnyHashable]]) == [1, 2, 3]
func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.filter { $0 is Int }.compactMap { $0 as? Int }
}
```

func strlen(string: String) -> Int {
    return string.count
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}
```

func strlen(string: String) -> Int {
    return string.count
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}
```

func strlen(string: String) -> Int {
    return string.count
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}

// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc

func strlen(string: String) -> Int {
    return string.count
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}
```

func strlen(string: String) -> Int {
    return string.count
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}
```

func strlen(string: String) -> Int {
    return string.count
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}
```

func strlen(string: String) -> Int {
    return string.count
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}
```

func strlen(string: String) -> Int {
    return string.count
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}
```

func strlen(string: String) -> Int {
    return string.count
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}
```

func strlen(string: String) -> Int {
    return string.count
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    return string.count
}
```

func largestDivisor(n: Int) -> Int {
    var largestDivisor = n
    for i in stride(from: n, through: 1, by: -1) {
        if n % i == 0 {
            largestDivisor = i
            break
        }
    }
    return largestDivisor
}
```swift
// For a given number n, find the largest number that divides n evenly, smaller than n
// largestDivisor(n: 15) == 5
func largestDivisor(n: Int) -> Int {
    var largestDivisor = n
    for i in stride(from: n, through: 1, by: -1) {
        if n % i == 0 {
            largestDivisor = i
            break
        }
    }
    return largestDivisor
}
```
 // XCTAssertTrue failed

func largestDivisor(n: Int) -> Int {
    var largestDivisor = 1
    for i in 2...n/2 {
        if n % i == 0 {
            largestDivisor = i
        }
    }
    return largestDivisor
}
```swift
// For a given number n, find the largest number that divides n evenly, smaller than n
// largestDivisor(n: 15) == 5
func largestDivisor(n: Int) -> Int {
    var largestDivisor = 1
    for i in 2...n/2 {
        if n % i == 0 {
            largestDivisor = i
        }
    }
    return largestDivisor
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func largestDivisor(n: Int) -> Int {
    for i in stride(from: n, through: 1, by: -1) {
        if n % i == 0 {
            return i
        }
    }
    return 1
}
```swift
// For a given number n, find the largest number that divides n evenly, smaller than n
// largestDivisor(n: 15) == 5
func largestDivisor(n: Int) -> Int {
    for i in stride(from: n, through: 1, by: -1) {
        if n % i == 0 {
            return i
        }
    }
    return 1
}

largestDivisor(n: 15) // 5
largestDivisor(n: 16) // 8
largestDivisor(n: 17) // 1
largestDivisor(n: 18) // 9
largestDivisor(n: 19) // 1
largestDivisor(n: 20) // 10
largestDivisor(n: 21) // 1
largestDivisor(n: 22) // 11
largestDivisor(n: 23) // 1
largestDivisor(n: 24) // 12
largestDivisor(n: 25) // 5
largestDivisor(n: 26) // 13
largestDivisor(n: 27) // 1
largestDivisor(n: 28) // 14
largestDivisor(n: 29) // 1
largestDivisor(n: 30) // 15
largestDivisor(n: 31) // 1
largestDivisor(n: 32) // 16
largestDivisor(n: 33) // 1
largestDivisor(n: 34) // 17
largestDivisor(n: 35) // 1
largestDivisor(n: 36) // 18
largestDivisor(n: 37) // 1
largestDivisor(n: 38) // 19
largestDivisor(n: 39) // 1
largestDivisor(n: 40) // 20
largestDivisor(n: 41) // 1
largestDivisor(n: 42) // 21
largestDivisor(n: 43) // 1
largestDivisor(n: 44) // 22
largestDivisor(n: 45) // 1
largestDivisor(n: 46) // 23
largestDivisor(n: 47) // 1
largestDivisor(n: 48) // 24
largestDivisor(n: 49) // 1
largestDivisor(n: 50) // 25
largestDivisor(n: 51) // 1
largestDivisor(n: 52) // 26
largestDivisor(n: 53) // 1
largestDivisor(n: 54) // 27
largestDivisor(n: 55) // 1
largestDivisor(n: 56) // 28
largestDivisor(n: 57) // 1
largestDivisor(n: 58) // 29
largestDivisor(n: 59) // 1
largestDivisor(n: 60) // 30
largestDivisor(n: 61) // 1
largestDivisor(n: 62) // 31
largestDivisor(n: 63) // 1
largestDivisor(n: 64) // 32
largestDivisor(n: 65) // 1
largestDivisor(n: 66) // 33
largestDivisor(n: 67) // 1
largestDivisor(n: 68) // 34
largestDivisor(n: 69) // 1
largestDivisor(n: 70) // 35
largestDivisor(n: 71) // 1
largestDivisor(n: 72) // 36
largestDivisor(n: 73) // 1
larg
 // XCTAssertTrue failed

func largestDivisor(n: Int) -> Int {
    var largestDivisor = 1
    for i in 2...n/2 {
        if n % i == 0 {
            largestDivisor = i
        }
    }
    return largestDivisor
}
```swift
// For a given number n, find the largest number that divides n evenly, smaller than n
// largestDivisor(n: 15) == 5
func largestDivisor(n: Int) -> Int {
    var largestDivisor = 1
    for i in 2...n/2 {
        if n % i == 0 {
            largestDivisor = i
        }
    }
    return largestDivisor
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func largestDivisor(n: Int) -> Int {
    var largestDivisor = n
    for i in stride(from: n - 1, through: 1, by: -1) {
        if n % i == 0 {
            largestDivisor = i
            break
        }
    }
    return largestDivisor
}
```swift
// For a given number n, find the largest number that divides n evenly, smaller than n
// largestDivisor(n: 15) == 5
func largestDivisor(n: Int) -> Int {
    var largestDivisor = n
    for i in stride(from: n - 1, through: 1, by: -1) {
        if n % i == 0 {
            largestDivisor = i
            break
        }
    }
    return largestDivisor
}
```

func largestDivisor(n: Int) -> Int {
    var largestDivisor = 1
    for i in 2...n/2 {
        if n % i == 0 {
            largestDivisor = i
        }
    }
    return largestDivisor
}
```swift
// For a given number n, find the largest number that divides n evenly, smaller than n
// largestDivisor(n: 15) == 5
func largestDivisor(n: Int) -> Int {
    var largestDivisor = 1
    for i in 2...n/2 {
        if n % i == 0 {
            largestDivisor = i
        }
    }
    return largestDivisor
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func largestDivisor(n: Int) -> Int {
    var largestDivisor = 1
    for i in 2...n/2 {
        if n % i == 0 {
            largestDivisor = i
        }
    }
    return largestDivisor
}
```swift
// For a given number n, find the largest number that divides n evenly, smaller than n
// largestDivisor(n: 15) == 5
func largestDivisor(n: Int) -> Int {
    var largestDivisor = 1
    for i in 2...n/2 {
        if n % i == 0 {
            largestDivisor = i
        }
    }
    return largestDivisor
}

largestDivisor(n: 15)
```
 // Fatal error: Range requires lowerBound <= upperBound

func largestDivisor(n: Int) -> Int {
    var largestDivisor = 1
    for i in 2...n/2 {
        if n % i == 0 {
            largestDivisor = i
        }
    }
    return largestDivisor
}
```swift
// For a given number n, find the largest number that divides n evenly, smaller than n
// largestDivisor(n: 15) == 5
func largestDivisor(n: Int) -> Int {
    var largestDivisor = 1
    for i in 2...n/2 {
        if n % i == 0 {
            largestDivisor = i
        }
    }
    return largestDivisor
}

largestDivisor(n: 15)
```
 // Fatal error: Range requires lowerBound <= upperBound

func largestDivisor(n: Int) -> Int {
    var largestDivisor = n
    for i in stride(from: n, through: 1, by: -1) {
        if n % i == 0 {
            largestDivisor = i
            break
        }
    }
    return largestDivisor
}
```swift
// For a given number n, find the largest number that divides n evenly, smaller than n
// largestDivisor(n: 15) == 5
func largestDivisor(n: Int) -> Int {
    var largestDivisor = n
    for i in stride(from: n, through: 1, by: -1) {
        if n % i == 0 {
            largestDivisor = i
            break
        }
    }
    return largestDivisor
}
```
 // XCTAssertTrue failed

func largestDivisor(n: Int) -> Int {
    var largestDivisor = 1
    for i in 2..<n {
        if n % i == 0 {
            largestDivisor = i
        }
    }
    return largestDivisor
}
```swift
// For a given number n, find the largest number that divides n evenly, smaller than n
// largestDivisor(n: 15) == 5
func largestDivisor(n: Int) -> Int {
    var largestDivisor = 1
    for i in 2..<n {
        if n % i == 0 {
            largestDivisor = i
        }
    }
    return largestDivisor
}
```

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var i = 2
    while i * i <= n {
        while n % i == 0 {
            factors.append(i)
            n /= i
        }
        i += 1
    }
    if n > 1 {
        factors.append(n)
    }
    return factors
}
```swift
// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var i = 2
    while i * i <= n {
        while n % i == 0 {
            factors.append(i)
            n /= i
        }
        i += 1
    }
    if n > 1 {
        factors.append(n)
    }
    return factors
}
```
n /= i // left side of mutating operator isn't mutable: 'n' is a 'let' constant

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while i * i <= number {
        if number % i == 0 {
            factors.append(i)
            number /= i
        } else {
            i += 1
        }
    }
    if number > 1 {
        factors.append(number)
    }
    return factors
}
```swift
// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while i * i <= number {
        if number % i == 0 {
            factors.append(i)
            number /= i
        } else {
            i += 1
        }
    }
    if number > 1 {
        factors.append(number)
    }
    return factors
}
```

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while i * i <= number {
        while number % i == 0 {
            number /= i
            factors.append(i)
        }
        i += 1
    }
    if number > 1 {
        factors.append(number)
    }
    return factors
}
```swift
// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while i * i <= number {
        while number % i == 0 {
            number /= i
            factors.append(i)
        }
        i += 1
    }
    if number > 1 {
        factors.append(number)
    }
    return factors
}
```

func factorize(n: Int) -> [Int] {
    var result = [Int]()
    var number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            number /= i
            result.append(i)
        } else {
            i += 1
        }
    }
    return result
}
```swift
// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var result = [Int]()
    var number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            number /= i
            result.append(i)
        } else {
            i += 1
        }
    }
    return result
}

// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var result = [Int]()
    var number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            number /= i
            result.append(i)
        } else {
            i += 1
        }
    }
    return result
}

// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var result = [Int]()
    var number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            number /= i
            result.append(i)
        } else {
            i += 1
        }
    }
    return result
}

// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var result = [Int]()
    var number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            number /= i
            result.append(i)
        } else {
            i += 1
        }
    }
    return result
}

// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var result = [Int]()
    var number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            number /= i
            result.append(i)
        } else {
            i += 1
        }
    }
    return result
}

// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factor

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var divisor = 2
    while number > 1 {
        while number % divisor == 0 {
            factors.append(divisor)
            number /= divisor
        }
        divisor += 1
    }
    return factors
}
```swift
// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var divisor = 2
    while number > 1 {
        while number % divisor == 0 {
            factors.append(divisor)
            number /= divisor
        }
        divisor += 1
    }
    return factors
}
```

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while i * i <= number {
        while number % i == 0 {
            factors.append(i)
            number /= i
        }
        i += 1
    }
    if number > 1 {
        factors.append(number)
    }
    return factors
}
```swift
// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while i * i <= number {
        while number % i == 0 {
            factors.append(i)
            number /= i
        }
        i += 1
    }
    if number > 1 {
        factors.append(number)
    }
    return factors
}
```

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while number > 1 {
        while number % i == 0 {
            factors.append(i)
            number /= i
        }
        i += 1
    }
    return factors
}
```swift
// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while number > 1 {
        while number % i == 0 {
            factors.append(i)
            number /= i
        }
        i += 1
    }
    return factors
}
```

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while i * i <= number {
        while number % i == 0 {
            factors.append(i)
            number /= i
        }
        i += 1
    }
    if number > 1 {
        factors.append(number)
    }
    return factors
}
```swift
// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while i * i <= number {
        while number % i == 0 {
            factors.append(i)
            number /= i
        }
        i += 1
    }
    if number > 1 {
        factors.append(number)
    }
    return factors
}
```

func factorize(n: Int) -> [Int] {
    var result = [Int]()
    var number = n
    var i = 2
    while i <= number {
        if number % i == 0 {
            number /= i
            result.append(i)
        } else {
            i += 1
        }
    }
    return result
}
```swift
// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var result = [Int]()
    var number = n
    var i = 2
    while i <= number {
        if number % i == 0 {
            number /= i
            result.append(i)
        } else {
            i += 1
        }
    }
    return result
}
```

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while i * i <= number {
        while number % i == 0 {
            number /= i
            factors.append(i)
        }
        i += 1
    }
    if number > 1 {
        factors.append(number)
    }
    return factors
}
```swift
// Return array of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal to the product of all factors
// factorize(n: 8) == [2, 2, 2]
// factorize(n: 25) == [5, 5]
// factorize(n: 70) == [2, 5, 7]
func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while i * i <= number {
        while number % i == 0 {
            number /= i
            factors.append(i)
        }
        i += 1
    }
    if number > 1 {
        factors.append(number)
    }
    return factors
}
```

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```swift
// From an array of integers, remove all elements that occur more than once.
// Keep order of elements left the same as in the input.
// removeDuplicates(numbers: [1, 2, 3, 2, 4]) == [1, 3, 4]
func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result: [Int] = []
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```swift
// From an array of integers, remove all elements that occur more than once.
// Keep order of elements left the same as in the input.
// removeDuplicates(numbers: [1, 2, 3, 2, 4]) == [1, 3, 4]
func removeDuplicates(numbers: [Int]) -> [Int] {
    var result: [Int] = []
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```swift
// From an array of integers, remove all elements that occur more than once.
// Keep order of elements left the same as in the input.
// removeDuplicates(numbers: [1, 2, 3, 2, 4]) == [1, 3, 4]
func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result: [Int] = []
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```swift
// From an array of integers, remove all elements that occur more than once.
// Keep order of elements left the same as in the input.
// removeDuplicates(numbers: [1, 2, 3, 2, 4]) == [1, 3, 4]
func removeDuplicates(numbers: [Int]) -> [Int] {
    var result: [Int] = []
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```swift
// From an array of integers, remove all elements that occur more than once.
// Keep order of elements left the same as in the input.
// removeDuplicates(numbers: [1, 2, 3, 2, 4]) == [1, 3, 4]
func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result: [Int] = []
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```swift
// From an array of integers, remove all elements that occur more than once.
// Keep order of elements left the same as in the input.
// removeDuplicates(numbers: [1, 2, 3, 2, 4]) == [1, 3, 4]
func removeDuplicates(numbers: [Int]) -> [Int] {
    var result: [Int] = []
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```swift
// From an array of integers, remove all elements that occur more than once.
// Keep order of elements left the same as in the input.
// removeDuplicates(numbers: [1, 2, 3, 2, 4]) == [1, 3, 4]
func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```swift
// From an array of integers, remove all elements that occur more than once.
// Keep order of elements left the same as in the input.
// removeDuplicates(numbers: [1, 2, 3, 2, 4]) == [1, 3, 4]
func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func removeDuplicates(numbers: [Int]) -> [Int] {
  var result = [Int]()
  for number in numbers {
    if !result.contains(number) {
      result.append(number)
    }
  }
  return result
}
```swift
// From an array of integers, remove all elements that occur more than once.
// Keep order of elements left the same as in the input.
// removeDuplicates(numbers: [1, 2, 3, 2, 4]) == [1, 3, 4]
func removeDuplicates(numbers: [Int]) -> [Int] {
  var result = [Int]()
  for number in numbers {
    if !result.contains(number) {
      result.append(number)
    }
  }
  return result
}
```
 // XCTAssertTrue failed

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result: [Int] = []
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```swift
// From an array of integers, remove all elements that occur more than once.
// Keep order of elements left the same as in the input.
// removeDuplicates(numbers: [1, 2, 3, 2, 4]) == [1, 3, 4]
func removeDuplicates(numbers: [Int]) -> [Int] {
    var result: [Int] = []
    for number in numbers {
        if !result.contains(number) {
            result.append(number)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func flipCase(string: String) -> String {
    var result = ""
    for character in string {
        if character.isUppercase {
            result.append(character.lowercaseString)
        } else if character.isLowercase {
            result.append(character.uppercaseString)
        } else {
            result.append(character)
        }
    }
    return result
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    var result = ""
    for character in string {
        if character.isUppercase {
            result.append(character.lowercaseString)
        } else if character.isLowercase {
            result.append(character.uppercaseString)
        } else {
            result.append(character)
        }
    }
    return result
}
```
result.append(character.lowercaseString) // value of type 'Character' has no member 'lowercaseString'
result.append(character.uppercaseString) // value of type 'Character' has no member 'uppercaseString'

func flipCase(string: String) -> String {
    var result = ""
    for character in string {
        if character.isUppercase {
            result += character.lowercased()
        } else if character.isLowercase {
            result += character.uppercased()
        } else {
            result += character
        }
    }
    return result
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    var result = ""
    for character in string {
        if character.isUppercase {
            result += character.lowercased()
        } else if character.isLowercase {
            result += character.uppercased()
        } else {
            result += character
        }
    }
    return result
}
```
result += character // cannot convert value of type 'Character' to expected argument type 'String'

func flipCase(string: String) -> String {
    return string.map {
        if $0.isLowercase {
            return $0.uppercased()
        } else if $0.isUppercase {
            return $0.lowercased()
        } else {
            return $0
        }
    }
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    return string.map {
        if $0.isLowercase {
            return $0.uppercased()
        } else if $0.isUppercase {
            return $0.lowercased()
        } else {
            return $0
        }
    }
}
```
return string.map { // no 'map' candidates produce the expected contextual result type 'String'

func flipCase(string: String) -> String {
    return string.map { character in
        if character.isUppercase {
            return character.lowercased()
        } else if character.isLowercase {
            return character.uppercased()
        } else {
            return character
        }
    }
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    return string.map { character in
        if character.isUppercase {
            return character.lowercased()
        } else if character.isLowercase {
            return character.uppercased()
        } else {
            return character
        }
    }
}
```
return string.map { character in // no 'map' candidates produce the expected contextual result type 'String'

```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    let lowercase = CharacterSet.lowercaseLetters
    let uppercase = CharacterSet.uppercaseLetters
    let lowercaseToUppercase = lowercase.map { uppercase.map { $0 } }
    let uppercaseToLowercase = uppercase.map { lowercase.map { $0 } }
    let lowercaseToUppercaseMap = lowercaseToUppercase.reduce(into: [:]) { $0[$1] = $1.uppercased() }
    let uppercaseToLowercaseMap = uppercaseToLowercase.reduce(into: [:]) { $0[$1] = $1.lowercased() }
    let lowercaseToUppercaseSet = lowercaseToUppercaseMap.reduce(into: CharacterSet()) { $0.insert($1.key) }
    let uppercaseToLowercaseSet = uppercaseToLowercaseMap.reduce(into: CharacterSet()) { $0.insert($1.key) }
    let lowercaseToUppercaseMapSet = lowercaseToUppercaseSet.map { lowercaseToUppercaseMap[$0] }
    let uppercaseToLowercaseMapSet = uppercaseToLowercaseSet.map { uppercaseToLowercaseMap[$0] }
    let lowercaseToUppercaseMapSetSet = lowercaseToUppercaseMapSet.reduce(into: CharacterSet()) { $0.insert($1) }
    let uppercaseToLowercaseMapSetSet = uppercaseToLowercaseMapSet.reduce(into: CharacterSet()) { $0.insert($1) }
    let lowercaseToUppercaseMapSetSetSet = lowercaseToUppercaseMapSetSet.map { lowercaseToUppercaseMapSetSet[$0] }
    let uppercaseToLowercaseMapSetSetSet = uppercaseToLowercaseMapSetSet.map { uppercaseToLowercaseMapSetSet[$0] }
    let lowercaseToUppercaseMapSetSetSetSet = lowercaseToUppercaseMapSetSetSet.reduce(into: CharacterSet()) { $0.insert($1) }
    let uppercaseToLowercaseMapSetSetSetSet = uppercaseToLowercaseMapSetSetSet.reduce(into: CharacterSet()) { $0.insert($1) }
    let lowercaseToUppercaseMapSetSetSetSetSet = lowercaseToUppercaseMapSetSetSetSet.map { lowercaseToUppercaseMapSetSetSetSet[$0] }
    let uppercaseToLowercaseMapSetSetSetSetSet = uppercaseToLowercaseMapSetSetSetSet.map { uppercaseToLowercaseMapSetSetSetSet[$0] }
    let lowercaseToUppercaseMapSetSetSetSetSetSet = lowercaseToUppercaseMapSetSetSetSetSet.reduce(into: CharacterSet()) { $0.insert($1) }
    let uppercaseToLowercaseMapSetSetSetSetSetSet = uppercaseToLowercaseMapSetSetSetSetSet.reduce(into: CharacterSet()) { $0.insert($1) }
    let lowercaseToUppercaseMapSetSetSetSetSetSetSet = lowercaseToUppercaseMapSetSetSetSetSetSet.map { lowercaseToUppercaseMapSetSetSetSetSetSet[$0] }
    let uppercaseToLowercaseMapSetSetSetSetSetSetSet = uppercaseToLowercaseMapSetSetSetSetSetSet.map { uppercaseToLowercaseMapSetSetSetSetSetSet[$0] }
    let lowercaseToUppercaseMapSetSetSetSetSetSetSetSet = lowercaseToUppercaseMapSetSetSetSetSetSetSetSet.reduce(into: CharacterSet()) { $0.insert($1) }
    let uppercaseToLowercaseMapSetSetSetSetSetSetSetSetSet = uppercaseToLowercaseMapSetSetSetSetSetSetSetSet.reduce(into: CharacterSet()) { $0.insert($1) }
    let lowercaseToUppercaseMapSetSetSetSetSetSetSetSetSetSet = lowercaseToUppercaseMapSetSetSetSetSetSetSetSetSetSet.map { lowercaseToUppercaseMapSetSetSetSetSetSetSetSetSetSet[$0] }
    let uppercaseToLowercaseMapSetSetSetSetSetSetSetSetSetSetSet = uppercaseToLowercaseMapSetSetSetSetSetSetSetSetSetSetSet.reduce(into: CharacterSet()) { $0.insert($1) }
    let lowercaseToUppercaseMapSetSetSetSetSetSetSetSetSetSetSetSetSet = lowercaseToUppercaseMapSetSetSetSetSetSetSetSetSetSetSetSetSet.
XCTAssertTrue(flipCase(string: "") == "") // cannot find 'flipCase' in scope
XCTAssertTrue(flipCase(string: "Hello!") == "hELLO!") // cannot find 'flipCase' in scope
XCTAssertTrue(flipCase(string: "These violent delights have violent ends") == "tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS") // cannot find 'flipCase' in scope

func flipCase(string: String) -> String {
    return string.map {
        if $0.isUppercase {
            return Character(UnicodeScalar($0.unicodeScalars.first!.value - 32))
        } else if $0.isLowercase {
            return Character(UnicodeScalar($0.unicodeScalars.first!.value + 32))
        } else {
            return $0
        }
    }
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    return string.map {
        if $0.isUppercase {
            return Character(UnicodeScalar($0.unicodeScalars.first!.value - 32))
        } else if $0.isLowercase {
            return Character(UnicodeScalar($0.unicodeScalars.first!.value + 32))
        } else {
            return $0
        }
    }
}
```
return string.map { // cannot convert return expression of type '[Character]' to return type 'String'
return Character(UnicodeScalar($0.unicodeScalars.first!.value - 32)) // value of optional type 'UnicodeScalar?' (aka 'Optional<Unicode.Scalar>') must be unwrapped to a value of type 'UnicodeScalar' (aka 'Unicode.Scalar')

func flipCase(string: String) -> String {
    return string.map { character in
        if character.isUppercase {
            return character.lowercased()
        } else if character.isLowercase {
            return character.uppercased()
        } else {
            return character
        }
    }
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    return string.map { character in
        if character.isUppercase {
            return character.lowercased()
        } else if character.isLowercase {
            return character.uppercased()
        } else {
            return character
        }
    }
}
```
return string.map { character in // no 'map' candidates produce the expected contextual result type 'String'

func flipCase(string: String) -> String {
    var result = ""
    for character in string {
        if character.isUppercase {
            result.append(character.lowercaseString)
        } else if character.isLowercase {
            result.append(character.uppercaseString)
        } else {
            result.append(character)
        }
    }
    return result
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    var result = ""
    for character in string {
        if character.isUppercase {
            result.append(character.lowercaseString)
        } else if character.isLowercase {
            result.append(character.uppercaseString)
        } else {
            result.append(character)
        }
    }
    return result
}
```
result.append(character.lowercaseString) // value of type 'Character' has no member 'lowercaseString'
result.append(character.uppercaseString) // value of type 'Character' has no member 'uppercaseString'

func flipCase(string: String) -> String {
    var result = ""
    for character in string {
        if character.isUppercase {
            result.append(character.lowercased())
        } else if character.isLowercase {
            result.append(character.uppercased())
        } else {
            result.append(character)
        }
    }
    return result
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    var result = ""
    for character in string {
        if character.isUppercase {
            result.append(character.lowercased())
        } else if character.isLowercase {
            result.append(character.uppercased())
        } else {
            result.append(character)
        }
    }
    return result
}
```

func flipCase(string: String) -> String {
    let lowercase = "abcdefghijklmnopqrstuvwxyz"
    let uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    var result = ""
    for character in string {
        if lowercase.contains(character) {
            result.append(uppercase[lowercase.index(of: character)!])
        } else if uppercase.contains(character) {
            result.append(lowercase[uppercase.index(of: character)!])
        } else {
            result.append(character)
        }
    }
    return result
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    let lowercase = "abcdefghijklmnopqrstuvwxyz"
    let uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    var result = ""
    for character in string {
        if lowercase.contains(character) {
            result.append(uppercase[lowercase.index(of: character)!])
        } else if uppercase.contains(character) {
            result.append(lowercase[uppercase.index(of: character)!])
        } else {
            result.append(character)
        }
    }
    return result
}
```
result.append(uppercase[lowercase.index(of: character)!]) // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
result.append(lowercase[uppercase.index(of: character)!]) // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'

func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```swift
// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Conc

func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```swift
// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```

func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```swift
// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```

func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```swift
// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```

func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```swift
// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Conc

func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```swift
// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```

func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```swift
// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```

func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```swift
// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```

func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```swift
// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Conc

func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}
```swift
// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

// Conc

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```swift
// Filter an input array of strings only for ones that start with a given prefix.
// filterByPrefix(strings: [] as [String], prefix: "a") == [] as [String]
// filterByPrefix(strings: ["abc", "bcd", "cde", "array"], prefix: "a") == ["abc", "array"]
func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```swift
// Filter an input array of strings only for ones that start with a given prefix.
// filterByPrefix(strings: [] as [String], prefix: "a") == [] as [String]
// filterByPrefix(strings: ["abc", "bcd", "cde", "array"], prefix: "a") == ["abc", "array"]
func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```swift
// Filter an input array of strings only for ones that start with a given prefix.
// filterByPrefix(strings: [] as [String], prefix: "a") == [] as [String]
// filterByPrefix(strings: ["abc", "bcd", "cde", "array"], prefix: "a") == ["abc", "array"]
func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```swift
// Filter an input array of strings only for ones that start with a given prefix.
// filterByPrefix(strings: [] as [String], prefix: "a") == [] as [String]
// filterByPrefix(strings: ["abc", "bcd", "cde", "array"], prefix: "a") == ["abc", "array"]
func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```swift
// Filter an input array of strings only for ones that start with a given prefix.
// filterByPrefix(strings: [] as [String], prefix: "a") == [] as [String]
// filterByPrefix(strings: ["abc", "bcd", "cde", "array"], prefix: "a") == ["abc", "array"]
func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```swift
// Filter an input array of strings only for ones that start with a given prefix.
// filterByPrefix(strings: [] as [String], prefix: "a") == [] as [String]
// filterByPrefix(strings: ["abc", "bcd", "cde", "array"], prefix: "a") == ["abc", "array"]
func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```swift
// Filter an input array of strings only for ones that start with a given prefix.
// filterByPrefix(strings: [] as [String], prefix: "a") == [] as [String]
// filterByPrefix(strings: ["abc", "bcd", "cde", "array"], prefix: "a") == ["abc", "array"]
func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```swift
// Filter an input array of strings only for ones that start with a given prefix.
// filterByPrefix(strings: [] as [String], prefix: "a") == [] as [String]
// filterByPrefix(strings: ["abc", "bcd", "cde", "array"], prefix: "a") == ["abc", "array"]
func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```swift
// Filter an input array of strings only for ones that start with a given prefix.
// filterByPrefix(strings: [] as [String], prefix: "a") == [] as [String]
// filterByPrefix(strings: ["abc", "bcd", "cde", "array"], prefix: "a") == ["abc", "array"]
func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```swift
// Filter an input array of strings only for ones that start with a given prefix.
// filterByPrefix(strings: [] as [String], prefix: "a") == [] as [String]
// filterByPrefix(strings: ["abc", "bcd", "cde", "array"], prefix: "a") == ["abc", "array"]
func filterByPrefix(strings: [String], prefix: String) -> [String] {
    return strings.filter { $0.hasPrefix(prefix) }
}
```

func getPositive(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<l.count {
        if l[i] > 0 {
            result.append(l[i])
        }
    }
    return result
}
```swift
// Return only positive numbers in the array.
// getPositive(l: [-1, 2, -4, 5, 6]) == [2, 5, 6]
// getPositive(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 9, 123, 1]
func getPositive(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<l.count {
        if l[i] > 0 {
            result.append(l[i])
        }
    }
    return result
}
```

func getPositive(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if i > 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Return only positive numbers in the array.
// getPositive(l: [-1, 2, -4, 5, 6]) == [2, 5, 6]
// getPositive(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 9, 123, 1]
func getPositive(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if i > 0 {
            result.append(i)
        }
    }
    return result
}
```

func getPositive(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<l.count {
        if l[i] > 0 {
            result.append(l[i])
        }
    }
    return result
}
```swift
// Return only positive numbers in the array.
// getPositive(l: [-1, 2, -4, 5, 6]) == [2, 5, 6]
// getPositive(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 9, 123, 1]
func getPositive(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<l.count {
        if l[i] > 0 {
            result.append(l[i])
        }
    }
    return result
}
```

func getPositive(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if i > 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Return only positive numbers in the array.
// getPositive(l: [-1, 2, -4, 5, 6]) == [2, 5, 6]
// getPositive(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 9, 123, 1]
func getPositive(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if i > 0 {
            result.append(i)
        }
    }
    return result
}
```

func getPositive(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        if i > 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Return only positive numbers in the array.
// getPositive(l: [-1, 2, -4, 5, 6]) == [2, 5, 6]
// getPositive(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 9, 123, 1]
func getPositive(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        if i > 0 {
            result.append(i)
        }
    }
    return result
}
```

func getPositive(l: [Int]) -> [Int] {
    var result = [Int]()
    for item in l {
        if item > 0 {
            result.append(item)
        }
    }
    return result
}
```swift
// Return only positive numbers in the array.
// getPositive(l: [-1, 2, -4, 5, 6]) == [2, 5, 6]
// getPositive(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 9, 123, 1]
func getPositive(l: [Int]) -> [Int] {
    var result = [Int]()
    for item in l {
        if item > 0 {
            result.append(item)
        }
    }
    return result
}
```

func getPositive(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        if i > 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Return only positive numbers in the array.
// getPositive(l: [-1, 2, -4, 5, 6]) == [2, 5, 6]
// getPositive(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 9, 123, 1]
func getPositive(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        if i > 0 {
            result.append(i)
        }
    }
    return result
}
```

func getPositive(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<l.count {
        if l[i] > 0 {
            result.append(l[i])
        }
    }
    return result
}
```swift
// Return only positive numbers in the array.
// getPositive(l: [-1, 2, -4, 5, 6]) == [2, 5, 6]
// getPositive(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 9, 123, 1]
func getPositive(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<l.count {
        if l[i] > 0 {
            result.append(l[i])
        }
    }
    return result
}
```

func getPositive(l: [Int]) -> [Int] {
    return l.filter { $0 > 0 }
}
```swift
// Return only positive numbers in the array.
// getPositive(l: [-1, 2, -4, 5, 6]) == [2, 5, 6]
// getPositive(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 9, 123, 1]
func getPositive(l: [Int]) -> [Int] {
    return l.filter { $0 > 0 }
}
```

func getPositive(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if i > 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Return only positive numbers in the array.
// getPositive(l: [-1, 2, -4, 5, 6]) == [2, 5, 6]
// getPositive(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 9, 123, 1]
func getPositive(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if i > 0 {
            result.append(i)
        }
    }
    return result
}
```

func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Return true if a given number is prime, and false otherwise.
// isPrime(n: 6) == false
// isPrime(n: 101) == true
// isPrime(n: 11) == true
// isPrime(n: 13441) == true
// isPrime(n: 61) == true
// isPrime(n: 4) == false
// isPrime(n: 1) == false
func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Return true if a given number is prime, and false otherwise.
// isPrime(n: 6) == false
// isPrime(n: 101) == true
// isPrime(n: 11) == true
// isPrime(n: 13441) == true
// isPrime(n: 61) == true
// isPrime(n: 4) == false
// isPrime(n: 1) == false
func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Return true if a given number is prime, and false otherwise.
// isPrime(n: 6) == false
// isPrime(n: 101) == true
// isPrime(n: 11) == true
// isPrime(n: 13441) == true
// isPrime(n: 61) == true
// isPrime(n: 4) == false
// isPrime(n: 1) == false
func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Return true if a given number is prime, and false otherwise.
// isPrime(n: 6) == false
// isPrime(n: 101) == true
// isPrime(n: 11) == true
// isPrime(n: 13441) == true
// isPrime(n: 61) == true
// isPrime(n: 4) == false
// isPrime(n: 1) == false
func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

func isPrime(n: Int) -> Bool {
    if n < 2 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Return true if a given number is prime, and false otherwise.
// isPrime(n: 6) == false
// isPrime(n: 101) == true
// isPrime(n: 11) == true
// isPrime(n: 13441) == true
// isPrime(n: 61) == true
// isPrime(n: 4) == false
// isPrime(n: 1) == false
func isPrime(n: Int) -> Bool {
    if n < 2 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Return true if a given number is prime, and false otherwise.
// isPrime(n: 6) == false
// isPrime(n: 101) == true
// isPrime(n: 11) == true
// isPrime(n: 13441) == true
// isPrime(n: 61) == true
// isPrime(n: 4) == false
// isPrime(n: 1) == false
func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Return true if a given number is prime, and false otherwise.
// isPrime(n: 6) == false
// isPrime(n: 101) == true
// isPrime(n: 11) == true
// isPrime(n: 13441) == true
// isPrime(n: 61) == true
// isPrime(n: 4) == false
// isPrime(n: 1) == false
func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

func isPrime(n: Int) -> Bool {
    if n < 2 {
        return false
    }
    for i in 2...Int(sqrt(Double(n))) {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Return true if a given number is prime, and false otherwise.
// isPrime(n: 6) == false
// isPrime(n: 101) == true
// isPrime(n: 11) == true
// isPrime(n: 13441) == true
// isPrime(n: 61) == true
// isPrime(n: 4) == false
// isPrime(n: 1) == false
func isPrime(n: Int) -> Bool {
    if n < 2 {
        return false
    }
    for i in 2...Int(sqrt(Double(n))) {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Return true if a given number is prime, and false otherwise.
// isPrime(n: 6) == false
// isPrime(n: 101) == true
// isPrime(n: 11) == true
// isPrime(n: 13441) == true
// isPrime(n: 61) == true
// isPrime(n: 4) == false
// isPrime(n: 1) == false
func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Return true if a given number is prime, and false otherwise.
// isPrime(n: 6) == false
// isPrime(n: 101) == true
// isPrime(n: 11) == true
// isPrime(n: 13441) == true
// isPrime(n: 61) == true
// isPrime(n: 4) == false
// isPrime(n: 1) == false
func isPrime(n: Int) -> Bool {
    guard n > 1 else { return false }
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

func sortThird(l: [Int]) -> [Int] {
    var l = l
    let n = l.count
    for i in stride(from: 0, to: n, by: 3) {
        l.sort()
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// sortThird(l: [1, 2, 3]) == [1, 2, 3]
// sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
func sortThird(l: [Int]) -> [Int] {
    var l = l
    let n = l.count
    for i in stride(from: 0, to: n, by: 3) {
        l.sort()
    }
    return l
}
```
for i in stride(from: 0, to: n, by: 3) { // immutable value 'i' was never used; consider replacing with '_' or removing it
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var l = l
    l.sort()
    for i in stride(from: 0, to: l.count, by: 3) {
        l[i] = l[i + 1]
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// sortThird(l: [1, 2, 3]) == [1, 2, 3]
// sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
func sortThird(l: [Int]) -> [Int] {
    var l = l
    l.sort()
    for i in stride(from: 0, to: l.count, by: 3) {
        l[i] = l[i + 1]
    }
    return l
}
```
 // Fatal error: Index out of range

func sortThird(l: [Int]) -> [Int] {
    var l = l
    l.sort { $0 % 3 < $1 % 3 }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// sortThird(l: [1, 2, 3]) == [1, 2, 3]
// sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
func sortThird(l: [Int]) -> [Int] {
    var l = l
    l.sort { $0 % 3 < $1 % 3 }
    return l
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var l = l
    for i in stride(from: 0, to: l.count, by: 3) {
        l[i] = l[i + 1]
        l[i + 1] = l[i + 2]
        l[i + 2] = l[i]
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// sortThird(l: [1, 2, 3]) == [1, 2, 3]
// sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
func sortThird(l: [Int]) -> [Int] {
    var l = l
    for i in stride(from: 0, to: l.count, by: 3) {
        l[i] = l[i + 1]
        l[i + 1] = l[i + 2]
        l[i + 2] = l[i]
    }
    return l
}
```
 // Fatal error: Index out of range

func sortThird(l: [Int]) -> [Int] {
    var l = l
    l.sort()
    var i = 0
    while i < l.count {
        if i % 3 == 0 {
            i += 1
        } else {
            l[i] = l[i - 1]
            i += 2
        }
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// sortThird(l: [1, 2, 3]) == [1, 2, 3]
// sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
func sortThird(l: [Int]) -> [Int] {
    var l = l
    l.sort()
    var i = 0
    while i < l.count {
        if i % 3 == 0 {
            i += 1
        } else {
            l[i] = l[i - 1]
            i += 2
        }
    }
    return l
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            l[i] = l[i]
        } else {
            l[i] = l[i]
        }
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// sortThird(l: [1, 2, 3]) == [1, 2, 3]
// sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
func sortThird(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            l[i] = l[i]
        } else {
            l[i] = l[i]
        }
    }
    return l
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var l = l
    l.sort()
    var i = 0
    var j = 0
    while i < l.count && j < l.count {
        if i % 3 == 0 {
            i += 1
        } else if j % 3 == 0 {
            j += 1
        } else {
            l[i] = l[j]
            i += 1
            j += 1
        }
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// sortThird(l: [1, 2, 3]) == [1, 2, 3]
// sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
func sortThird(l: [Int]) -> [Int] {
    var l = l
    l.sort()
    var i = 0
    var j = 0
    while i < l.count && j < l.count {
        if i % 3 == 0 {
            i += 1
        } else if j % 3 == 0 {
            j += 1
        } else {
            l[i] = l[j]
            i += 1
            j += 1
        }
    }
    return l
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var l = l
    let third = l.count / 3
    for i in 0..<third {
        let j = i * 3
        let k = j + 1
        let m = j + 2
        if l[j] > l[k] {
            l[j] = l[k]
            l[k] = l[m]
            l[m] = l[j]
        } else if l[j] == l[k] && l[j] > l[m] {
            l[j] = l[m]
            l[m] = l[k]
            l[k] = l[j]
        }
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// sortThird(l: [1, 2, 3]) == [1, 2, 3]
// sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
func sortThird(l: [Int]) -> [Int] {
    var l = l
    let third = l.count / 3
    for i in 0..<third {
        let j = i * 3
        let k = j + 1
        let m = j + 2
        if l[j] > l[k] {
            l[j] = l[k]
            l[k] = l[m]
            l[m] = l[j]
        } else if l[j] == l[k] && l[j] > l[m] {
            l[j] = l[m]
            l[m] = l[k]
            l[k] = l[j]
        }
    }
    return l
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            l[i] = l[i + 1]
            l[i + 1] = l[i + 2]
            l[i + 2] = l[i]
        }
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// sortThird(l: [1, 2, 3]) == [1, 2, 3]
// sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
func sortThird(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            l[i] = l[i + 1]
            l[i + 1] = l[i + 2]
            l[i + 2] = l[i]
        }
    }
    return l
}
```
 // Fatal error: Index out of range

func sortThird(l: [Int]) -> [Int] {
    var l = l
    l.sort()
    for i in 0..<l.count {
        if i % 3 == 0 {
            l[i] = l[i + 1]
            l[i + 1] = l[i + 2]
            l[i + 2] = l[i]
        }
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// sortThird(l: [1, 2, 3]) == [1, 2, 3]
// sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
func sortThird(l: [Int]) -> [Int] {
    var l = l
    l.sort()
    for i in 0..<l.count {
        if i % 3 == 0 {
            l[i] = l[i + 1]
            l[i + 1] = l[i + 2]
            l[i + 2] = l[i]
        }
    }
    return l
}
```
 // Fatal error: Index out of range

func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        if !result.contains(i) {
            result.append(i)
        }
    }
    return result
}
```swift
// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        if !result.contains(i) {
            result.append(i)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func unique(l: [Int]) -> [Int] {
    var unique = [Int]()
    for i in l {
        if !unique.contains(i) {
            unique.append(i)
        }
    }
    return unique
}
```swift
// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var unique = [Int]()
    for i in l {
        if !unique.contains(i) {
            unique.append(i)
        }
    }
    return unique
}
```
 // XCTAssertTrue failed

func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(i) {
            result.append(i)
        }
    }
    return result
}

func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(where: { $0 == i }) {
            result.append(i)
        }
    }
    return result
}
```swift
// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(i) {
            result.append(i)
        }
    }
    return result
}

// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(where: { $0 == i }) {
            result.append(i)
        }
    }
    return result
}

// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(where: { $0 == i }) {
            result.append(i)
        }
    }
    return result
}

// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(where: { $0 == i }) {
            result.append(i)
        }
    }
    return result
}

// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(where: { $0 == i }) {
            result.append(i)
        }
    }
    return result
}

// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(where: { $0 == i }) {
            result.append(i)
        }
    }
    return result
}

// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(where: { $0 == i }) {
            result.append(i)
        }
    }
    return result
}

// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(where: { $0 == i }) {
            result.append(i)
        }
    }
    return result
}

// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 
func unique(l: [Int]) -> [Int] { // invalid redeclaration of 'unique(l:)'

func unique(l: [Int]) -> [Int] {
    var unique = [Int]()
    for i in l {
        if !unique.contains(i) {
            unique.append(i)
        }
    }
    return unique.sorted()
}
```swift
// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var unique = [Int]()
    for i in l {
        if !unique.contains(i) {
            unique.append(i)
        }
    }
    return unique.sorted()
}
```

func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(i) {
            result.append(i)
        }
    }
    return result
}
```swift
// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(i) {
            result.append(i)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func unique(l: [Int]) -> [Int] {
    var unique = [Int]()
    for i in l {
        if !unique.contains(i) {
            unique.append(i)
        }
    }
    return unique
}
```swift
// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var unique = [Int]()
    for i in l {
        if !unique.contains(i) {
            unique.append(i)
        }
    }
    return unique
}
```
 // XCTAssertTrue failed

func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    for n in l {
        if !result.contains(n) {
            result.append(n)
        }
    }
    return result
}
```swift
// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    for n in l {
        if !result.contains(n) {
            result.append(n)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(i) {
            result.append(i)
        }
    }
    return result
}
```swift
// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l {
        if !result.contains(i) {
            result.append(i)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        if !result.contains(i) {
            result.append(i)
        }
    }
    return result
}
```swift
// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        if !result.contains(i) {
            result.append(i)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        if !result.contains(i) {
            result.append(i)
        }
    }
    return result
}
```swift
// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        if !result.contains(i) {
            result.append(i)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```swift
// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}

// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}

// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}

// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}

// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}

// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}

// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}

// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] >

func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```swift
// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```

func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```swift
// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```

func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```swift
// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```

func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}

func minElement(l: [Int]) -> Int {
    var min = l[0]
    for i in 1..<l.count {
        if l[i] < min {
            min = l[i]
        }
    }
    return min
}
```swift
// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}

// Return minimum element in the array.
// minElement(l: [1, 2, 3]) == 1
// minElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == -10
func minElement(l: [Int]) -> Int {
    var min = l[0]
    for i in 1..<l.count {
        if l[i] < min {
            min = l[i]
        }
    }
    return min
}

// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}

// Return minimum element in the array.
// minElement(l: [1, 2, 3]) == 1
// minElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == -10
func minElement(l: [Int]) -> Int {
    var min = l[0]
    for i in 1..<l.count {
        if l[i] < min {
            min = l[i]
        }
    }
    return min
}

// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}

// Return minimum element in the array.
// minElement(l: [1, 2, 3]) == 1
// minElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == -10
func minElement(l: [Int]) -> Int {
    var min = l[0]
    for i in 1..<l.count {
        if l[i] < min {
            min = l[i]
        }
    }
    return min
}

// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}

// Return minimum element in the array.
// minElement(l: [1, 2, 3]) == 1
// minElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == -10
func minElement(l: [Int]) -> Int {
    var min = l[0]
    for i in 1..<l.count {
        if l[i] < min {
           

func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```swift
// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```

func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```swift
// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```

func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```swift
// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```

func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```swift
// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```

func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```swift
// Return maximum element in the array.
// maxElement(l: [1, 2, 3]) == 3
// maxElement(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == 123
func maxElement(l: [Int]) -> Int {
    var max = l[0]
    for i in 1..<l.count {
        if l[i] > max {
            max = l[i]
        }
    }
    return max
}
```

func fizzBuzz(n: Int) -> Int {
    return 0
}
```swift
// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
// fizzBuzz(n: 50) == 0
// fizzBuzz(n: 78) == 2
// fizzBuzz(n: 79) == 3
func fizzBuzz(n: Int) -> Int {
    return 0
}
```
 // XCTAssertTrue failed

func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```swift
// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
// fizzBuzz(n: 50) == 0
// fizzBuzz(n: 78) == 2
// fizzBuzz(n: 79) == 3
func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 0..<n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```swift
// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
// fizzBuzz(n: 50) == 0
// fizzBuzz(n: 78) == 2
// fizzBuzz(n: 79) == 3
func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 0..<n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func fizzBuzz(n: Int) -> Int {
    return 0
}
```swift
// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
// fizzBuzz(n: 50) == 0
// fizzBuzz(n: 78) == 2
// fizzBuzz(n: 79) == 3
func fizzBuzz(n: Int) -> Int {
    return 0
}
```
 // XCTAssertTrue failed

func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```swift
// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
// fizzBuzz(n: 50) == 0
// fizzBuzz(n: 78) == 2
// fizzBuzz(n: 79) == 3
func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```swift
// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
// fizzBuzz(n: 50) == 0
// fizzBuzz(n: 78) == 2
// fizzBuzz(n: 79) == 3
func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```swift
// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
// fizzBuzz(n: 50) == 0
// fizzBuzz(n: 78) == 2
// fizzBuzz(n: 79) == 3
func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```swift
// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
// fizzBuzz(n: 50) == 0
// fizzBuzz(n: 78) == 2
// fizzBuzz(n: 79) == 3
func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```swift
// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
// fizzBuzz(n: 50) == 0
// fizzBuzz(n: 78) == 2
// fizzBuzz(n: 79) == 3
func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 0..<n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```swift
// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
// fizzBuzz(n: 50) == 0
// fizzBuzz(n: 78) == 2
// fizzBuzz(n: 79) == 3
func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 0..<n {
        if i % 11 == 0 || i % 13 == 0 {
            if i.description.contains("7") {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i]
        } else {
            l[i] = l[i]
        }
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the odd indicies, while its values at the even indicies are equal
// to the values of the even indicies of l, but sorted.
// sortEven(l: [1, 2, 3]) == [1, 2, 3]
// sortEven(l: [5, 6, 3, 4]) == [3, 6, 5, 4]
func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i]
        } else {
            l[i] = l[i]
        }
    }
    return l
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    l.sort()
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the odd indicies, while its values at the even indicies are equal
// to the values of the even indicies of l, but sorted.
// sortEven(l: [1, 2, 3]) == [1, 2, 3]
// sortEven(l: [5, 6, 3, 4]) == [3, 6, 5, 4]
func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    l.sort()
    return l
}
```
 // Fatal error: Index out of range

func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    l.sort()
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the odd indicies, while its values at the even indicies are equal
// to the values of the even indicies of l, but sorted.
// sortEven(l: [1, 2, 3]) == [1, 2, 3]
// sortEven(l: [5, 6, 3, 4]) == [3, 6, 5, 4]
func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    l.sort()
    return l
}
```
 // Fatal error: Index out of range

func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the odd indicies, while its values at the even indicies are equal
// to the values of the even indicies of l, but sorted.
// sortEven(l: [1, 2, 3]) == [1, 2, 3]
// sortEven(l: [5, 6, 3, 4]) == [3, 6, 5, 4]
func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    return l
}
```
 // Fatal error: Index out of range

func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i]
        } else {
            l[i] = l[i]
        }
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the odd indicies, while its values at the even indicies are equal
// to the values of the even indicies of l, but sorted.
// sortEven(l: [1, 2, 3]) == [1, 2, 3]
// sortEven(l: [5, 6, 3, 4]) == [3, 6, 5, 4]
func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i]
        } else {
            l[i] = l[i]
        }
    }
    return l
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    l.sort()
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the odd indicies, while its values at the even indicies are equal
// to the values of the even indicies of l, but sorted.
// sortEven(l: [1, 2, 3]) == [1, 2, 3]
// sortEven(l: [5, 6, 3, 4]) == [3, 6, 5, 4]
func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    l.sort()
    return l
}
```
 // Fatal error: Index out of range

func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    l.sort()
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the odd indicies, while its values at the even indicies are equal
// to the values of the even indicies of l, but sorted.
// sortEven(l: [1, 2, 3]) == [1, 2, 3]
// sortEven(l: [5, 6, 3, 4]) == [3, 6, 5, 4]
func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    l.sort()
    return l
}
```
 // Fatal error: Index out of range

func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    l.sort()
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the odd indicies, while its values at the even indicies are equal
// to the values of the even indicies of l, but sorted.
// sortEven(l: [1, 2, 3]) == [1, 2, 3]
// sortEven(l: [5, 6, 3, 4]) == [3, 6, 5, 4]
func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    l.sort()
    return l
}
```
 // Fatal error: Index out of range

func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the odd indicies, while its values at the even indicies are equal
// to the values of the even indicies of l, but sorted.
// sortEven(l: [1, 2, 3]) == [1, 2, 3]
// sortEven(l: [5, 6, 3, 4]) == [3, 6, 5, 4]
func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i + 1]
        }
    }
    return l
}
```
 // Fatal error: Index out of range

func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i]
        } else {
            l[i] = l[i]
        }
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the odd indicies, while its values at the even indicies are equal
// to the values of the even indicies of l, but sorted.
// sortEven(l: [1, 2, 3]) == [1, 2, 3]
// sortEven(l: [5, 6, 3, 4]) == [3, 6, 5, 4]
func sortEven(l: [Int]) -> [Int] {
    var l = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            l[i] = l[i]
        } else {
            l[i] = l[i]
        }
    }
    return l
}
```
 // XCTAssertTrue failed

func primeFib(n: Int) -> Int {
    var i = 1
    var j = 1
    var k = 2
    while i <= n {
        if isPrime(k) {
            i += 1
            if i == n {
                return k
            }
        }
        j += 1
        if isPrime(j) {
            i += 1
            if i == n {
                return j
            }
        }
        k += 1
        if isPrime(k) {
            i += 1
            if i == n {
                return k
            }
        }
    }
    return -1
}
```swift
// prime_fib returns n-th number that is a Fibonacci number and it's also prime.
// primeFib(n: 1) == 2
// primeFib(n: 2) == 3
// primeFib(n: 3) == 5
// primeFib(n: 4) == 13
// primeFib(n: 5) == 89
func primeFib(n: Int) -> Int {
    var i = 1
    var j = 1
    var k = 2
    while i <= n {
        if isPrime(k) {
            i += 1
            if i == n {
                return k
            }
        }
        j += 1
        if isPrime(j) {
            i += 1
            if i == n {
                return j
            }
        }
        k += 1
        if isPrime(k) {
            i += 1
            if i == n {
                return k
            }
        }
    }
    return -1
}
```
if isPrime(k) { // cannot find 'isPrime' in scope
if isPrime(j) { // cannot find 'isPrime' in scope
if isPrime(k) { // cannot find 'isPrime' in scope

func primeFib(n: Int) -> Int {
    var i = 1
    var j = 2
    var k = 0
    while k < n {
        if isPrime(j) {
            k += 1
            if k == n {
                return j
            }
        }
        i = j
        j = i + j
    }
    return 0
}

func isPrime(_ n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2...Int(sqrt(Double(n))) {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// prime_fib returns n-th number that is a Fibonacci number and it's also prime.
// primeFib(n: 1) == 2
// primeFib(n: 2) == 3
// primeFib(n: 3) == 5
// primeFib(n: 4) == 13
// primeFib(n: 5) == 89
func primeFib(n: Int) -> Int {
    var i = 1
    var j = 2
    var k = 0
    while k < n {
        if isPrime(j) {
            k += 1
            if k == n {
                return j
            }
        }
        i = j
        j = i + j
    }
    return 0
}

func isPrime(_ n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    for i in 2...Int(sqrt(Double(n))) {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func primeFib(n: Int) -> Int {
    var result = 0
    var i = 1
    var j = 1
    while i < n {
        result = i
        i = i + j
        j = i - j
    }
    return result
}
```swift
// prime_fib returns n-th number that is a Fibonacci number and it's also prime.
// primeFib(n: 1) == 2
// primeFib(n: 2) == 3
// primeFib(n: 3) == 5
// primeFib(n: 4) == 13
// primeFib(n: 5) == 89
func primeFib(n: Int) -> Int {
    var result = 0
    var i = 1
    var j = 1
    while i < n {
        result = i
        i = i + j
        j = i - j
    }
    return result
}
```
 // XCTAssertTrue failed

func primeFib(n: Int) -> Int {
    var a = 1
    var b = 1
    var c = 0
    var i = 2
    while i < n {
        c = a + b
        a = b
        b = c
        i += 1
    }
    return c
}
```swift
// prime_fib returns n-th number that is a Fibonacci number and it's also prime.
// primeFib(n: 1) == 2
// primeFib(n: 2) == 3
// primeFib(n: 3) == 5
// primeFib(n: 4) == 13
// primeFib(n: 5) == 89
func primeFib(n: Int) -> Int {
    var a = 1
    var b = 1
    var c = 0
    var i = 2
    while i < n {
        c = a + b
        a = b
        b = c
        i += 1
    }
    return c
}
```
 // XCTAssertTrue failed

func primeFib(n: Int) -> Int {
    var i = 1
    var j = 1
    var k = 0
    while k < n {
        k += 1
        i = i + j
        j = i - j
    }
    return i
}
```swift
// prime_fib returns n-th number that is a Fibonacci number and it's also prime.
// primeFib(n: 1) == 2
// primeFib(n: 2) == 3
// primeFib(n: 3) == 5
// primeFib(n: 4) == 13
// primeFib(n: 5) == 89
func primeFib(n: Int) -> Int {
    var i = 1
    var j = 1
    var k = 0
    while k < n {
        k += 1
        i = i + j
        j = i - j
    }
    return i
}
```
 // XCTAssertTrue failed

func primeFib(n: Int) -> Int {
    var i = 1
    var j = 1
    while i < n {
        i += j
        j += i
    }
    return i
}
```swift
// prime_fib returns n-th number that is a Fibonacci number and it's also prime.
// primeFib(n: 1) == 2
// primeFib(n: 2) == 3
// primeFib(n: 3) == 5
// primeFib(n: 4) == 13
// primeFib(n: 5) == 89
func primeFib(n: Int) -> Int {
    var i = 1
    var j = 1
    while i < n {
        i += j
        j += i
    }
    return i
}
```
 // XCTAssertTrue failed

func primeFib(n: Int) -> Int {
    var primeFib = [1, 2, 3]
    var i = 4
    while primeFib.count < n {
        let next = primeFib[i - 1] + primeFib[i - 2]
        if isPrime(next) {
            primeFib.append(next)
        }
        i += 1
    }
    return primeFib[n - 1]
}

func isPrime(_ number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2...Int(sqrt(Double(number))) {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// prime_fib returns n-th number that is a Fibonacci number and it's also prime.
// primeFib(n: 1) == 2
// primeFib(n: 2) == 3
// primeFib(n: 3) == 5
// primeFib(n: 4) == 13
// primeFib(n: 5) == 89
func primeFib(n: Int) -> Int {
    var primeFib = [1, 2, 3]
    var i = 4
    while primeFib.count < n {
        let next = primeFib[i - 1] + primeFib[i - 2]
        if isPrime(next) {
            primeFib.append(next)
        }
        i += 1
    }
    return primeFib[n - 1]
}

func isPrime(_ number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2...Int(sqrt(Double(number))) {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func primeFib(n: Int) -> Int {
    var result = 0
    var i = 1
    var j = 1
    while i < n {
        result = j
        i += 1
        j += result
    }
    return result
}
```swift
// prime_fib returns n-th number that is a Fibonacci number and it's also prime.
// primeFib(n: 1) == 2
// primeFib(n: 2) == 3
// primeFib(n: 3) == 5
// primeFib(n: 4) == 13
// primeFib(n: 5) == 89
func primeFib(n: Int) -> Int {
    var result = 0
    var i = 1
    var j = 1
    while i < n {
        result = j
        i += 1
        j += result
    }
    return result
}
```
 // XCTAssertTrue failed

func primeFib(n: Int) -> Int {
    var primeFib = [1, 2]
    var i = 2
    while primeFib.count < n {
        let next = primeFib[i - 1] + primeFib[i - 2]
        if isPrime(number: next) {
            primeFib.append(next)
        }
        i += 1
    }
    return primeFib[n - 1]
}

func isPrime(number: Int) -> Bool {
    if number < 2 {
        return false
    }
    for i in 2...Int(sqrt(Double(number))) {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// prime_fib returns n-th number that is a Fibonacci number and it's also prime.
// primeFib(n: 1) == 2
// primeFib(n: 2) == 3
// primeFib(n: 3) == 5
// primeFib(n: 4) == 13
// primeFib(n: 5) == 89
func primeFib(n: Int) -> Int {
    var primeFib = [1, 2]
    var i = 2
    while primeFib.count < n {
        let next = primeFib[i - 1] + primeFib[i - 2]
        if isPrime(number: next) {
            primeFib.append(next)
        }
        i += 1
    }
    return primeFib[n - 1]
}

func isPrime(number: Int) -> Bool {
    if number < 2 {
        return false
    }
    for i in 2...Int(sqrt(Double(number))) {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func primeFib(n: Int) -> Int {
    var n = n
    var a = 0
    var b = 1
    var c = 1
    while n > 0 {
        c = a + b
        if isPrime(c) {
            n -= 1
        }
        a = b
        b = c
    }
    return c
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// prime_fib returns n-th number that is a Fibonacci number and it's also prime.
// primeFib(n: 1) == 2
// primeFib(n: 2) == 3
// primeFib(n: 3) == 5
// primeFib(n: 4) == 13
// primeFib(n: 5) == 89
func primeFib(n: Int) -> Int {
    var n = n
    var a = 0
    var b = 1
    var c = 1
    while n > 0 {
        c = a + b
        if isPrime(c) {
            n -= 1
        }
        a = b
        b = c
    }
    return c
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Write your code here
}
```swift
// triples_sum_to_zero takes an array of integers as an input.
// it returns true if there are three distinct elements in the array that
// sum to zero, and false otherwise.
// triplesSumToZero(l: [1, 3, 5, 0]) == false
// triplesSumToZero(l: [1, 3, -2, 1]) == true
// triplesSumToZero(l: [1, 2, 3, 7]) == false
// triplesSumToZero(l: [2, 4, -5, 3, 9, 7]) == true
// triplesSumToZero(l: [1]) == false
func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Write your code here
}
```
} // missing return in global function expected to return 'Bool'

func triplesSumToZero(l: [Int]) -> Bool {
    // Your code here
}
```swift
// triples_sum_to_zero takes an array of integers as an input.
// it returns true if there are three distinct elements in the array that
// sum to zero, and false otherwise.
// triplesSumToZero(l: [1, 3, 5, 0]) == false
// triplesSumToZero(l: [1, 3, -2, 1]) == true
// triplesSumToZero(l: [1, 2, 3, 7]) == false
// triplesSumToZero(l: [2, 4, -5, 3, 9, 7]) == true
// triplesSumToZero(l: [1]) == false
func triplesSumToZero(l: [Int]) -> Bool {
    // Your code here
}
```
} // missing return in global function expected to return 'Bool'

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
}
```swift
// triples_sum_to_zero takes an array of integers as an input.
// it returns true if there are three distinct elements in the array that
// sum to zero, and false otherwise.
// triplesSumToZero(l: [1, 3, 5, 0]) == false
// triplesSumToZero(l: [1, 3, -2, 1]) == true
// triplesSumToZero(l: [1, 2, 3, 7]) == false
// triplesSumToZero(l: [2, 4, -5, 3, 9, 7]) == true
// triplesSumToZero(l: [1]) == false
func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
}
```swift
// triples_sum_to_zero takes an array of integers as an input.
// it returns true if there are three distinct elements in the array that
// sum to zero, and false otherwise.
// triplesSumToZero(l: [1, 3, 5, 0]) == false
// triplesSumToZero(l: [1, 3, -2, 1]) == true
// triplesSumToZero(l: [1, 2, 3, 7]) == false
// triplesSumToZero(l: [2, 4, -5, 3, 9, 7]) == true
// triplesSumToZero(l: [1]) == false
func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
}
```swift
// triples_sum_to_zero takes an array of integers as an input.
// it returns true if there are three distinct elements in the array that
// sum to zero, and false otherwise.
// triplesSumToZero(l: [1, 3, 5, 0]) == false
// triplesSumToZero(l: [1, 3, -2, 1]) == true
// triplesSumToZero(l: [1, 2, 3, 7]) == false
// triplesSumToZero(l: [2, 4, -5, 3, 9, 7]) == true
// triplesSumToZero(l: [1]) == false
func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
    return false
}
```swift
// triples_sum_to_zero takes an array of integers as an input.
// it returns true if there are three distinct elements in the array that
// sum to zero, and false otherwise.
// triplesSumToZero(l: [1, 3, 5, 0]) == false
// triplesSumToZero(l: [1, 3, -2, 1]) == true
// triplesSumToZero(l: [1, 2, 3, 7]) == false
// triplesSumToZero(l: [2, 4, -5, 3, 9, 7]) == true
// triplesSumToZero(l: [1]) == false
func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
    return false
}
```
 // XCTAssertTrue failed

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
    return false
}
```swift
// triples_sum_to_zero takes an array of integers as an input.
// it returns true if there are three distinct elements in the array that
// sum to zero, and false otherwise.
// triplesSumToZero(l: [1, 3, 5, 0]) == false
// triplesSumToZero(l: [1, 3, -2, 1]) == true
// triplesSumToZero(l: [1, 2, 3, 7]) == false
// triplesSumToZero(l: [2, 4, -5, 3, 9, 7]) == true
// triplesSumToZero(l: [1]) == false
func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
    return false
}
```
 // XCTAssertTrue failed

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
    return false
}
```swift
// triples_sum_to_zero takes an array of integers as an input.
// it returns true if there are three distinct elements in the array that
// sum to zero, and false otherwise.
// triplesSumToZero(l: [1, 3, 5, 0]) == false
// triplesSumToZero(l: [1, 3, -2, 1]) == true
// triplesSumToZero(l: [1, 2, 3, 7]) == false
// triplesSumToZero(l: [2, 4, -5, 3, 9, 7]) == true
// triplesSumToZero(l: [1]) == false
func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
    return false
}
```
 // XCTAssertTrue failed

func triplesSumToZero(l: [Int]) -> Bool {
    var set = Set<Int>()
    for i in l {
        set.insert(i)
    }
    for i in set {
        for j in set {
            if i + j == 0 {
                return true
            }
        }
    }
    return false
}
```swift
// triples_sum_to_zero takes an array of integers as an input.
// it returns true if there are three distinct elements in the array that
// sum to zero, and false otherwise.
// triplesSumToZero(l: [1, 3, 5, 0]) == false
// triplesSumToZero(l: [1, 3, -2, 1]) == true
// triplesSumToZero(l: [1, 2, 3, 7]) == false
// triplesSumToZero(l: [2, 4, -5, 3, 9, 7]) == true
// triplesSumToZero(l: [1]) == false
func triplesSumToZero(l: [Int]) -> Bool {
    var set = Set<Int>()
    for i in l {
        set.insert(i)
    }
    for i in set {
        for j in set {
            if i + j == 0 {
                return true
            }
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Write your code here
    return false
}
```swift
// triples_sum_to_zero takes an array of integers as an input.
// it returns true if there are three distinct elements in the array that
// sum to zero, and false otherwise.
// triplesSumToZero(l: [1, 3, 5, 0]) == false
// triplesSumToZero(l: [1, 3, -2, 1]) == true
// triplesSumToZero(l: [1, 2, 3, 7]) == false
// triplesSumToZero(l: [2, 4, -5, 3, 9, 7]) == true
// triplesSumToZero(l: [1]) == false
func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: Write your code here
    return false
}
```
 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    let left = Array(0..<n).reversed()
    let right = Array(0..<n)
    var leftIndex = 0
    var rightIndex = 0
    var count = 0
    while leftIndex < n && rightIndex < n {
        if left[leftIndex] == right[rightIndex] {
            count += 1
            leftIndex += 1
            rightIndex += 1
        } else if left[leftIndex] < right[rightIndex] {
            leftIndex += 1
        } else {
            rightIndex += 1
        }
    }
    return count
}
```swift
// Imagine a road that's a perfectly straight infinitely long line.
// n cars are driving left to right;  simultaneously, a different set of n cars
// are driving right to left.   The two sets of cars start out being very far from
// each other.  All cars move in the same speed.  Two cars are said to collide
// when a car that's moving left to right hits a car that's moving right to left.
// However, the cars are infinitely sturdy and strong; as a result, they continue moving
// in their trajectory as if they did not collide.
// This function outputs the number of such collisions.
func carRaceCollision(n: Int) -> Int {
    let left = Array(0..<n).reversed()
    let right = Array(0..<n)
    var leftIndex = 0
    var rightIndex = 0
    var count = 0
    while leftIndex < n && rightIndex < n {
        if left[leftIndex] == right[rightIndex] {
            count += 1
            leftIndex += 1
            rightIndex += 1
        } else if left[leftIndex] < right[rightIndex] {
            leftIndex += 1
        } else {
            rightIndex += 1
        }
    }
    return count
}
```
if left[leftIndex] == right[rightIndex] { // cannot convert value of type 'Int' to expected argument type 'ReversedCollection<[Int]>.Index'
} else if left[leftIndex] < right[rightIndex] { // cannot convert value of type 'Int' to expected argument type 'ReversedCollection<[Int]>.Index'

func carRaceCollision(n: Int) -> Int {
    // Your code here
}
```swift
// Imagine a road that's a perfectly straight infinitely long line.
// n cars are driving left to right;  simultaneously, a different set of n cars
// are driving right to left.   The two sets of cars start out being very far from
// each other.  All cars move in the same speed.  Two cars are said to collide
// when a car that's moving left to right hits a car that's moving right to left.
// However, the cars are infinitely sturdy and strong; as a result, they continue moving
// in their trajectory as if they did not collide.
// This function outputs the number of such collisions.
func carRaceCollision(n: Int) -> Int {
    // Your code here
}
```
} // missing return in global function expected to return 'Int'

func carRaceCollision(n: Int) -> Int {
    return n * (n - 1) / 2
}
```swift
// Imagine a road that's a perfectly straight infinitely long line.
// n cars are driving left to right;  simultaneously, a different set of n cars
// are driving right to left.   The two sets of cars start out being very far from
// each other.  All cars move in the same speed.  Two cars are said to collide
// when a car that's moving left to right hits a car that's moving right to left.
// However, the cars are infinitely sturdy and strong; as a result, they continue moving
// in their trajectory as if they did not collide.
// This function outputs the number of such collisions.
func carRaceCollision(n: Int) -> Int {
    return n * (n - 1) / 2
}
```
 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    return n * (n - 1) / 2
}
```swift
// Imagine a road that's a perfectly straight infinitely long line.
// n cars are driving left to right;  simultaneously, a different set of n cars
// are driving right to left.   The two sets of cars start out being very far from
// each other.  All cars move in the same speed.  Two cars are said to collide
// when a car that's moving left to right hits a car that's moving right to left.
// However, the cars are infinitely sturdy and strong; as a result, they continue moving
// in their trajectory as if they did not collide.
// This function outputs the number of such collisions.
func carRaceCollision(n: Int) -> Int {
    return n * (n - 1) / 2
}

carRaceCollision(n: 10)
```
 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    return n * (n - 1) / 2
}
```swift
// Imagine a road that's a perfectly straight infinitely long line.
// n cars are driving left to right;  simultaneously, a different set of n cars
// are driving right to left.   The two sets of cars start out being very far from
// each other.  All cars move in the same speed.  Two cars are said to collide
// when a car that's moving left to right hits a car that's moving right to left.
// However, the cars are infinitely sturdy and strong; as a result, they continue moving
// in their trajectory as if they did not collide.
// This function outputs the number of such collisions.
func carRaceCollision(n: Int) -> Int {
    return n * (n - 1) / 2
}
```
 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    return 0
}
```swift
// Imagine a road that's a perfectly straight infinitely long line.
// n cars are driving left to right;  simultaneously, a different set of n cars
// are driving right to left.   The two sets of cars start out being very far from
// each other.  All cars move in the same speed.  Two cars are said to collide
// when a car that's moving left to right hits a car that's moving right to left.
// However, the cars are infinitely sturdy and strong; as a result, they continue moving
// in their trajectory as if they did not collide.
// This function outputs the number of such collisions.
func carRaceCollision(n: Int) -> Int {
    return 0
}

carRaceCollision(n: 1) // 0
carRaceCollision(n: 2) // 1
carRaceCollision(n: 3) // 1
carRaceCollision(n: 4) // 2
carRaceCollision(n: 5) // 2
carRaceCollision(n: 6) // 3
carRaceCollision(n: 7) // 3
carRaceCollision(n: 8) // 4
carRaceCollision(n: 9) // 4
carRaceCollision(n: 10) // 5
```
 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    return n * (n - 1) / 2
}
```swift
// Imagine a road that's a perfectly straight infinitely long line.
// n cars are driving left to right;  simultaneously, a different set of n cars
// are driving right to left.   The two sets of cars start out being very far from
// each other.  All cars move in the same speed.  Two cars are said to collide
// when a car that's moving left to right hits a car that's moving right to left.
// However, the cars are infinitely sturdy and strong; as a result, they continue moving
// in their trajectory as if they did not collide.
// This function outputs the number of such collisions.
func carRaceCollision(n: Int) -> Int {
    return n * (n - 1) / 2
}
```
 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    return 0
}
```swift
// Imagine a road that's a perfectly straight infinitely long line.
// n cars are driving left to right;  simultaneously, a different set of n cars
// are driving right to left.   The two sets of cars start out being very far from
// each other.  All cars move in the same speed.  Two cars are said to collide
// when a car that's moving left to right hits a car that's moving right to left.
// However, the cars are infinitely sturdy and strong; as a result, they continue moving
// in their trajectory as if they did not collide.
// This function outputs the number of such collisions.
func carRaceCollision(n: Int) -> Int {
    return 0
}

carRaceCollision(n: 2)
// 1
carRaceCollision(n: 3)
// 1
carRaceCollision(n: 4)
// 2
carRaceCollision(n: 5)
// 3
```
 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    return n * (n - 1) / 2
}
```swift
// Imagine a road that's a perfectly straight infinitely long line.
// n cars are driving left to right;  simultaneously, a different set of n cars
// are driving right to left.   The two sets of cars start out being very far from
// each other.  All cars move in the same speed.  Two cars are said to collide
// when a car that's moving left to right hits a car that's moving right to left.
// However, the cars are infinitely sturdy and strong; as a result, they continue moving
// in their trajectory as if they did not collide.
// This function outputs the number of such collisions.
func carRaceCollision(n: Int) -> Int {
    return n * (n - 1) / 2
}
```
 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    return n * (n - 1) / 2
}
```swift
// Imagine a road that's a perfectly straight infinitely long line.
// n cars are driving left to right;  simultaneously, a different set of n cars
// are driving right to left.   The two sets of cars start out being very far from
// each other.  All cars move in the same speed.  Two cars are said to collide
// when a car that's moving left to right hits a car that's moving right to left.
// However, the cars are infinitely sturdy and strong; as a result, they continue moving
// in their trajectory as if they did not collide.
// This function outputs the number of such collisions.
func carRaceCollision(n: Int) -> Int {
    return n * (n - 1) / 2
}

carRaceCollision(n: 5) // 10
carRaceCollision(n: 10) // 45
```
 // XCTAssertTrue failed

func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```swift
// Return array with elements incremented by 1.
// incrList(l: [1, 2, 3]) == [2, 3, 4]
// incrList(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [6, 4, 6, 3, 4, 4, 10, 1, 124]
func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```

func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```swift
// Return array with elements incremented by 1.
// incrList(l: [1, 2, 3]) == [2, 3, 4]
// incrList(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [6, 4, 6, 3, 4, 4, 10, 1, 124]
func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```

func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```swift
// Return array with elements incremented by 1.
// incrList(l: [1, 2, 3]) == [2, 3, 4]
// incrList(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [6, 4, 6, 3, 4, 4, 10, 1, 124]
func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```

func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```swift
// Return array with elements incremented by 1.
// incrList(l: [1, 2, 3]) == [2, 3, 4]
// incrList(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [6, 4, 6, 3, 4, 4, 10, 1, 124]
func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```

func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<l.count {
        result.append(l[i] + 1)
    }
    return result
}
```swift
// Return array with elements incremented by 1.
// incrList(l: [1, 2, 3]) == [2, 3, 4]
// incrList(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [6, 4, 6, 3, 4, 4, 10, 1, 124]
func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<l.count {
        result.append(l[i] + 1)
    }
    return result
}
```

func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```swift
// Return array with elements incremented by 1.
// incrList(l: [1, 2, 3]) == [2, 3, 4]
// incrList(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [6, 4, 6, 3, 4, 4, 10, 1, 124]
func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```

func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```swift
// Return array with elements incremented by 1.
// incrList(l: [1, 2, 3]) == [2, 3, 4]
// incrList(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [6, 4, 6, 3, 4, 4, 10, 1, 124]
func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```

func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```swift
// Return array with elements incremented by 1.
// incrList(l: [1, 2, 3]) == [2, 3, 4]
// incrList(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [6, 4, 6, 3, 4, 4, 10, 1, 124]
func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```

func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```swift
// Return array with elements incremented by 1.
// incrList(l: [1, 2, 3]) == [2, 3, 4]
// incrList(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [6, 4, 6, 3, 4, 4, 10, 1, 124]
func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```

func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```swift
// Return array with elements incremented by 1.
// incrList(l: [1, 2, 3]) == [2, 3, 4]
// incrList(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [6, 4, 6, 3, 4, 4, 10, 1, 124]
func incrList(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        result.append(i + 1)
    }
    return result
}
```

func pairsSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
}
```swift
// pairs_sum_to_zero takes an array of integers as an input.
// it returns true if there are two distinct elements in the array that
// sum to zero, and false otherwise.
// pairsSumToZero(l: [1, 3, 5, 0]) == false
// pairsSumToZero(l: [1, 3, -2, 1]) == false
// pairsSumToZero(l: [1, 2, 3, 7]) == false
// pairsSumToZero(l: [2, 4, -5, 3, 5, 7]) == true
// pairsSumToZero(l: [1]) == false
func pairsSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func pairsSumToZero(l: [Int]) -> Bool {
    var set = Set<Int>()
    for i in l {
        if set.contains(0 - i) {
            return true
        }
        set.insert(i)
    }
    return false
}
```swift
// pairs_sum_to_zero takes an array of integers as an input.
// it returns true if there are two distinct elements in the array that
// sum to zero, and false otherwise.
// pairsSumToZero(l: [1, 3, 5, 0]) == false
// pairsSumToZero(l: [1, 3, -2, 1]) == false
// pairsSumToZero(l: [1, 2, 3, 7]) == false
// pairsSumToZero(l: [2, 4, -5, 3, 5, 7]) == true
// pairsSumToZero(l: [1]) == false
func pairsSumToZero(l: [Int]) -> Bool {
    var set = Set<Int>()
    for i in l {
        if set.contains(0 - i) {
            return true
        }
        set.insert(i)
    }
    return false
}
```

func pairsSumToZero(l: [Int]) -> Bool {
    var seen: Set<Int> = []
    for n in l {
        if seen.contains(-n) {
            return true
        }
        seen.insert(n)
    }
    return false
}
```swift
// pairs_sum_to_zero takes an array of integers as an input.
// it returns true if there are two distinct elements in the array that
// sum to zero, and false otherwise.
// pairsSumToZero(l: [1, 3, 5, 0]) == false
// pairsSumToZero(l: [1, 3, -2, 1]) == false
// pairsSumToZero(l: [1, 2, 3, 7]) == false
// pairsSumToZero(l: [2, 4, -5, 3, 5, 7]) == true
// pairsSumToZero(l: [1]) == false
func pairsSumToZero(l: [Int]) -> Bool {
    var seen: Set<Int> = []
    for n in l {
        if seen.contains(-n) {
            return true
        }
        seen.insert(n)
    }
    return false
}
```

func pairsSumToZero(l: [Int]) -> Bool {
    var seen: Set<Int> = []
    for n in l {
        if seen.contains(-n) {
            return true
        }
        seen.insert(n)
    }
    return false
}
```swift
// pairs_sum_to_zero takes an array of integers as an input.
// it returns true if there are two distinct elements in the array that
// sum to zero, and false otherwise.
// pairsSumToZero(l: [1, 3, 5, 0]) == false
// pairsSumToZero(l: [1, 3, -2, 1]) == false
// pairsSumToZero(l: [1, 2, 3, 7]) == false
// pairsSumToZero(l: [2, 4, -5, 3, 5, 7]) == true
// pairsSumToZero(l: [1]) == false
func pairsSumToZero(l: [Int]) -> Bool {
    var seen: Set<Int> = []
    for n in l {
        if seen.contains(-n) {
            return true
        }
        seen.insert(n)
    }
    return false
}
```

func pairsSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
    return false
}
```swift
// pairs_sum_to_zero takes an array of integers as an input.
// it returns true if there are two distinct elements in the array that
// sum to zero, and false otherwise.
// pairsSumToZero(l: [1, 3, 5, 0]) == false
// pairsSumToZero(l: [1, 3, -2, 1]) == false
// pairsSumToZero(l: [1, 2, 3, 7]) == false
// pairsSumToZero(l: [2, 4, -5, 3, 5, 7]) == true
// pairsSumToZero(l: [1]) == false
func pairsSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
    return false
}
```
 // XCTAssertTrue failed

func pairsSumToZero(l: [Int]) -> Bool {
    var seen = Set<Int>()
    for i in l {
        if seen.contains(-i) {
            return true
        }
        seen.insert(i)
    }
    return false
}
```swift
// pairs_sum_to_zero takes an array of integers as an input.
// it returns true if there are two distinct elements in the array that
// sum to zero, and false otherwise.
// pairsSumToZero(l: [1, 3, 5, 0]) == false
// pairsSumToZero(l: [1, 3, -2, 1]) == false
// pairsSumToZero(l: [1, 2, 3, 7]) == false
// pairsSumToZero(l: [2, 4, -5, 3, 5, 7]) == true
// pairsSumToZero(l: [1]) == false
func pairsSumToZero(l: [Int]) -> Bool {
    var seen = Set<Int>()
    for i in l {
        if seen.contains(-i) {
            return true
        }
        seen.insert(i)
    }
    return false
}
```

func pairsSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
    return false
}
```swift
// pairs_sum_to_zero takes an array of integers as an input.
// it returns true if there are two distinct elements in the array that
// sum to zero, and false otherwise.
// pairsSumToZero(l: [1, 3, 5, 0]) == false
// pairsSumToZero(l: [1, 3, -2, 1]) == false
// pairsSumToZero(l: [1, 2, 3, 7]) == false
// pairsSumToZero(l: [2, 4, -5, 3, 5, 7]) == true
// pairsSumToZero(l: [1]) == false
func pairsSumToZero(l: [Int]) -> Bool {
    // TODO: Implement this function
    return false
}
```
 // XCTAssertTrue failed

func pairsSumToZero(l: [Int]) -> Bool {
    var seen: Set<Int> = []
    for i in l {
        if seen.contains(0 - i) {
            return true
        }
        seen.insert(i)
    }
    return false
}
```swift
// pairs_sum_to_zero takes an array of integers as an input.
// it returns true if there are two distinct elements in the array that
// sum to zero, and false otherwise.
// pairsSumToZero(l: [1, 3, 5, 0]) == false
// pairsSumToZero(l: [1, 3, -2, 1]) == false
// pairsSumToZero(l: [1, 2, 3, 7]) == false
// pairsSumToZero(l: [2, 4, -5, 3, 5, 7]) == true
// pairsSumToZero(l: [1]) == false
func pairsSumToZero(l: [Int]) -> Bool {
    var seen: Set<Int> = []
    for i in l {
        if seen.contains(0 - i) {
            return true
        }
        seen.insert(i)
    }
    return false
}
```

func pairsSumToZero(l: [Int]) -> Bool {
    var seen: Set<Int> = []
    for i in l {
        if seen.contains(0 - i) {
            return true
        }
        seen.insert(i)
    }
    return false
}
```swift
// pairs_sum_to_zero takes an array of integers as an input.
// it returns true if there are two distinct elements in the array that
// sum to zero, and false otherwise.
// pairsSumToZero(l: [1, 3, 5, 0]) == false
// pairsSumToZero(l: [1, 3, -2, 1]) == false
// pairsSumToZero(l: [1, 2, 3, 7]) == false
// pairsSumToZero(l: [2, 4, -5, 3, 5, 7]) == true
// pairsSumToZero(l: [1]) == false
func pairsSumToZero(l: [Int]) -> Bool {
    var seen: Set<Int> = []
    for i in l {
        if seen.contains(0 - i) {
            return true
        }
        seen.insert(i)
    }
    return false
}
```

func pairsSumToZero(l: [Int]) -> Bool {
    var set = Set<Int>()
    for i in l {
        if set.contains(-i) {
            return true
        }
        set.insert(i)
    }
    return false
}
```swift
// pairs_sum_to_zero takes an array of integers as an input.
// it returns true if there are two distinct elements in the array that
// sum to zero, and false otherwise.
// pairsSumToZero(l: [1, 3, 5, 0]) == false
// pairsSumToZero(l: [1, 3, -2, 1]) == false
// pairsSumToZero(l: [1, 2, 3, 7]) == false
// pairsSumToZero(l: [2, 4, -5, 3, 5, 7]) == true
// pairsSumToZero(l: [1]) == false
func pairsSumToZero(l: [Int]) -> Bool {
    var set = Set<Int>()
    for i in l {
        if set.contains(-i) {
            return true
        }
        set.insert(i)
    }
    return false
}
```

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var remainder = x
    while remainder > 0 {
        result = String(remainder % base) + result
        remainder /= base
    }
    return result
}
```swift
// Change numerical base of input number x to base.
// return string representation after the conversion.
// base numbers are less than 10.
// changeBase(x: 8, base: 3) == "22"
// changeBase(x: 8, base: 2) == "1000"
// changeBase(x: 7, base: 2) == "111"
func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var remainder = x
    while remainder > 0 {
        result = String(remainder % base) + result
        remainder /= base
    }
    return result
}
```

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var x = x
    while x > 0 {
        result = String(x % base) + result
        x /= base
    }
    return result
}
```swift
// Change numerical base of input number x to base.
// return string representation after the conversion.
// base numbers are less than 10.
// changeBase(x: 8, base: 3) == "22"
// changeBase(x: 8, base: 2) == "1000"
// changeBase(x: 7, base: 2) == "111"
func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var x = x
    while x > 0 {
        result = String(x % base) + result
        x /= base
    }
    return result
}
```

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var number = x
    while number > 0 {
        let remainder = number % base
        result = "\(remainder)" + result
        number = number / base
    }
    return result
}
```swift
// Change numerical base of input number x to base.
// return string representation after the conversion.
// base numbers are less than 10.
// changeBase(x: 8, base: 3) == "22"
// changeBase(x: 8, base: 2) == "1000"
// changeBase(x: 7, base: 2) == "111"
func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var number = x
    while number > 0 {
        let remainder = number % base
        result = "\(remainder)" + result
        number = number / base
    }
    return result
}
```

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var number = x
    while number > 0 {
        result = String(number % base) + result
        number /= base
    }
    return result
}
```swift
// Change numerical base of input number x to base.
// return string representation after the conversion.
// base numbers are less than 10.
// changeBase(x: 8, base: 3) == "22"
// changeBase(x: 8, base: 2) == "1000"
// changeBase(x: 7, base: 2) == "111"
func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var number = x
    while number > 0 {
        result = String(number % base) + result
        number /= base
    }
    return result
}
```

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var x = x
    while x > 0 {
        result = String(x % base) + result
        x /= base
    }
    return result
}
```swift
// Change numerical base of input number x to base.
// return string representation after the conversion.
// base numbers are less than 10.
// changeBase(x: 8, base: 3) == "22"
// changeBase(x: 8, base: 2) == "1000"
// changeBase(x: 7, base: 2) == "111"
func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var x = x
    while x > 0 {
        result = String(x % base) + result
        x /= base
    }
    return result
}
```

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var number = x
    while number > 0 {
        let remainder = number % base
        result = "\(remainder)" + result
        number = number / base
    }
    return result
}
```swift
// Change numerical base of input number x to base.
// return string representation after the conversion.
// base numbers are less than 10.
// changeBase(x: 8, base: 3) == "22"
// changeBase(x: 8, base: 2) == "1000"
// changeBase(x: 7, base: 2) == "111"
func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var number = x
    while number > 0 {
        let remainder = number % base
        result = "\(remainder)" + result
        number = number / base
    }
    return result
}
```

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var number = x
    while number > 0 {
        let remainder = number % base
        result = String(remainder) + result
        number /= base
    }
    return result
}
```swift
// Change numerical base of input number x to base.
// return string representation after the conversion.
// base numbers are less than 10.
// changeBase(x: 8, base: 3) == "22"
// changeBase(x: 8, base: 2) == "1000"
// changeBase(x: 7, base: 2) == "111"
func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var number = x
    while number > 0 {
        let remainder = number % base
        result = String(remainder) + result
        number /= base
    }
    return result
}
```

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var x = x
    while x > 0 {
        result = String(x % base) + result
        x /= base
    }
    return result
}
```swift
// Change numerical base of input number x to base.
// return string representation after the conversion.
// base numbers are less than 10.
// changeBase(x: 8, base: 3) == "22"
// changeBase(x: 8, base: 2) == "1000"
// changeBase(x: 7, base: 2) == "111"
func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var x = x
    while x > 0 {
        result = String(x % base) + result
        x /= base
    }
    return result
}
```

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var number = x
    while number > 0 {
        let remainder = number % base
        result = "\(remainder)" + result
        number /= base
    }
    return result
}
```swift
// Change numerical base of input number x to base.
// return string representation after the conversion.
// base numbers are less than 10.
// changeBase(x: 8, base: 3) == "22"
// changeBase(x: 8, base: 2) == "1000"
// changeBase(x: 7, base: 2) == "111"
func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var number = x
    while number > 0 {
        let remainder = number % base
        result = "\(remainder)" + result
        number /= base
    }
    return result
}
```

func changeBase(x: Int, base: Int) -> String {
    var x = x
    var result = ""
    while x > 0 {
        let remainder = x % base
        result = "\(remainder)" + result
        x /= base
    }
    return result
}
```swift
// Change numerical base of input number x to base.
// return string representation after the conversion.
// base numbers are less than 10.
// changeBase(x: 8, base: 3) == "22"
// changeBase(x: 8, base: 2) == "1000"
// changeBase(x: 7, base: 2) == "111"
func changeBase(x: Int, base: Int) -> String {
    var x = x
    var result = ""
    while x > 0 {
        let remainder = x % base
        result = "\(remainder)" + result
        x /= base
    }
    return result
}
```

func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}
```swift
// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea

func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}
```swift
// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea

func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}
```swift
// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea

func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}
```swift
// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}
```

func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}
```swift
// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea

func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}
```swift
// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea

func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}
```swift
// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea

func triangleArea(a: Int, h: Int) -> Double {
  return Double(a * h) / 2
}
```swift
// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
  return Double(a * h) / 2
}
```

func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}
```swift
// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}
```

func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}
```swift
// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea(a: 5, h: 3) == 7.5
func triangleArea(a: Int, h: Int) -> Double {
    return Double(a * h) / 2
}

// Given length of a side and high return area for a triangle.
// triangleArea

func fib4(n: Int) -> Int {
    guard n > 0 else { return 0 }
    guard n > 1 else { return 0 }
    guard n > 2 else { return 2 }
    guard n > 3 else { return 0 }
    
    var a = 0
    var b = 2
    var c = 0
    var d = 0
    
    for _ in 0..<n-4 {
        a = b + c + d
        b = a + d
        c = b + d
        d = a + c
    }
    
    return a + b + c + d
}
```swift
// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fib4(0) -> 0
// fib4(1) -> 0
// fib4(2) -> 2
// fib4(3) -> 0
// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
// Please write a function to efficiently compute the n-th element of the fib4 number sequence.  Do not use recursion.
// fib4(n: 5) == 4
// fib4(n: 6) == 8
// fib4(n: 7) == 14
func fib4(n: Int) -> Int {
    guard n > 0 else { return 0 }
    guard n > 1 else { return 0 }
    guard n > 2 else { return 2 }
    guard n > 3 else { return 0 }
    
    var a = 0
    var b = 2
    var c = 0
    var d = 0
    
    for _ in 0..<n-4 {
        a = b + c + d
        b = a + d
        c = b + d
        d = a + c
    }
    
    return a + b + c + d
}
```
 // XCTAssertTrue failed

func fib4(n: Int) -> Int {
    guard n > 0 else { return 0 }
    guard n > 1 else { return 0 }
    guard n > 2 else { return 2 }
    guard n > 3 else { return 0 }
    
    var a = 0
    var b = 2
    var c = 0
    var d = 0
    
    for _ in 4...n {
        let temp = a + b + c + d
        a = b
        b = c
        c = d
        d = temp
    }
    
    return d
}
```swift
// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fib4(0) -> 0
// fib4(1) -> 0
// fib4(2) -> 2
// fib4(3) -> 0
// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
// Please write a function to efficiently compute the n-th element of the fib4 number sequence.  Do not use recursion.
// fib4(n: 5) == 4
// fib4(n: 6) == 8
// fib4(n: 7) == 14
func fib4(n: Int) -> Int {
    guard n > 0 else { return 0 }
    guard n > 1 else { return 0 }
    guard n > 2 else { return 2 }
    guard n > 3 else { return 0 }
    
    var a = 0
    var b = 2
    var c = 0
    var d = 0
    
    for _ in 4...n {
        let temp = a + b + c + d
        a = b
        b = c
        c = d
        d = temp
    }
    
    return d
}
```
 // XCTAssertTrue failed

func fib4(n: Int) -> Int {
    guard n > 0 else { return 0 }
    guard n > 1 else { return 0 }
    guard n > 2 else { return 2 }
    guard n > 3 else { return 0 }
    
    var a = 0
    var b = 2
    var c = 0
    var d = 0
    
    for _ in 4..<n {
        a = b + c + d
        b = a + c
        c = b + d
        d = a + c
    }
    
    return a
}
```swift
// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fib4(0) -> 0
// fib4(1) -> 0
// fib4(2) -> 2
// fib4(3) -> 0
// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
// Please write a function to efficiently compute the n-th element of the fib4 number sequence.  Do not use recursion.
// fib4(n: 5) == 4
// fib4(n: 6) == 8
// fib4(n: 7) == 14
func fib4(n: Int) -> Int {
    guard n > 0 else { return 0 }
    guard n > 1 else { return 0 }
    guard n > 2 else { return 2 }
    guard n > 3 else { return 0 }
    
    var a = 0
    var b = 2
    var c = 0
    var d = 0
    
    for _ in 4..<n {
        a = b + c + d
        b = a + c
        c = b + d
        d = a + c
    }
    
    return a
}
```
 // XCTAssertTrue failed

func fib4(n: Int) -> Int {
    var fib4 = [Int](repeating: 0, count: n + 1)
    fib4[0] = 0
    fib4[1] = 0
    fib4[2] = 2
    fib4[3] = 0
    for i in 4...n {
        fib4[i] = fib4[i-1] + fib4[i-2] + fib4[i-3] + fib4[i-4]
    }
    return fib4[n]
}
```swift
// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fib4(0) -> 0
// fib4(1) -> 0
// fib4(2) -> 2
// fib4(3) -> 0
// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
// Please write a function to efficiently compute the n-th element of the fib4 number sequence.  Do not use recursion.
// fib4(n: 5) == 4
// fib4(n: 6) == 8
// fib4(n: 7) == 14
func fib4(n: Int) -> Int {
    var fib4 = [Int](repeating: 0, count: n + 1)
    fib4[0] = 0
    fib4[1] = 0
    fib4[2] = 2
    fib4[3] = 0
    for i in 4...n {
        fib4[i] = fib4[i-1] + fib4[i-2] + fib4[i-3] + fib4[i-4]
    }
    return fib4[n]
}
```

func fib4(n: Int) -> Int {
    var a = 0
    var b = 0
    var c = 2
    var d = 0
    for _ in 0..<n {
        a = b + c + d
        b = c
        c = d
        d = a
    }
    return a
}
```swift
// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fib4(0) -> 0
// fib4(1) -> 0
// fib4(2) -> 2
// fib4(3) -> 0
// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
// Please write a function to efficiently compute the n-th element of the fib4 number sequence.  Do not use recursion.
// fib4(n: 5) == 4
// fib4(n: 6) == 8
// fib4(n: 7) == 14
func fib4(n: Int) -> Int {
    var a = 0
    var b = 0
    var c = 2
    var d = 0
    for _ in 0..<n {
        a = b + c + d
        b = c
        c = d
        d = a
    }
    return a
}
```
 // XCTAssertTrue failed

func fib4(n: Int) -> Int {
    var a = 0
    var b = 0
    var c = 0
    var d = 0
    for i in 0..<n {
        let temp = a + b + c + d
        a = b
        b = c
        c = d
        d = temp
    }
    return d
}
```swift
// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fib4(0) -> 0
// fib4(1) -> 0
// fib4(2) -> 2
// fib4(3) -> 0
// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
// Please write a function to efficiently compute the n-th element of the fib4 number sequence.  Do not use recursion.
// fib4(n: 5) == 4
// fib4(n: 6) == 8
// fib4(n: 7) == 14
func fib4(n: Int) -> Int {
    var a = 0
    var b = 0
    var c = 0
    var d = 0
    for i in 0..<n {
        let temp = a + b + c + d
        a = b
        b = c
        c = d
        d = temp
    }
    return d
}
```
for i in 0..<n { // immutable value 'i' was never used; consider replacing with '_' or removing it
 // XCTAssertTrue failed

func fib4(n: Int) -> Int {
    var a = 0
    var b = 0
    var c = 2
    var d = 0
    for _ in 0..<n {
        a = b + c + d
        b = c
        c = d
        d = a
    }
    return a
}
```swift
// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fib4(0) -> 0
// fib4(1) -> 0
// fib4(2) -> 2
// fib4(3) -> 0
// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
// Please write a function to efficiently compute the n-th element of the fib4 number sequence.  Do not use recursion.
// fib4(n: 5) == 4
// fib4(n: 6) == 8
// fib4(n: 7) == 14
func fib4(n: Int) -> Int {
    var a = 0
    var b = 0
    var c = 2
    var d = 0
    for _ in 0..<n {
        a = b + c + d
        b = c
        c = d
        d = a
    }
    return a
}
```
 // XCTAssertTrue failed

func fib4(n: Int) -> Int {
    var a = 0
    var b = 2
    var c = 0
    var d = 0
    for _ in 0..<n {
        a = b + c + d
        b = a + d
        c = b + d
        d = a + c
    }
    return a
}
```swift
// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fib4(0) -> 0
// fib4(1) -> 0
// fib4(2) -> 2
// fib4(3) -> 0
// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
// Please write a function to efficiently compute the n-th element of the fib4 number sequence.  Do not use recursion.
// fib4(n: 5) == 4
// fib4(n: 6) == 8
// fib4(n: 7) == 14
func fib4(n: Int) -> Int {
    var a = 0
    var b = 2
    var c = 0
    var d = 0
    for _ in 0..<n {
        a = b + c + d
        b = a + d
        c = b + d
        d = a + c
    }
    return a
}
```
 // XCTAssertTrue failed

func fib4(n: Int) -> Int {
    var result = 0
    var a = 0
    var b = 0
    var c = 0
    var d = 0
    for i in 0..<n {
        result = a + b + c + d
        a = b
        b = c
        c = d
        d = result
    }
    return result
}
```swift
// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fib4(0) -> 0
// fib4(1) -> 0
// fib4(2) -> 2
// fib4(3) -> 0
// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
// Please write a function to efficiently compute the n-th element of the fib4 number sequence.  Do not use recursion.
// fib4(n: 5) == 4
// fib4(n: 6) == 8
// fib4(n: 7) == 14
func fib4(n: Int) -> Int {
    var result = 0
    var a = 0
    var b = 0
    var c = 0
    var d = 0
    for i in 0..<n {
        result = a + b + c + d
        a = b
        b = c
        c = d
        d = result
    }
    return result
}
```
for i in 0..<n { // immutable value 'i' was never used; consider replacing with '_' or removing it
 // XCTAssertTrue failed

func fib4(n: Int) -> Int {
    guard n > 0 else { return 0 }
    guard n > 1 else { return 2 }
    guard n > 2 else { return 0 }
    guard n > 3 else { return 0 }
    
    var fib4 = [Int]()
    fib4.append(0)
    fib4.append(0)
    fib4.append(2)
    fib4.append(0)
    
    for i in 4...n {
        fib4.append(fib4[i-1] + fib4[i-2] + fib4[i-3] + fib4[i-4])
    }
    
    return fib4[n]
}
```swift
// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fib4(0) -> 0
// fib4(1) -> 0
// fib4(2) -> 2
// fib4(3) -> 0
// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
// Please write a function to efficiently compute the n-th element of the fib4 number sequence.  Do not use recursion.
// fib4(n: 5) == 4
// fib4(n: 6) == 8
// fib4(n: 7) == 14
func fib4(n: Int) -> Int {
    guard n > 0 else { return 0 }
    guard n > 1 else { return 2 }
    guard n > 2 else { return 0 }
    guard n > 3 else { return 0 }
    
    var fib4 = [Int]()
    fib4.append(0)
    fib4.append(0)
    fib4.append(2)
    fib4.append(0)
    
    for i in 4...n {
        fib4.append(fib4[i-1] + fib4[i-2] + fib4[i-3] + fib4[i-4])
    }
    
    return fib4[n]
}
```

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    } else {
        return Double(sorted[middle])
    }
}
```swift
// Return median of elements in the array l.
// median(l: [3, 1, 2, 4, 5]) == 3
// median(l: [-10, 4, 6, 1000, 10, 20]) == 15.0
func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    } else {
        return Double(sorted[middle])
    }
}
```

func median(l: [Int]) -> Double {
    let n = l.count
    if n == 0 {
        return 0.0
    }
    let sorted = l.sorted()
    if n % 2 == 0 {
        return Double(sorted[n / 2 - 1] + sorted[n / 2]) / 2
    } else {
        return Double(sorted[n / 2])
    }
}
```swift
// Return median of elements in the array l.
// median(l: [3, 1, 2, 4, 5]) == 3
// median(l: [-10, 4, 6, 1000, 10, 20]) == 15.0
func median(l: [Int]) -> Double {
    let n = l.count
    if n == 0 {
        return 0.0
    }
    let sorted = l.sorted()
    if n % 2 == 0 {
        return Double(sorted[n / 2 - 1] + sorted[n / 2]) / 2
    } else {
        return Double(sorted[n / 2])
    }
}
```

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    } else {
        return Double(sorted[middle])
    }
}
```swift
// Return median of elements in the array l.
// median(l: [3, 1, 2, 4, 5]) == 3
// median(l: [-10, 4, 6, 1000, 10, 20]) == 15.0
func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    } else {
        return Double(sorted[middle])
    }
}
```

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    } else {
        return Double(sorted[middle])
    }
}
```swift
// Return median of elements in the array l.
// median(l: [3, 1, 2, 4, 5]) == 3
// median(l: [-10, 4, 6, 1000, 10, 20]) == 15.0
func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    } else {
        return Double(sorted[middle])
    }
}
```

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 1 {
        return Double(sorted[middle])
    } else {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    }
}
```swift
// Return median of elements in the array l.
// median(l: [3, 1, 2, 4, 5]) == 3
// median(l: [-10, 4, 6, 1000, 10, 20]) == 15.0
func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 1 {
        return Double(sorted[middle])
    } else {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    }
}
```

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2.0
    } else {
        return Double(sorted[middle])
    }
}
```swift
// Return median of elements in the array l.
// median(l: [3, 1, 2, 4, 5]) == 3
// median(l: [-10, 4, 6, 1000, 10, 20]) == 15.0
func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2.0
    } else {
        return Double(sorted[middle])
    }
}
```

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2.0
    } else {
        return Double(sorted[middle])
    }
}
```swift
// Return median of elements in the array l.
// median(l: [3, 1, 2, 4, 5]) == 3
// median(l: [-10, 4, 6, 1000, 10, 20]) == 15.0
func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2.0
    } else {
        return Double(sorted[middle])
    }
}
```

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    } else {
        return Double(sorted[middle])
    }
}
```swift
// Return median of elements in the array l.
// median(l: [3, 1, 2, 4, 5]) == 3
// median(l: [-10, 4, 6, 1000, 10, 20]) == 15.0
func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    } else {
        return Double(sorted[middle])
    }
}
```

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 1 {
        return Double(sorted[middle])
    } else {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    }
}
```swift
// Return median of elements in the array l.
// median(l: [3, 1, 2, 4, 5]) == 3
// median(l: [-10, 4, 6, 1000, 10, 20]) == 15.0
func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 1 {
        return Double(sorted[middle])
    } else {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    }
}
```

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    } else {
        return Double(sorted[middle])
    }
}
```swift
// Return median of elements in the array l.
// median(l: [3, 1, 2, 4, 5]) == 3
// median(l: [-10, 4, 6, 1000, 10, 20]) == 15.0
func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let middle = sorted.count / 2
    if sorted.count % 2 == 0 {
        return Double(sorted[middle - 1] + sorted[middle]) / 2
    } else {
        return Double(sorted[middle])
    }
}
```

func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    guard text.count > 1 else { return true }
    let lowercasedText = text.lowercased()
    var reversedText = ""
    for character in lowercasedText.reversed() {
        reversedText.append(character)
    }
    return lowercasedText == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    guard text.count > 1 else { return true }
    let lowercasedText = text.lowercased()
    var reversedText = ""
    for character in lowercasedText.reversed() {
        reversedText.append(character)
    }
    return lowercasedText == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    guard text.count > 1 else { return true }
    let lowercasedText = text.lowercased()
    var reversedText = ""
    for character in lowercasedText.reversed() {
        reversedText.append(character)
    }
    return lowercasedText == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    guard text.count > 1 else { return true }
    let lowercasedText = text.lowercased()
    var reversedText = ""
    for character in lowercasedText.reversed() {
        reversedText.append(character)
    }
    return lowercasedText == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```

func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```swift
// Checks if given string is a palindrome
// isPalindrome(text: "") == true
// isPalindrome(text: "aba") == true
// isPalindrome(text: "aaaaa") == true
// isPalindrome(text: "zbcd") == false
func isPalindrome(text: String) -> Bool {
    let lowercasedText = text.lowercased()
    let reversedText = String(lowercasedText.reversed())
    return lowercasedText == reversedText
}
```

func modp(n: Int, p: Int) -> Int {
    var result = 1
    var power = n
    while power > 0 {
        if power % 2 == 1 {
            result = (result * p) % p
        }
        power /= 2
        p = (p * p) % p
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var result = 1
    var power = n
    while power > 0 {
        if power % 2 == 1 {
            result = (result * p) % p
        }
        power /= 2
        p = (p * p) % p
    }
    return result
}
```
p = (p * p) % p // cannot assign to value: 'p' is a 'let' constant

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n /= 2
        p = (p * p) % p
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n /= 2
        p = (p * p) % p
    }
    return result
}
```
 // Fatal error: Division by zero in remainder operation

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n /= 2
        p = (p * p) % p
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n /= 2
        p = (p * p) % p
    }
    return result
}
```
 // Fatal error: Division by zero in remainder operation

func modp(n: Int, p: Int) -> Int {
    let result = pow(2, n, p)
    return result == 0 ? p : result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    let result = pow(2, n, p)
    return result == 0 ? p : result
}
```
let result = pow(2, n, p) // extra argument in call

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n = n / 2
        p = (p * p) % p
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n = n / 2
        p = (p * p) % p
    }
    return result
}
```
 // Fatal error: Division by zero in remainder operation

func modp(n: Int, p: Int) -> Int {
    return Int(pow(Double(p), Double(n))) % p
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    return Int(pow(Double(p), Double(n))) % p
}
```
 // XCTAssertTrue failed

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n /= 2
        p = (p * p) % p
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n /= 2
        p = (p * p) % p
    }
    return result
}
```
 // Fatal error: Division by zero in remainder operation

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n /= 2
        p = (p * p) % p
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n /= 2
        p = (p * p) % p
    }
    return result
}
```
 // Fatal error: Division by zero in remainder operation

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n = n / 2
        p = (p * p) % p
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n = n / 2
        p = (p * p) % p
    }
    return result
}
```
 // Fatal error: Division by zero in remainder operation

func modp(n: Int, p: Int) -> Int {
    var result = n
    while result >= p {
        result = (result % p) + p
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var result = n
    while result >= p {
        result = (result % p) + p
    }
    return result
}
```

func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !vowels.contains(character) {
            result += String(character)
        }
    }
    return result
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !vowels.contains(character) {
            result += String(character)
        }
    }
    return result
}
```
if !vowels.contains(character) { // cannot find 'vowels' in scope

func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !isVowel(character: character) {
            result.append(character)
        }
    }
    return result
}

func isVowel(character: Character) -> Bool {
    switch character {
    case "a", "e", "i", "o", "u":
        return true
    default:
        return false
    }
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !isVowel(character: character) {
            result.append(character)
        }
    }
    return result
}

func isVowel(character: Character) -> Bool {
    switch character {
    case "a", "e", "i", "o", "u":
        return true
    default:
        return false
    }
}
```
 // XCTAssertTrue failed

func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !vowels.contains(character) {
            result += String(character)
        }
    }
    return result
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !vowels.contains(character) {
            result += String(character)
        }
    }
    return result
}

// vowels is a constant that contains all vowels.
let vowels: Set<Character> = ["a", "e", "i", "o", "u"]
```
if !vowels.contains(character) { // cannot find 'vowels' in scope

func removeVowels(text: String) -> String {
    var result = ""
    for char in text {
        if !isVowel(char: char) {
            result.append(char)
        }
    }
    return result
}

func isVowel(char: Character) -> Bool {
    switch char {
    case "a", "e", "i", "o", "u":
        return true
    default:
        return false
    }
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    var result = ""
    for char in text {
        if !isVowel(char: char) {
            result.append(char)
        }
    }
    return result
}

func isVowel(char: Character) -> Bool {
    switch char {
    case "a", "e", "i", "o", "u":
        return true
    default:
        return false
    }
}
```
 // XCTAssertTrue failed

func removeVowels(text: String) -> String {
    var result = ""
    for char in text {
        if !isVowel(char: char) {
            result.append(char)
        }
    }
    return result
}

func isVowel(char: Character) -> Bool {
    switch char {
    case "a", "e", "i", "o", "u":
        return true
    default:
        return false
    }
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    var result = ""
    for char in text {
        if !isVowel(char: char) {
            result.append(char)
        }
    }
    return result
}

func isVowel(char: Character) -> Bool {
    switch char {
    case "a", "e", "i", "o", "u":
        return true
    default:
        return false
    }
}
```
 // XCTAssertTrue failed

func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !isVowel(character) {
            result.append(character)
        }
    }
    return result
}

func isVowel(_ character: Character) -> Bool {
    let vowels = "aeiou"
    return vowels.contains(character)
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !isVowel(character) {
            result.append(character)
        }
    }
    return result
}

func isVowel(_ character: Character) -> Bool {
    let vowels = "aeiou"
    return vowels.contains(character)
}
```
 // XCTAssertTrue failed

func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !isVowel(character: character) {
            result.append(character)
        }
    }
    return result
}

func isVowel(character: Character) -> Bool {
    switch character {
    case "a", "e", "i", "o", "u":
        return true
    default:
        return false
    }
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !isVowel(character: character) {
            result.append(character)
        }
    }
    return result
}

func isVowel(character: Character) -> Bool {
    switch character {
    case "a", "e", "i", "o", "u":
        return true
    default:
        return false
    }
}
```
 // XCTAssertTrue failed

func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !isVowel(character: character) {
            result.append(character)
        }
    }
    return result
}

func isVowel(character: Character) -> Bool {
    let characterString = String(character)
    return ["a", "e", "i", "o", "u"].contains(characterString)
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !isVowel(character: character) {
            result.append(character)
        }
    }
    return result
}

func isVowel(character: Character) -> Bool {
    let characterString = String(character)
    return ["a", "e", "i", "o", "u"].contains(characterString)
}
```
 // XCTAssertTrue failed

func removeVowels(text: String) -> String {
    var result = ""
    for char in text {
        if !isVowel(char: char) {
            result.append(char)
        }
    }
    return result
}

func isVowel(char: Character) -> Bool {
    return ["a", "e", "i", "o", "u"].contains(String(char).lowercased())
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    var result = ""
    for char in text {
        if !isVowel(char: char) {
            result.append(char)
        }
    }
    return result
}

func isVowel(char: Character) -> Bool {
    return ["a", "e", "i", "o", "u"].contains(String(char).lowercased())
}
```

func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !isVowel(character) {
            result.append(character)
        }
    }
    return result
}

func isVowel(_ character: Character) -> Bool {
    switch character {
    case "a", "e", "i", "o", "u":
        return true
    default:
        return false
    }
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if !isVowel(character) {
            result.append(character)
        }
    }
    return result
}

func isVowel(_ character: Character) -> Bool {
    switch character {
    case "a", "e", "i", "o", "u":
        return true
    default:
        return false
    }
}
```
 // XCTAssertTrue failed

func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i >= t {
            return false
        }
    }
    return true
}
```swift
// Return true if all numbers in the array l are below threshold t.
// belowThreshold(l: [1, 2, 4, 10], t: 100) == true
// belowThreshold(l: [1, 20, 4, 10], t: 5) == false
func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i >= t {
            return false
        }
    }
    return true
}
```

func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i > t {
            return false
        }
    }
    return true
}
```swift
// Return true if all numbers in the array l are below threshold t.
// belowThreshold(l: [1, 2, 4, 10], t: 100) == true
// belowThreshold(l: [1, 20, 4, 10], t: 5) == false
func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i > t {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i > t {
            return false
        }
    }
    return true
}
```swift
// Return true if all numbers in the array l are below threshold t.
// belowThreshold(l: [1, 2, 4, 10], t: 100) == true
// belowThreshold(l: [1, 20, 4, 10], t: 5) == false
func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i > t {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i > t {
            return false
        }
    }
    return true
}
```swift
// Return true if all numbers in the array l are below threshold t.
// belowThreshold(l: [1, 2, 4, 10], t: 100) == true
// belowThreshold(l: [1, 20, 4, 10], t: 5) == false
func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i > t {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i > t {
            return false
        }
    }
    return true
}
```swift
// Return true if all numbers in the array l are below threshold t.
// belowThreshold(l: [1, 2, 4, 10], t: 100) == true
// belowThreshold(l: [1, 20, 4, 10], t: 5) == false
func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i > t {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func belowThreshold(l: [Int], t: Int) -> Bool {
    for n in l {
        if n >= t {
            return false
        }
    }
    return true
}
```swift
// Return true if all numbers in the array l are below threshold t.
// belowThreshold(l: [1, 2, 4, 10], t: 100) == true
// belowThreshold(l: [1, 20, 4, 10], t: 5) == false
func belowThreshold(l: [Int], t: Int) -> Bool {
    for n in l {
        if n >= t {
            return false
        }
    }
    return true
}
```

func belowThreshold(l: [Int], t: Int) -> Bool {
  for n in l {
    if n >= t {
      return false
    }
  }
  return true
}
```swift
// Return true if all numbers in the array l are below threshold t.
// belowThreshold(l: [1, 2, 4, 10], t: 100) == true
// belowThreshold(l: [1, 20, 4, 10], t: 5) == false
func belowThreshold(l: [Int], t: Int) -> Bool {
  for n in l {
    if n >= t {
      return false
    }
  }
  return true
}
```

func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i > t {
            return false
        }
    }
    return true
}
```swift
// Return true if all numbers in the array l are below threshold t.
// belowThreshold(l: [1, 2, 4, 10], t: 100) == true
// belowThreshold(l: [1, 20, 4, 10], t: 5) == false
func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i > t {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func belowThreshold(l: [Int], t: Int) -> Bool {
    return l.allSatisfy { $0 < t }
}
```swift
// Return true if all numbers in the array l are below threshold t.
// belowThreshold(l: [1, 2, 4, 10], t: 100) == true
// belowThreshold(l: [1, 20, 4, 10], t: 5) == false
func belowThreshold(l: [Int], t: Int) -> Bool {
    return l.allSatisfy { $0 < t }
}
```

func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i > t {
            return false
        }
    }
    return true
}
```swift
// Return true if all numbers in the array l are below threshold t.
// belowThreshold(l: [1, 2, 4, 10], t: 100) == true
// belowThreshold(l: [1, 20, 4, 10], t: 5) == false
func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i > t {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
//

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
//

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
//

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
//

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
//

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
//

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
//

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
//

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
//

func add(x: Int, y: Int) -> Int {
    return x + y
}
```swift
// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
// add(x: 2, y: 3) == 5
// add(x: 5, y: 7) == 12
func add(x: Int, y: Int) -> Int {
    return x + y
}

// Add two numbers x and y
//

func sameChars(s0: String, s1: String) -> Bool {
    return s0.sorted() == s1.sorted()
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    return s0.sorted() == s1.sorted()
}
```
 // XCTAssertTrue failed

func sameChars(s0: String, s1: String) -> Bool {
    return s0.sorted() == s1.sorted()
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    return s0.sorted() == s1.sorted()
}
```
 // XCTAssertTrue failed

func sameChars(s0: String, s1: String) -> Bool {
    let s0Set = Set(Array(s0))
    let s1Set = Set(Array(s1))
    return s0Set == s1Set
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    let s0Set = Set(Array(s0))
    let s1Set = Set(Array(s1))
    return s0Set == s1Set
}
```

func sameChars(s0: String, s1: String) -> Bool {
    let s0 = s0.lowercased()
    let s1 = s1.lowercased()
    var s0 = s0.characters.map { $0 }
    var s1 = s1.characters.map { $0 }
    s0.sort()
    s1.sort()
    return s0 == s1
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    let s0 = s0.lowercased()
    let s1 = s1.lowercased()
    var s0 = s0.characters.map { $0 }
    var s1 = s1.characters.map { $0 }
    s0.sort()
    s1.sort()
    return s0 == s1
}
```
var s0 = s0.characters.map { $0 } // invalid redeclaration of 's0'
var s0 = s0.characters.map { $0 } // 'characters' is unavailable: Please use String directly
var s1 = s1.characters.map { $0 } // invalid redeclaration of 's1'
var s1 = s1.characters.map { $0 } // 'characters' is unavailable: Please use String directly

func sameChars(s0: String, s1: String) -> Bool {
    return s0.sorted() == s1.sorted()
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    return s0.sorted() == s1.sorted()
}
```
 // XCTAssertTrue failed

func sameChars(s0: String, s1: String) -> Bool {
    let s0Set = Set(Array(s0))
    let s1Set = Set(Array(s1))
    return s0Set == s1Set
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    let s0Set = Set(Array(s0))
    let s1Set = Set(Array(s1))
    return s0Set == s1Set
}
```

func sameChars(s0: String, s1: String) -> Bool {
    let s0 = s0.sorted()
    let s1 = s1.sorted()
    return s0 == s1
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    let s0 = s0.sorted()
    let s1 = s1.sorted()
    return s0 == s1
}
```
 // XCTAssertTrue failed

func sameChars(s0: String, s1: String) -> Bool {
    let s0 = s0.sorted()
    let s1 = s1.sorted()
    return s0 == s1
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    let s0 = s0.sorted()
    let s1 = s1.sorted()
    return s0 == s1
}
```
 // XCTAssertTrue failed

func sameChars(s0: String, s1: String) -> Bool {
    let set0 = Set(s0)
    let set1 = Set(s1)
    return set0 == set1
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    let set0 = Set(s0)
    let set1 = Set(s1)
    return set0 == set1
}
```

func sameChars(s0: String, s1: String) -> Bool {
    var s0 = s0
    var s1 = s1
    s0.removeAll(where: { $0 == " " })
    s1.removeAll(where: { $0 == " " })
    return s0 == s1
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    var s0 = s0
    var s1 = s1
    s0.removeAll(where: { $0 == " " })
    s1.removeAll(where: { $0 == " " })
    return s0 == s1
}
```
 // XCTAssertTrue failed

func fib(n: Int) -> Int {
    if n <= 1 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    if n <= 1 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```

func fib(n: Int) -> Int {
    if n < 2 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    if n < 2 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```

func fib(n: Int) -> Int {
    if n == 0 { return 0 }
    if n == 1 { return 1 }
    return fib(n: n - 1) + fib(n: n - 2)
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    if n == 0 { return 0 }
    if n == 1 { return 1 }
    return fib(n: n - 1) + fib(n: n - 2)
}
```

func fib(n: Int) -> Int {
    if n == 0 { return 0 }
    if n == 1 { return 1 }
    return fib(n: n - 1) + fib(n: n - 2)
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    if n == 0 { return 0 }
    if n == 1 { return 1 }
    return fib(n: n - 1) + fib(n: n - 2)
}
```

func fib(n: Int) -> Int {
    if n < 2 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    if n < 2 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```

func fib(n: Int) -> Int {
    if n < 2 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    if n < 2 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```

func fib(n: Int) -> Int {
    if n == 0 {
        return 0
    }
    if n == 1 {
        return 1
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    if n == 0 {
        return 0
    }
    if n == 1 {
        return 1
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```

func fib(n: Int) -> Int {
    if n < 2 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    if n < 2 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```

func fib(n: Int) -> Int {
    if n < 2 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    if n < 2 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```

func fib(n: Int) -> Int {
    if n <= 1 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    if n <= 1 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        switch bracket {
        case "<":
            stack.append(bracket)
        case ">":
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        default:
            break
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        switch bracket {
        case "<":
            stack.append(bracket)
        case ">":
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        default:
            break
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        switch bracket {
        case "<":
            stack.append(bracket)
        case ">":
            if stack.isEmpty {
                return false
            } else if stack.removeLast() != "<" {
                return false
            }
        default:
            break
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        switch bracket {
        case "<":
            stack.append(bracket)
        case ">":
            if stack.isEmpty {
                return false
            } else if stack.removeLast() != "<" {
                return false
            }
        default:
            break
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for character in brackets {
        switch character {
        case "<":
            stack.append(character)
        case ">":
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        default:
            break
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for character in brackets {
        switch character {
        case "<":
            stack.append(character)
        case ">":
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        default:
            break
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "<" and ">".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "<") == false
// correctBracketing(brackets: "<>") == true
// correctBracketing(brackets: "<<><>>") == true
// correctBracketing(brackets: "><<>") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "<" {
            stack.append(bracket)
        } else if bracket == ">" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

func monotonic(l: [Int]) -> Bool {
    var isIncreasing = true
    var previous = l[0]
    for i in 1..<l.count {
        if l[i] > previous {
            isIncreasing = true
        } else if l[i] < previous {
            isIncreasing = false
        }
        previous = l[i]
    }
    return isIncreasing
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    var isIncreasing = true
    var previous = l[0]
    for i in 1..<l.count {
        if l[i] > previous {
            isIncreasing = true
        } else if l[i] < previous {
            isIncreasing = false
        }
        previous = l[i]
    }
    return isIncreasing
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var last = l[0]
    for i in 1..<l.count {
        if l[i] > last {
            return false
        }
        last = l[i]
    }
    return true
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var last = l[0]
    for i in 1..<l.count {
        if l[i] > last {
            return false
        }
        last = l[i]
    }
    return true
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var isIncreasing = true
    var previous = l[0]
    for i in 1..<l.count {
        let current = l[i]
        if isIncreasing {
            if current < previous {
                isIncreasing = false
            }
        } else {
            if current > previous {
                isIncreasing = true
            }
        }
        previous = current
    }
    return isIncreasing
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var isIncreasing = true
    var previous = l[0]
    for i in 1..<l.count {
        let current = l[i]
        if isIncreasing {
            if current < previous {
                isIncreasing = false
            }
        } else {
            if current > previous {
                isIncreasing = true
            }
        }
        previous = current
    }
    return isIncreasing
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var isIncreasing = true
    var previous = l[0]
    for i in 1..<l.count {
        let current = l[i]
        if isIncreasing {
            if current < previous {
                return false
            }
        } else {
            if current > previous {
                return false
            }
        }
        previous = current
    }
    return true
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var isIncreasing = true
    var previous = l[0]
    for i in 1..<l.count {
        let current = l[i]
        if isIncreasing {
            if current < previous {
                return false
            }
        } else {
            if current > previous {
                return false
            }
        }
        previous = current
    }
    return true
}
```
var isIncreasing = true // variable 'isIncreasing' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var isIncreasing = true
    var last = l[0]
    for i in 1..<l.count {
        if l[i] > last {
            isIncreasing = true
        } else if l[i] < last {
            isIncreasing = false
        }
        last = l[i]
    }
    return isIncreasing
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var isIncreasing = true
    var last = l[0]
    for i in 1..<l.count {
        if l[i] > last {
            isIncreasing = true
        } else if l[i] < last {
            isIncreasing = false
        }
        last = l[i]
    }
    return isIncreasing
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var prev = l[0]
    for i in 1..<l.count {
        if l[i] > prev {
            prev = l[i]
        } else {
            return false
        }
    }
    return true
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var prev = l[0]
    for i in 1..<l.count {
        if l[i] > prev {
            prev = l[i]
        } else {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var prev = l[0]
    for i in 1..<l.count {
        if l[i] > prev {
            prev = l[i]
        } else {
            return false
        }
    }
    return true
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var prev = l[0]
    for i in 1..<l.count {
        if l[i] > prev {
            prev = l[i]
        } else {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var isIncreasing = true
    var previous = l[0]
    for i in 1..<l.count {
        let current = l[i]
        if isIncreasing {
            if current < previous {
                isIncreasing = false
            }
        } else {
            if current > previous {
                isIncreasing = true
            }
        }
        previous = current
    }
    return isIncreasing
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var isIncreasing = true
    var previous = l[0]
    for i in 1..<l.count {
        let current = l[i]
        if isIncreasing {
            if current < previous {
                isIncreasing = false
            }
        } else {
            if current > previous {
                isIncreasing = true
            }
        }
        previous = current
    }
    return isIncreasing
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var isIncreasing = true
    var last = l[0]
    for i in 1..<l.count {
        let current = l[i]
        if isIncreasing {
            if current < last {
                isIncreasing = false
            }
        } else {
            if current > last {
                isIncreasing = true
            }
        }
        last = current
    }
    return isIncreasing
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var isIncreasing = true
    var last = l[0]
    for i in 1..<l.count {
        let current = l[i]
        if isIncreasing {
            if current < last {
                isIncreasing = false
            }
        } else {
            if current > last {
                isIncreasing = true
            }
        }
        last = current
    }
    return isIncreasing
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    var isIncreasing = true
    var previous = l[0]
    for i in 1..<l.count {
        let current = l[i]
        if isIncreasing {
            if current < previous {
                isIncreasing = false
            }
        } else {
            if current > previous {
                isIncreasing = true
            }
        }
        previous = current
    }
    return isIncreasing
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    var isIncreasing = true
    var previous = l[0]
    for i in 1..<l.count {
        let current = l[i]
        if isIncreasing {
            if current < previous {
                isIncreasing = false
            }
        } else {
            if current > previous {
                isIncreasing = true
            }
        }
        previous = current
    }
    return isIncreasing
}
```
 // XCTAssertTrue failed

func common(l1: [Int], l2: [Int]) -> [Int] {
    let l1Set = Set(l1)
    let l2Set = Set(l2)
    return Array(l1Set.intersection(l2Set))
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    let l1Set = Set(l1)
    let l2Set = Set(l2)
    return Array(l1Set.intersection(l2Set))
}
```
 // XCTAssertTrue failed

func common(l1: [Int], l2: [Int]) -> [Int] {
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    var result = [Int]()
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] == l2[j] {
            result.append(l1[i])
            i += 1
            j += 1
        } else if l1[i] < l2[j] {
            i += 1
        } else {
            j += 1
        }
    }
    return result
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    var result = [Int]()
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] == l2[j] {
            result.append(l1[i])
            i += 1
            j += 1
        } else if l1[i] < l2[j] {
            i += 1
        } else {
            j += 1
        }
    }
    return result
}
```

func common(l1: [Int], l2: [Int]) -> [Int] {
    let s1 = Set(l1)
    let s2 = Set(l2)
    let s3 = s1.intersection(s2)
    return Array(s3)
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    let s1 = Set(l1)
    let s2 = Set(l2)
    let s3 = s1.intersection(s2)
    return Array(s3)
}
```
 // XCTAssertTrue failed

func common(l1: [Int], l2: [Int]) -> [Int] {
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    var result = [Int]()
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] == l2[j] {
            result.append(l1[i])
            i += 1
            j += 1
        } else if l1[i] < l2[j] {
            i += 1
        } else {
            j += 1
        }
    }
    return result
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    var result = [Int]()
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] == l2[j] {
            result.append(l1[i])
            i += 1
            j += 1
        } else if l1[i] < l2[j] {
            i += 1
        } else {
            j += 1
        }
    }
    return result
}
```

func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    while !l1.isEmpty && !l2.isEmpty {
        if l1.first! == l2.first! {
            result.append(l1.removeFirst())
            l2.removeFirst()
        } else if l1.first! < l2.first! {
            l1.removeFirst()
        } else {
            l2.removeFirst()
        }
    }
    return result
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    while !l1.isEmpty && !l2.isEmpty {
        if l1.first! == l2.first! {
            result.append(l1.removeFirst())
            l2.removeFirst()
        } else if l1.first! < l2.first! {
            l1.removeFirst()
        } else {
            l2.removeFirst()
        }
    }
    return result
}
```

func common(l1: [Int], l2: [Int]) -> [Int] {
    let set1 = Set(l1)
    let set2 = Set(l2)
    return Array(set1.intersection(set2))
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    let set1 = Set(l1)
    let set2 = Set(l2)
    return Array(set1.intersection(set2))
}
```
 // XCTAssertTrue failed

func common(l1: [Int], l2: [Int]) -> [Int] {
    let s1 = Set(l1)
    let s2 = Set(l2)
    return Array(s1.intersection(s2))
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    let s1 = Set(l1)
    let s2 = Set(l2)
    return Array(s1.intersection(s2))
}
```
 // XCTAssertTrue failed

func common(l1: [Int], l2: [Int]) -> [Int] {
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    var i = 0
    var j = 0
    var result = [Int]()
    while i < l1.count && j < l2.count {
        if l1[i] == l2[j] {
            result.append(l1[i])
            i += 1
            j += 1
        } else if l1[i] < l2[j] {
            i += 1
        } else {
            j += 1
        }
    }
    return result
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    var i = 0
    var j = 0
    var result = [Int]()
    while i < l1.count && j < l2.count {
        if l1[i] == l2[j] {
            result.append(l1[i])
            i += 1
            j += 1
        } else if l1[i] < l2[j] {
            i += 1
        } else {
            j += 1
        }
    }
    return result
}
```

func common(l1: [Int], l2: [Int]) -> [Int] {
    let s1 = Set(l1)
    let s2 = Set(l2)
    return Array(s1.intersection(s2))
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    let s1 = Set(l1)
    let s2 = Set(l2)
    return Array(s1.intersection(s2))
}
```
 // XCTAssertTrue failed

func common(l1: [Int], l2: [Int]) -> [Int] {
    var common = Set<Int>()
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] == l2[j] {
            common.insert(l1[i])
            i += 1
            j += 1
        } else if l1[i] < l2[j] {
            i += 1
        } else {
            j += 1
        }
    }
    return Array(common)
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    var common = Set<Int>()
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] == l2[j] {
            common.insert(l1[i])
            i += 1
            j += 1
        } else if l1[i] < l2[j] {
            i += 1
        } else {
            j += 1
        }
    }
    return Array(common)
}
```
 // XCTAssertTrue failed

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var i = 2
    while i * i <= n {
        while n % i == 0 {
            n = n / i
        }
        i += 1
    }
    return n
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var i = 2
    while i * i <= n {
        while n % i == 0 {
            n = n / i
        }
        i += 1
    }
    return n
}
```
 // XCTAssertTrue failed

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 0
    for i in stride(from: 2, to: n, by: 1) {
        if n % i == 0 {
            n /= i
            largest = i
        }
    }
    return largest
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 0
    for i in stride(from: 2, to: n, by: 1) {
        if n % i == 0 {
            n /= i
            largest = i
        }
    }
    return largest
}
```
 // XCTAssertTrue failed

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var i = 2
    while i * i <= n {
        while n % i == 0 {
            n /= i
        }
        i += 1
    }
    return n
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var i = 2
    while i * i <= n {
        while n % i == 0 {
            n /= i
        }
        i += 1
    }
    return n
}
```
 // XCTAssertTrue failed

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 2
    while n % largest != 0 {
        largest += 1
    }
    while n % largest == 0 {
        n /= largest
    }
    return largest
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 2
    while n % largest != 0 {
        largest += 1
    }
    while n % largest == 0 {
        n /= largest
    }
    return largest
}
```
 // XCTAssertTrue failed

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 0
    for i in 2...n {
        if n % i == 0 {
            n /= i
            largest = i
        }
    }
    return largest
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 0
    for i in 2...n {
        if n % i == 0 {
            n /= i
            largest = i
        }
    }
    return largest
}
```
 // XCTAssertTrue failed

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 0
    for i in 2...Int(sqrt(Double(n))) {
        if n % i == 0 {
            n = n / i
            largest = i
        }
    }
    return largest
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 0
    for i in 2...Int(sqrt(Double(n))) {
        if n % i == 0 {
            n = n / i
            largest = i
        }
    }
    return largest
}
```
 // XCTAssertTrue failed

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 0
    for i in 2...n {
        while n % i == 0 {
            n /= i
            largest = i
        }
    }
    return largest
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 0
    for i in 2...n {
        while n % i == 0 {
            n /= i
            largest = i
        }
    }
    return largest
}
```

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 2
    while n % largest != 0 {
        largest += 1
    }
    while n % largest == 0 {
        n /= largest
    }
    return largest
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 2
    while n % largest != 0 {
        largest += 1
    }
    while n % largest == 0 {
        n /= largest
    }
    return largest
}
```
 // XCTAssertTrue failed

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 0
    for i in 2...Int(sqrt(Double(n))) {
        if n % i == 0 {
            n /= i
            largest = i
        }
    }
    return largest
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 0
    for i in 2...Int(sqrt(Double(n))) {
        if n % i == 0 {
            n /= i
            largest = i
        }
    }
    return largest
}
```
 // XCTAssertTrue failed

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 2
    while n % largest != 0 {
        largest += 1
    }
    return largest
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largest = 2
    while n % largest != 0 {
        largest += 1
    }
    return largest
}
```
var n = n // variable 'n' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func sumToN(n: Int) -> Int {
    guard n > 0 else { return 0 }
    return n + sumToN(n: n - 1)
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    guard n > 0 else { return 0 }
    return n + sumToN(n: n - 1)
}
```

func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```

func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```

func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```

func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```

func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```

func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```

func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}

func sumToNWithReduce(n: Int) -> Int {
    return (1...n).reduce(0, +)
}

func sumToNWithReduceClosure(n: Int) -> Int {
    return (1...n).reduce(0) { $0 + $1 }
}

func sumToNWithReduceClosureShorthand(n: Int) -> Int {
    return (1...n).reduce(0) { $0 + $1 }
}

func sumToNWithReduceClosureShorthand2(n: Int) -> Int {
    return (1...n).reduce(0) { $0 + $1 }
}

func sumToNWithReduceClosureShorthand3(n: Int) -> Int {
    return (1...n).reduce(0) { $0 + $1 }
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}

// sum_to_n_with_reduce is a function that sums numbers from 1 to n.
// sumToNWithReduce(n: 30) == 465
// sumToNWithReduce(n: 100) == 5050
// sumToNWithReduce(n: 5) == 15
// sumToNWithReduce(n: 10) == 55
// sumToNWithReduce(n: 1) == 1
func sumToNWithReduce(n: Int) -> Int {
    return (1...n).reduce(0, +)
}

// sum_to_n_with_reduce_closure is a function that sums numbers from 1 to n.
// sumToNWithReduceClosure(n: 30) == 465
// sumToNWithReduceClosure(n: 100) == 5050
// sumToNWithReduceClosure(n: 5) == 15
// sumToNWithReduceClosure(n: 10) == 55
// sumToNWithReduceClosure(n: 1) == 1
func sumToNWithReduceClosure(n: Int) -> Int {
    return (1...n).reduce(0) { $0 + $1 }
}

// sum_to_n_with_reduce_closure_shorthand is a function that sums numbers from 1 to n.
// sumToNWithReduceClosureShorthand(n: 30) == 465
// sumToNWithReduceClosureShorthand(n: 100) == 5050
// sumToNWithReduceClosureShorthand(n: 5) == 15
// sumToNWithReduceClosureShorthand(n: 10) == 55
// sumToNWithReduceClosureShorthand(n: 1) == 1
func sumToNWithReduceClosureShorthand(n: Int) -> Int {
    return (1...n).reduce(0) { $0 + $1 }
}

// sum_to_n_with_reduce_closure_shorthand_2 is a function that sums numbers from 1 to n.
// sumToNWithReduceClosureShorthand2(n: 30) == 465
// sumToNWithReduceClosureShorthand2(n: 100) == 5050
// sumToNWithReduceClosureShorthand2(n: 5) == 15
// sumToNWithReduceClosureShorthand2(n: 10) == 55
// sumToNWithReduceClosureShorthand2(n: 1) == 1
func sumToNWithReduceClosureShorthand2(n: Int) -> Int {
    return (1...n).reduce(0) { $0 + $1 }
}

// sum_to_n_with_reduce_closure_shorthand_3 is a function that sums numbers from 1 to n.
// sumToNWithReduceClosureShorthand3(n: 30) == 465
// sumToNWithReduceClosureShorthand3(n: 100) == 5050
// sumToNWithReduceClosureShorthand3(n: 5) == 15
// sumToNWithReduceClosureShorthand3(n: 10) == 55
// sumToNWithReduceClosureShorthand3(n: 1) == 1
func sumToNWithReduceClosureShorthand3(n: Int) -> Int {
    return (1...n).reduce(0) { $0 + $1 }
}

//

func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```

func sumToN(n: Int) -> Int {
    return (1...n).reduce(0, +)
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    return (1...n).reduce(0, +)
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "(" {
            stack.append(bracket)
        } else if bracket == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "(" {
            stack.append(bracket)
        } else if bracket == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "(" {
            stack.append(bracket)
        } else if bracket == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "(" {
            stack.append(bracket)
        } else if bracket == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        switch bracket {
        case "(":
            stack.append(bracket)
        case ")":
            if stack.isEmpty {
                return false
            } else if stack.last != "(" {
                return false
            } else {
                stack.removeLast()
            }
        default:
            break
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        switch bracket {
        case "(":
            stack.append(bracket)
        case ")":
            if stack.isEmpty {
                return false
            } else if stack.last != "(" {
                return false
            } else {
                stack.removeLast()
            }
        default:
            break
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
  var stack = [Character]()
  for char in brackets {
    if char == "(" {
      stack.append(char)
    } else if char == ")" {
      if stack.isEmpty {
        return false
      } else {
        stack.removeLast()
      }
    }
  }
  return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
  var stack = [Character]()
  for char in brackets {
    if char == "(" {
      stack.append(char)
    } else if char == ")" {
      if stack.isEmpty {
        return false
      } else {
        stack.removeLast()
      }
    }
  }
  return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
  var stack = [Character]()
  for bracket in brackets {
    if bracket == "(" {
      stack.append(bracket)
    } else if bracket == ")" {
      if stack.isEmpty {
        return false
      } else {
        stack.removeLast()
      }
    }
  }
  return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
  var stack = [Character]()
  for bracket in brackets {
    if bracket == "(" {
      stack.append(bracket)
    } else if bracket == ")" {
      if stack.isEmpty {
        return false
      } else {
        stack.removeLast()
      }
    }
  }
  return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "(" {
            stack.append(bracket)
        } else if bracket == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        if bracket == "(" {
            stack.append(bracket)
        } else if bracket == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        switch bracket {
        case "(":
            stack.append(bracket)
        case ")":
            if stack.isEmpty {
                return false
            } else if stack.last != "(" {
                return false
            } else {
                stack.removeLast()
            }
        default:
            continue
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        switch bracket {
        case "(":
            stack.append(bracket)
        case ")":
            if stack.isEmpty {
                return false
            } else if stack.last != "(" {
                return false
            } else {
                stack.removeLast()
            }
        default:
            continue
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for c in brackets {
        if c == "(" {
            stack.append(c)
        } else if c == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for c in brackets {
        if c == "(" {
            stack.append(c)
        } else if c == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        switch bracket {
        case "(":
            stack.append(bracket)
        case ")":
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        default:
            break
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for bracket in brackets {
        switch bracket {
        case "(":
            stack.append(bracket)
        case ")":
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        default:
            break
        }
    }
    return stack.isEmpty
}
```

func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<xs.count {
        if i == 0 {
            result.append(xs[i])
        } else {
            result.append(xs[i] * i)
        }
    }
    return result
}
```swift
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<xs.count {
        if i == 0 {
            result.append(xs[i])
        } else {
            result.append(xs[i] * i)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(i * xs[i])
    }
    return result
}
```swift
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(i * xs[i])
    }
    return result
}
```

func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<xs.count {
        if i == 0 {
            result.append(xs[i])
        } else {
            result.append(xs[i] * i)
        }
    }
    return result
}
```swift
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<xs.count {
        if i == 0 {
            result.append(xs[i])
        } else {
            result.append(xs[i] * i)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(xs[i] * i)
    }
    return result
}
```swift
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(xs[i] * i)
    }
    return result
}
```

func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<xs.count {
        if i == 0 {
            result.append(xs[0])
        } else {
            result.append(xs[i] * i)
        }
    }
    return result
}
```swift
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<xs.count {
        if i == 0 {
            result.append(xs[0])
        } else {
            result.append(xs[i] * i)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(xs[i] * i)
    }
    return result
}
```swift
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(xs[i] * i)
    }
    return result
}

// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(xs[i] * i)
    }
    return result
}

// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(xs[i] * i)
    }
    return result
}

// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(xs[i] * i)
    }
    return result
}

// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(xs[i] * i)
    }
    return result
}

// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(xs[i] * i)
    }
    return result
}

// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(

func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 0 else { return [] }
    guard xs.count > 1 else { return [xs[0]] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(i * xs[i])
    }
    return result
}
```swift
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 0 else { return [] }
    guard xs.count > 1 else { return [xs[0]] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(i * xs[i])
    }
    return result
}
```
 // XCTAssertTrue failed

func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(i * xs[i])
    }
    return result
}
```swift
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(i * xs[i])
    }
    return result
}
```

func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(xs[i] * i)
    }
    return result
}
```swift
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(xs[i] * i)
    }
    return result
}
```

func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    return (1...xs.count-1).map { i in
        (i+1) * xs[i]
    }
}
```swift
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    guard xs.count > 1 else { return [] }
    return (1...xs.count-1).map { i in
        (i+1) * xs[i]
    }
}
```
 // XCTAssertTrue failed

func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var a = 0
    var b = 0
    var c = 1
    for _ in 0..<n-2 {
        a = b
        b = c
        c = a + b + c
    }
    return c
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var a = 0
    var b = 0
    var c = 1
    for _ in 0..<n-2 {
        a = b
        b = c
        c = a + b + c
    }
    return c
}
```
 // XCTAssertTrue failed

func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var a = 0
    var b = 0
    var c = 1
    for _ in 0..<n-2 {
        a = b
        b = c
        c = a + b + c
    }
    return c
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var a = 0
    var b = 0
    var c = 1
    for _ in 0..<n-2 {
        a = b
        b = c
        c = a + b + c
    }
    return c
}
```
 // XCTAssertTrue failed

func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var fibfib = [0, 0, 1]
    for i in 3...n {
        fibfib.append(fibfib[i-1] + fibfib[i-2] + fibfib[i-3])
    }
    return fibfib[n]
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var fibfib = [0, 0, 1]
    for i in 3...n {
        fibfib.append(fibfib[i-1] + fibfib[i-2] + fibfib[i-3])
    }
    return fibfib[n]
}
```
 // XCTAssertTrue failed

func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var a = 0
    var b = 0
    var c = 1
    for _ in 0..<n-2 {
        a = b
        b = c
        c = a + b + c
    }
    return c
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var a = 0
    var b = 0
    var c = 1
    for _ in 0..<n-2 {
        a = b
        b = c
        c = a + b + c
    }
    return c
}
```
 // XCTAssertTrue failed

func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var fibfib = [0, 0, 1]
    for i in 3...n {
        fibfib.append(fibfib[i - 1] + fibfib[i - 2] + fibfib[i - 3])
    }
    return fibfib[n]
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var fibfib = [0, 0, 1]
    for i in 3...n {
        fibfib.append(fibfib[i - 1] + fibfib[i - 2] + fibfib[i - 3])
    }
    return fibfib[n]
}
```
 // XCTAssertTrue failed

func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var fibfib = [0, 0, 1]
    for i in 3...n {
        fibfib.append(fibfib[i - 1] + fibfib[i - 2] + fibfib[i - 3])
    }
    return fibfib[n]
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var fibfib = [0, 0, 1]
    for i in 3...n {
        fibfib.append(fibfib[i - 1] + fibfib[i - 2] + fibfib[i - 3])
    }
    return fibfib[n]
}
```
 // XCTAssertTrue failed

func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var fibfib = [0, 0, 1]
    for i in 3...n {
        fibfib.append(fibfib[i-1] + fibfib[i-2] + fibfib[i-3])
    }
    return fibfib[n]
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var fibfib = [0, 0, 1]
    for i in 3...n {
        fibfib.append(fibfib[i-1] + fibfib[i-2] + fibfib[i-3])
    }
    return fibfib[n]
}
```
 // XCTAssertTrue failed

func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var a = 0
    var b = 0
    var c = 1
    var d = 1
    for _ in 0..<n-2 {
        a = b
        b = c
        c = d
        d = a + b + c
    }
    return d
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var a = 0
    var b = 0
    var c = 1
    var d = 1
    for _ in 0..<n-2 {
        a = b
        b = c
        c = d
        d = a + b + c
    }
    return d
}
```
 // XCTAssertTrue failed

func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var fibfib = [Int](repeating: 0, count: n + 1)
    fibfib[0] = 0
    fibfib[1] = 0
    fibfib[2] = 1
    for i in 3...n {
        fibfib[i] = fibfib[i - 1] + fibfib[i - 2] + fibfib[i - 3]
    }
    return fibfib[n]
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var fibfib = [Int](repeating: 0, count: n + 1)
    fibfib[0] = 0
    fibfib[1] = 0
    fibfib[2] = 1
    for i in 3...n {
        fibfib[i] = fibfib[i - 1] + fibfib[i - 2] + fibfib[i - 3]
    }
    return fibfib[n]
}
```
 // XCTAssertTrue failed

func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var fibfib = [0, 0, 1]
    for i in 3...n {
        fibfib.append(fibfib[i - 1] + fibfib[i - 2] + fibfib[i - 3])
    }
    return fibfib[n]
}
```swift
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
// fibfib(n: 1) == 0
// fibfib(n: 5) == 4
// fibfib(n: 8) == 24
func fibfib(n: Int) -> Int {
    guard n > 2 else { return n }
    var fibfib = [0, 0, 1]
    for i in 3...n {
        fibfib.append(fibfib[i - 1] + fibfib[i - 2] + fibfib[i - 3])
    }
    return fibfib[n]
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    let vowels = ["a", "e", "i", "o", "u", "y"]
    var count = 0
    for letter in s {
        if vowels.contains(letter) {
            count += 1
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    let vowels = ["a", "e", "i", "o", "u", "y"]
    var count = 0
    for letter in s {
        if vowels.contains(letter) {
            count += 1
        }
    }
    return count
}
```
if vowels.contains(letter) { // cannot convert value of type 'Character' to expected argument type 'String'

func vowelsCount(s: String) -> Int {
    var count = 0
    for char in s {
        if char == "a" || char == "e" || char == "i" || char == "o" || char == "u" {
            count += 1
        }
        else if char == "y" {
            if s.index(of: char) == s.index(before: s.endIndex)) {
                count += 1
            }
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    var count = 0
    for char in s {
        if char == "a" || char == "e" || char == "i" || char == "o" || char == "u" {
            count += 1
        }
        else if char == "y" {
            if s.index(of: char) == s.index(before: s.endIndex)) {
                count += 1
            }
        }
    }
    return count
}
```
if s.index(of: char) == s.index(before: s.endIndex)) { // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
if s.index(of: char) == s.index(before: s.endIndex)) { // expected '{' after 'if' condition

func vowelsCount(s: String) -> Int {
    var count = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" || c == "y" {
            count += 1
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    var count = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" || c == "y" {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    let vowels = ["a", "e", "i", "o", "u", "y"]
    var count = 0
    for letter in s {
        if vowels.contains(letter) {
            count += 1
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    let vowels = ["a", "e", "i", "o", "u", "y"]
    var count = 0
    for letter in s {
        if vowels.contains(letter) {
            count += 1
        }
    }
    return count
}
```
if vowels.contains(letter) { // cannot convert value of type 'Character' to expected argument type 'String'

func vowelsCount(s: String) -> Int {
    let vowels = "aeiouy"
    var count = 0
    for c in s {
        if vowels.contains(c) {
            count += 1
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    let vowels = "aeiouy"
    var count = 0
    for c in s {
        if vowels.contains(c) {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    var count = 0
    for letter in s {
        if letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u" || letter == "y" {
            count += 1
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    var count = 0
    for letter in s {
        if letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u" || letter == "y" {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    var count = 0
    for letter in s {
        if letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u" || letter == "y" {
            count += 1
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    var count = 0
    for letter in s {
        if letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u" || letter == "y" {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    var count = 0
    for char in s {
        if char == "a" || char == "e" || char == "i" || char == "o" || char == "u" || char == "y" {
            count += 1
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    var count = 0
    for char in s {
        if char == "a" || char == "e" || char == "i" || char == "o" || char == "u" || char == "y" {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    var count = 0
    for char in s {
        if char == "a" || char == "e" || char == "i" || char == "o" || char == "u" || char == "y" {
            count += 1
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    var count = 0
    for char in s {
        if char == "a" || char == "e" || char == "i" || char == "o" || char == "u" || char == "y" {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    var count = 0
    for letter in s {
        if letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u" {
            count += 1
        }
        if letter == "y" && s.last == letter {
            count += 1
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    var count = 0
    for letter in s {
        if letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u" {
            count += 1
        }
        if letter == "y" && s.last == letter {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { String($0) }
    let shifted = shift > digits.count ? digits.reversed() : Array(digits.dropFirst(shift)) + Array(digits.prefix(shift))
    return String(shifted.reversed())
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { String($0) }
    let shifted = shift > digits.count ? digits.reversed() : Array(digits.dropFirst(shift)) + Array(digits.prefix(shift))
    return String(shifted.reversed())
}
```
return String(shifted.reversed()) // no exact matches in call to initializer

func circularShift(x: Int, shift: Int) -> String {
    var x = x
    var result = ""
    var digits = String(x)
    let count = digits.count
    if shift > count {
        return digits.reversed()
    }
    for _ in 0..<shift {
        let lastDigit = digits.last!
        digits = String(digits.dropLast())
        digits.insert(lastDigit, at: 0)
    }
    return digits
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    var x = x
    var result = ""
    var digits = String(x)
    let count = digits.count
    if shift > count {
        return digits.reversed()
    }
    for _ in 0..<shift {
        let lastDigit = digits.last!
        digits = String(digits.dropLast())
        digits.insert(lastDigit, at: 0)
    }
    return digits
}
```
return digits.reversed() // no 'reversed' candidates produce the expected contextual result type 'String'
digits.insert(lastDigit, at: 0) // cannot convert value of type 'Int' to expected argument type 'String.Index'

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let length = digits.count
    let shifted = shift % length
    let start = length - shifted
    let end = length - shifted - 1
    return String(digits[start...end])
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let length = digits.count
    let shifted = shift % length
    let start = length - shifted
    let end = length - shifted - 1
    return String(digits[start...end])
}
```
return String(digits[start...end]) // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let length = digits.count
    let shifted = shift % length
    let start = length - shifted
    let end = length - shifted - 1
    let prefix = digits[0..<start]
    let suffix = digits[end..<length]
    return prefix + suffix
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let length = digits.count
    let shifted = shift % length
    let start = length - shifted
    let end = length - shifted - 1
    let prefix = digits[0..<start]
    let suffix = digits[end..<length]
    return prefix + suffix
}
```
let prefix = digits[0..<start] // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.
let suffix = digits[end..<length] // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let length = digits.count
    let shifted = shift % length
    let start = length - shifted
    let end = length - shifted - 1
    return digits[start..<end] + digits[0..<start]
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let length = digits.count
    let shifted = shift % length
    let start = length - shifted
    let end = length - shifted - 1
    return digits[start..<end] + digits[0..<start]
}
```
return digits[start..<end] + digits[0..<start] // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.
return digits[start..<end] + digits[0..<start] // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { String($0) }
    let shifted = digits.suffix(shift)
    let leading = digits.prefix(digits.count - shift)
    return shifted + leading
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { String($0) }
    let shifted = digits.suffix(shift)
    let leading = digits.prefix(digits.count - shift)
    return shifted + leading
}
```
return shifted + leading // cannot convert return expression of type 'Array<String>.SubSequence' (aka 'ArraySlice<String>') to return type 'String'

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { String($0) }
    let shifted = shift > digits.count ? digits.reversed() : Array(digits.dropFirst(shift)) + digits.prefix(shift)
    return String(shifted)
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { String($0) }
    let shifted = shift > digits.count ? digits.reversed() : Array(digits.dropFirst(shift)) + digits.prefix(shift)
    return String(shifted)
}
```
return String(shifted) // no exact matches in call to initializer

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { String($0) }
    let shifted = digits.suffix(shift)
    let reversed = digits.prefix(digits.count - shift)
    return shifted + reversed
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { String($0) }
    let shifted = digits.suffix(shift)
    let reversed = digits.prefix(digits.count - shift)
    return shifted + reversed
}
```
return shifted + reversed // cannot convert return expression of type 'Array<String>.SubSequence' (aka 'ArraySlice<String>') to return type 'String'

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let shifted = digits.dropFirst(shift)
    let reversed = digits.dropLast(shift)
    return shifted.isEmpty ? String(reversed.reversed()) : String(shifted) + String(reversed.reversed())
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let shifted = digits.dropFirst(shift)
    let reversed = digits.dropLast(shift)
    return shifted.isEmpty ? String(reversed.reversed()) : String(shifted) + String(reversed.reversed())
}
```
 // XCTAssertTrue failed

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let shifted = shift % digits.count
    let start = digits.index(digits.startIndex, offsetBy: shifted)
    let end = digits.index(digits.endIndex, offsetBy: -shifted)
    return String(digits[start..<end])
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let shifted = shift % digits.count
    let start = digits.index(digits.startIndex, offsetBy: shifted)
    let end = digits.index(digits.endIndex, offsetBy: -shifted)
    return String(digits[start..<end])
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func digitSum(s: String) -> Int {
    var sum = 0
    for character in s {
        if character.isUppercase {
            sum += character.asciiValue!
        }
    }
    return sum
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    var sum = 0
    for character in s {
        if character.isUppercase {
            sum += character.asciiValue!
        }
    }
    return sum
}
```
sum += character.asciiValue! // cannot convert value of type 'UInt8' to expected argument type 'Int'

func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(char.asciiValue ?? 0)
        }
    }
    return sum
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(char.asciiValue ?? 0)
        }
    }
    return sum
}

// Tests
let s1 = ""
let s2 = "abAB"
let s3 = "abcCd"
let s4 = "helloE"
let s5 = "woArBld"
let s6 = "aAaaaXa"

print(digitSum(s: s1))
print(digitSum(s: s2))
print(digitSum(s: s3))
print(digitSum(s: s4))
print(digitSum(s: s5))
print(digitSum(s: s6))
```

func digitSum(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isUppercase {
            sum += c.asciiValue!
        }
    }
    return sum
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isUppercase {
            sum += c.asciiValue!
        }
    }
    return sum
}

// Solution
// - Explanation: https://stackoverflow.com/questions/32179070/swift-sum-of-uppercase-characters-in-a-string
// - AsciiValue: https://developer.apple.com/documentation/swift/string/1641666-asciivalue
// - isUppercase: https://developer.apple.com/documentation/swift/string/1641676-isuppercase
// - asciiValue: https://developer.apple.com/documentation/swift/unicodescalar/1641671-asciivalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/string/1641674-unicodescalars
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-asciivalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/1641671-unicodescalarvalue
// - unicodeScalars: https://developer.apple.com/documentation/swift/unicodescalar/
sum += c.asciiValue! // cannot convert value of type 'UInt8' to expected argument type 'Int'

func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(char.asciiValue ?? 0)
        }
    }
    return sum
}

func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += char.asciiValue ?? 0
        }
    }
    return sum
}

func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(char.asciiValue ?? 0)
        }
    }
    return sum
}

// Solution
// 1.
func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += char.asciiValue ?? 0
        }
    }
    return sum
}

// 2.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 3.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 4.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 5.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 6.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 7.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 8.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 9.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 10.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 11.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 12.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 13.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 14.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 15.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 16.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 17.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) }
}

// 18.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1
func digitSum(s: String) -> Int { // invalid redeclaration of 'digitSum(s:)'
sum += char.asciiValue ?? 0 // cannot convert value of type 'UInt8' to expected argument type 'Int'
func digitSum(s: String) -> Int { // invalid redeclaration of 'digitSum(s:)'
return s.reduce(0) { $0 + ($1.isUppercase ? $1.asciiValue ?? 0 : 0) } // cannot convert return expression of type 'UInt8' to return type 'Int'

func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.uppercased().unicodeScalars.first?.value ?? 0) }
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.uppercased().unicodeScalars.first?.value ?? 0) }
}
```
return s.reduce(0) { $0 + ($1.uppercased().unicodeScalars.first?.value ?? 0) } // cannot convert return expression of type 'UInt32' to return type 'Int'

func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// Solution
// 1.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 2.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 3.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 4.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 5.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 6.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 7.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 8.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 9.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 10.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 11.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 12.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 13.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 14.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 15.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 16.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 17.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 18.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 19.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 20.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.first!.value) }
}

// 21.
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + Int($1.unicodeScalars.
 // XCTAssertTrue failed

func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += char.asciiValue!
        }
    }
    return sum
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += char.asciiValue!
        }
    }
    return sum
}
```
sum += char.asciiValue! // cannot convert value of type 'UInt8' to expected argument type 'Int'

func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.unicodeScalars.first?.value ?? 0) }
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.unicodeScalars.first?.value ?? 0) }
}

// Solution
// - Explanation: https://stackoverflow.com/questions/39677430/swift-sum-of-uppercase-characters-in-a-string
func digitSum(s: String) -> Int {
    return s.reduce(0) { $0 + ($1.unicodeScalars.first?.value ?? 0) }
}

// Tests
let result = digitSum(s: "abAB")
print(result) // 131
```
return s.reduce(0) { $0 + ($1.unicodeScalars.first?.value ?? 0) } // cannot convert return expression of type 'UInt32' to return type 'Int'

func digitSum(s: String) -> Int {
    var sum = 0
    for character in s {
        if character.isUppercase {
            sum += Int(character.asciiValue!)
        }
    }
    return sum
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    var sum = 0
    for character in s {
        if character.isUppercase {
            sum += Int(character.asciiValue!)
        }
    }
    return sum
}
```

func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(char.asciiValue ?? 0)
        }
    }
    return sum
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(char.asciiValue ?? 0)
        }
    }
    return sum
}
```

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " ").first?.components(separatedBy: " ").last ?? "0"
    let oranges = s.components(separatedBy: " ").last?.components(separatedBy: " ").last ?? "0"
    let total = Int(apples) + Int(oranges)
    return n - total
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " ").first?.components(separatedBy: " ").last ?? "0"
    let oranges = s.components(separatedBy: " ").last?.components(separatedBy: " ").last ?? "0"
    let total = Int(apples) + Int(oranges)
    return n - total
}
```
let total = Int(apples) + Int(oranges) // binary operator '+' cannot be applied to two 'Int?' operands

func fruitDistribution(s: String, n: Int) -> Int {
    let split = s.components(separatedBy: " ")
    let apples = Int(split[0])!
    let oranges = Int(split[2])!
    return n - apples - oranges
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let split = s.components(separatedBy: " ")
    let apples = Int(split[0])!
    let oranges = Int(split[2])!
    return n - apples - oranges
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func fruitDistribution(s: String, n: Int) -> Int {
    let split = s.split(separator: " ")
    let apples = Int(split[0])!
    let oranges = Int(split[2])!
    return n - apples - oranges
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let split = s.split(separator: " ")
    let apples = Int(split[0])!
    let oranges = Int(split[2])!
    return n - apples - oranges
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " ").first?.components(separatedBy: " ").last?.components(separatedBy: " ").first
    let oranges = s.components(separatedBy: " ").first?.components(separatedBy: " ").last?.components(separatedBy: " ").last
    let applesInt = Int(apples ?? "0") ?? 0
    let orangesInt = Int(oranges ?? "0") ?? 0
    return n - (applesInt + orangesInt)
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " ").first?.components(separatedBy: " ").last?.components(separatedBy: " ").first
    let oranges = s.components(separatedBy: " ").first?.components(separatedBy: " ").last?.components(separatedBy: " ").last
    let applesInt = Int(apples ?? "0") ?? 0
    let orangesInt = Int(oranges ?? "0") ?? 0
    return n - (applesInt + orangesInt)
}
```
 // XCTAssertTrue failed

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " ").first?.components(separatedBy: " ").last
    let oranges = s.components(separatedBy: " ").last?.components(separatedBy: " ").last
    let applesCount = Int(apples ?? "0") ?? 0
    let orangesCount = Int(oranges ?? "0") ?? 0
    return n - applesCount - orangesCount
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " ").first?.components(separatedBy: " ").last
    let oranges = s.components(separatedBy: " ").last?.components(separatedBy: " ").last
    let applesCount = Int(apples ?? "0") ?? 0
    let orangesCount = Int(oranges ?? "0") ?? 0
    return n - applesCount - orangesCount
}
```
 // XCTAssertTrue failed

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " ").first?.components(separatedBy: " ").last
    let oranges = s.components(separatedBy: " ").last?.components(separatedBy: " ").last
    let applesCount = Int(apples ?? "0") ?? 0
    let orangesCount = Int(oranges ?? "0") ?? 0
    return n - (applesCount + orangesCount)
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " ").first?.components(separatedBy: " ").last
    let oranges = s.components(separatedBy: " ").last?.components(separatedBy: " ").last
    let applesCount = Int(apples ?? "0") ?? 0
    let orangesCount = Int(oranges ?? "0") ?? 0
    return n - (applesCount + orangesCount)
}
```
 // XCTAssertTrue failed

func fruitDistribution(s: String, n: Int) -> Int {
    let split = s.components(separatedBy: " ")
    let apples = Int(split[0])!
    let oranges = Int(split[2])!
    return n - apples - oranges
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let split = s.components(separatedBy: " ")
    let apples = Int(split[0])!
    let oranges = Int(split[2])!
    return n - apples - oranges
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " ").first?.components(separatedBy: " ").last
    let oranges = s.components(separatedBy: " ").last?.components(separatedBy: " ").last
    let total = Int(apples!)! + Int(oranges!)!
    return n - total
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " ").first?.components(separatedBy: " ").last
    let oranges = s.components(separatedBy: " ").last?.components(separatedBy: " ").last
    let total = Int(apples!)! + Int(oranges!)!
    return n - total
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func fruitDistribution(s: String, n: Int) -> Int {
    let arr = s.components(separatedBy: " ")
    let apples = Int(arr[0])!
    let oranges = Int(arr[2])!
    return n - (apples + oranges)
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let arr = s.components(separatedBy: " ")
    let apples = Int(arr[0])!
    let oranges = Int(arr[2])!
    return n - (apples + oranges)
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " ").first?.components(separatedBy: " ").last
    let oranges = s.components(separatedBy: " ").last?.components(separatedBy: " ").last
    let applesCount = Int(apples ?? "0") ?? 0
    let orangesCount = Int(oranges ?? "0") ?? 0
    return n - applesCount - orangesCount
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " ").first?.components(separatedBy: " ").last
    let oranges = s.components(separatedBy: " ").last?.components(separatedBy: " ").last
    let applesCount = Int(apples ?? "0") ?? 0
    let orangesCount = Int(oranges ?? "0") ?? 0
    return n - applesCount - orangesCount
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var min = arr[0]
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    return min % 2 == 0 ? [min, minIndex] : []
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var min = arr[0]
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    return min % 2 == 0 ? [min, minIndex] : []
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var min = arr[0]
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value <= min {
            min = value
            minIndex = index
        }
    }
    return min == arr[0] ? [] : [min, minIndex]
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var min = arr[0]
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value <= min {
            min = value
            minIndex = index
        }
    }
    return min == arr[0] ? [] : [min, minIndex]
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var evenValues = [Int]()
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 {
            evenValues.append(value)
        }
    }
    guard !evenValues.isEmpty else { return [] }
    return [evenValues.min()!, arr.index(of: evenValues.min()!)!]
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var evenValues = [Int]()
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 {
            evenValues.append(value)
        }
    }
    guard !evenValues.isEmpty else { return [] }
    return [evenValues.min()!, arr.index(of: evenValues.min()!)!]
}
```
for (index, value) in arr.enumerated() { // immutable value 'index' was never used; consider replacing with '_' or removing it
return [evenValues.min()!, arr.index(of: evenValues.min()!)!] // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'

func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var evenValues = [Int]()
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 {
            evenValues.append(value)
        }
    }
    guard !evenValues.isEmpty else { return [] }
    let minEvenValue = evenValues.min()!
    let minEvenValueIndex = arr.firstIndex(of: minEvenValue)!
    return [minEvenValue, minEvenValueIndex]
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var evenValues = [Int]()
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 {
            evenValues.append(value)
        }
    }
    guard !evenValues.isEmpty else { return [] }
    let minEvenValue = evenValues.min()!
    let minEvenValueIndex = arr.firstIndex(of: minEvenValue)!
    return [minEvenValue, minEvenValueIndex]
}
```
for (index, value) in arr.enumerated() { // immutable value 'index' was never used; consider replacing with '_' or removing it

func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var evenValues = [Int]()
    var evenIndices = [Int]()
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 {
            evenValues.append(value)
            evenIndices.append(index)
        }
    }
    guard !evenValues.isEmpty else { return [] }
    return [evenValues.min()!, evenIndices.firstIndex(of: evenValues.min()!)!]
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var evenValues = [Int]()
    var evenIndices = [Int]()
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 {
            evenValues.append(value)
            evenIndices.append(index)
        }
    }
    guard !evenValues.isEmpty else { return [] }
    return [evenValues.min()!, evenIndices.firstIndex(of: evenValues.min()!)!]
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    let even = arr.filter { $0 % 2 == 0 }
    guard !even.isEmpty else { return [] }
    let min = even.min()!
    let index = arr.firstIndex(of: min)!
    return [min, index]
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    let even = arr.filter { $0 % 2 == 0 }
    guard !even.isEmpty else { return [] }
    let min = even.min()!
    let index = arr.firstIndex(of: min)!
    return [min, index]
}
```

func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var evenValues = [Int]()
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 {
            evenValues.append(value)
        }
    }
    guard !evenValues.isEmpty else { return [] }
    let minEvenValue = evenValues.min()!
    let minEvenValueIndex = arr.firstIndex(where: { $0 == minEvenValue })!
    return [minEvenValue, minEvenValueIndex]
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var evenValues = [Int]()
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 {
            evenValues.append(value)
        }
    }
    guard !evenValues.isEmpty else { return [] }
    let minEvenValue = evenValues.min()!
    let minEvenValueIndex = arr.firstIndex(where: { $0 == minEvenValue })!
    return [minEvenValue, minEvenValueIndex]
}
```
for (index, value) in arr.enumerated() { // immutable value 'index' was never used; consider replacing with '_' or removing it

func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var min = arr.first!
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value < min {
            min = value
            minIndex = index
        }
    }
    if min % 2 == 0 {
        return [min, minIndex]
    }
    return []
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var min = arr.first!
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value < min {
            min = value
            minIndex = index
        }
    }
    if min % 2 == 0 {
        return [min, minIndex]
    }
    return []
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    guard !arr.isEmpty else { return result }
    
    var minEvenValue = arr[0]
    var minEvenIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEvenValue {
            minEvenValue = value
            minEvenIndex = index
        }
    }
    
    if minEvenValue % 2 == 0 {
        result = [minEvenValue, minEvenIndex]
    }
    
    return result
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    guard !arr.isEmpty else { return result }
    
    var minEvenValue = arr[0]
    var minEvenIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEvenValue {
            minEvenValue = value
            minEvenIndex = index
        }
    }
    
    if minEvenValue % 2 == 0 {
        result = [minEvenValue, minEvenIndex]
    }
    
    return result
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var evenValues = arr.filter { $0 % 2 == 0 }
    guard !evenValues.isEmpty else { return [] }
    let smallestEvenValue = evenValues.min()!
    let smallestEvenValueIndex = arr.firstIndex(of: smallestEvenValue)!
    return [smallestEvenValue, smallestEvenValueIndex]
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    guard !arr.isEmpty else { return [] }
    var evenValues = arr.filter { $0 % 2 == 0 }
    guard !evenValues.isEmpty else { return [] }
    let smallestEvenValue = evenValues.min()!
    let smallestEvenValueIndex = arr.firstIndex(of: smallestEvenValue)!
    return [smallestEvenValue, smallestEvenValueIndex]
}
```
var evenValues = arr.filter { $0 % 2 == 0 } // variable 'evenValues' was never mutated; consider changing to 'let' constant

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        dict[num] = (dict[num] ?? 0) + 1
    }
    for (num, count) in dict {
        if num > 0 && count >= num {
            return num
        }
    }
    return -1
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        dict[num] = (dict[num] ?? 0) + 1
    }
    for (num, count) in dict {
        if num > 0 && count >= num {
            return num
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        dict[num, default: 0] += 1
    }
    for (num, count) in dict {
        if num > 0 && count >= num {
            return num
        }
    }
    return -1
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        dict[num, default: 0] += 1
    }
    for (num, count) in dict {
        if num > 0 && count >= num {
            return num
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for item in lst {
        dict[item] = (dict[item] ?? 0) + 1
    }
    var max = -1
    for (key, value) in dict {
        if key > 0 && value >= key {
            max = key
        }
    }
    return max
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for item in lst {
        dict[item] = (dict[item] ?? 0) + 1
    }
    var max = -1
    for (key, value) in dict {
        if key > 0 && value >= key {
            max = key
        }
    }
    return max
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for item in lst {
        dict[item] = (dict[item] ?? 0) + 1
    }
    var max = -1
    for (key, value) in dict {
        if key > 0 && value >= key {
            max = key
        }
    }
    return max
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for item in lst {
        dict[item] = (dict[item] ?? 0) + 1
    }
    var max = -1
    for (key, value) in dict {
        if key > 0 && value >= key {
            max = key
        }
    }
    return max
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for item in lst {
        dict[item] = (dict[item] ?? 0) + 1
    }
    for (key, value) in dict {
        if key > 0 && value >= key {
            return key
        }
    }
    return -1
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for item in lst {
        dict[item] = (dict[item] ?? 0) + 1
    }
    for (key, value) in dict {
        if key > 0 && value >= key {
            return key
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for item in lst {
        dict[item] = (dict[item] ?? 0) + 1
    }
    for item in dict {
        if item.value >= item.key {
            return item.key
        }
    }
    return -1
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for item in lst {
        dict[item] = (dict[item] ?? 0) + 1
    }
    for item in dict {
        if item.value >= item.key {
            return item.key
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for item in lst {
        dict[item] = (dict[item] ?? 0) + 1
    }
    for item in dict.keys {
        if item > 0 && dict[item]! >= item {
            return item
        }
    }
    return -1
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for item in lst {
        dict[item] = (dict[item] ?? 0) + 1
    }
    for item in dict.keys {
        if item > 0 && dict[item]! >= item {
            return item
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        dict[num] = (dict[num] ?? 0) + 1
    }
    for num in dict.keys {
        if num > 0 && dict[num]! >= num {
            return num
        }
    }
    return -1
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        dict[num] = (dict[num] ?? 0) + 1
    }
    for num in dict.keys {
        if num > 0 && dict[num]! >= num {
            return num
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for i in lst {
        dict[i] = (dict[i] ?? 0) + 1
    }
    var max = -1
    for (k, v) in dict {
        if k > 0 && v >= k {
            max = k
        }
    }
    return max
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for i in lst {
        dict[i] = (dict[i] ?? 0) + 1
    }
    var max = -1
    for (k, v) in dict {
        if k > 0 && v >= k {
            max = k
        }
    }
    return max
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for i in lst {
        dict[i] = (dict[i] ?? 0) + 1
    }
    for i in dict.keys {
        if i > 0 && dict[i]! >= i {
            return i
        }
    }
    return -1
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for i in lst {
        dict[i] = (dict[i] ?? 0) + 1
    }
    for i in dict.keys {
        if i > 0 && dict[i]! >= i {
            return i
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    guard !lst.isEmpty else { return [] }
    var result = [Int]()
    var min = lst.min()!
    var max = lst.max()!
    var minIndex = lst.firstIndex(of: min)!
    var maxIndex = lst.firstIndex(of: max)!
    result.append(min)
    result.append(max)
    lst.remove(at: minIndex)
    lst.remove(at: maxIndex)
    while !lst.isEmpty {
        min = lst.min()!
        max = lst.max()!
        minIndex = lst.firstIndex(of: min)!
        maxIndex = lst.firstIndex(of: max)!
        result.append(min)
        result.append(max)
        lst.remove(at: minIndex)
        lst.remove(at: maxIndex)
    }
    return result
}
```swift
// Given array of integers, return array in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// strangeSortList(lst: [1, 2, 3, 4]) == [1, 4, 2, 3]
// strangeSortList(lst: [5, 5, 5, 5]) == [5, 5, 5, 5]
// strangeSortList(lst: [] as [Int]) == [] as [Int]
func strangeSortList(lst: [Int]) -> [Int] {
    guard !lst.isEmpty else { return [] }
    var result = [Int]()
    var min = lst.min()!
    var max = lst.max()!
    var minIndex = lst.firstIndex(of: min)!
    var maxIndex = lst.firstIndex(of: max)!
    result.append(min)
    result.append(max)
    lst.remove(at: minIndex)
    lst.remove(at: maxIndex)
    while !lst.isEmpty {
        min = lst.min()!
        max = lst.max()!
        minIndex = lst.firstIndex(of: min)!
        maxIndex = lst.firstIndex(of: max)!
        result.append(min)
        result.append(max)
        lst.remove(at: minIndex)
        lst.remove(at: maxIndex)
    }
    return result
}
```
lst.remove(at: minIndex) // cannot use mutating member on immutable value: 'lst' is a 'let' constant
lst.remove(at: maxIndex) // cannot use mutating member on immutable value: 'lst' is a 'let' constant
lst.remove(at: minIndex) // cannot use mutating member on immutable value: 'lst' is a 'let' constant
lst.remove(at: maxIndex) // cannot use mutating member on immutable value: 'lst' is a 'let' constant

func strangeSortList(lst: [Int]) -> [Int] {
    guard !lst.isEmpty else { return [] }
    var result = lst
    var i = 0
    while i < result.count {
        var min = result[i]
        var max = result[i]
        for j in i + 1 ..< result.count {
            if result[j] < min {
                min = result[j]
            }
            if result[j] > max {
                max = result[j]
            }
        }
        if min != result[i] {
            result[i] = min
            result[i + 1] = max
        }
        i += 2
    }
    return result
}
```swift
// Given array of integers, return array in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// strangeSortList(lst: [1, 2, 3, 4]) == [1, 4, 2, 3]
// strangeSortList(lst: [5, 5, 5, 5]) == [5, 5, 5, 5]
// strangeSortList(lst: [] as [Int]) == [] as [Int]
func strangeSortList(lst: [Int]) -> [Int] {
    guard !lst.isEmpty else { return [] }
    var result = lst
    var i = 0
    while i < result.count {
        var min = result[i]
        var max = result[i]
        for j in i + 1 ..< result.count {
            if result[j] < min {
                min = result[j]
            }
            if result[j] > max {
                max = result[j]
            }
        }
        if min != result[i] {
            result[i] = min
            result[i + 1] = max
        }
        i += 2
    }
    return result
}
```
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    guard lst.count > 0 else { return [] }
    var result = [Int]()
    var min = lst[0]
    var max = lst[0]
    for i in 1..<lst.count {
        if lst[i] < min {
            min = lst[i]
        } else if lst[i] > max {
            max = lst[i]
        }
    }
    result.append(min)
    result.append(max)
    for i in 0..<lst.count {
        if lst[i] != min && lst[i] != max {
            result.append(lst[i])
        }
    }
    return result
}
```swift
// Given array of integers, return array in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// strangeSortList(lst: [1, 2, 3, 4]) == [1, 4, 2, 3]
// strangeSortList(lst: [5, 5, 5, 5]) == [5, 5, 5, 5]
// strangeSortList(lst: [] as [Int]) == [] as [Int]
func strangeSortList(lst: [Int]) -> [Int] {
    guard lst.count > 0 else { return [] }
    var result = [Int]()
    var min = lst[0]
    var max = lst[0]
    for i in 1..<lst.count {
        if lst[i] < min {
            min = lst[i]
        } else if lst[i] > max {
            max = lst[i]
        }
    }
    result.append(min)
    result.append(max)
    for i in 0..<lst.count {
        if lst[i] != min && lst[i] != max {
            result.append(lst[i])
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    guard !lst.isEmpty else { return [] }
    var result = [Int]()
    var min = lst.min()
    var max = lst.max()
    while !lst.isEmpty {
        if let min = min {
            result.append(min)
            lst.removeAll(where: { $0 == min })
            min = lst.min()
        }
        if let max = max {
            result.append(max)
            lst.removeAll(where: { $0 == max })
            max = lst.max()
        }
    }
    return result
}
```swift
// Given array of integers, return array in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// strangeSortList(lst: [1, 2, 3, 4]) == [1, 4, 2, 3]
// strangeSortList(lst: [5, 5, 5, 5]) == [5, 5, 5, 5]
// strangeSortList(lst: [] as [Int]) == [] as [Int]
func strangeSortList(lst: [Int]) -> [Int] {
    guard !lst.isEmpty else { return [] }
    var result = [Int]()
    var min = lst.min()
    var max = lst.max()
    while !lst.isEmpty {
        if let min = min {
            result.append(min)
            lst.removeAll(where: { $0 == min })
            min = lst.min()
        }
        if let max = max {
            result.append(max)
            lst.removeAll(where: { $0 == max })
            max = lst.max()
        }
    }
    return result
}
```
lst.removeAll(where: { $0 == min }) // cannot use mutating member on immutable value: 'lst' is a 'let' constant
min = lst.min() // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
min = lst.min() // cannot assign to value: 'min' is a 'let' constant
lst.removeAll(where: { $0 == max }) // cannot use mutating member on immutable value: 'lst' is a 'let' constant
max = lst.max() // cannot assign to value: 'max' is a 'let' constant
max = lst.max() // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func strangeSortList(lst: [Int]) -> [Int] {
    guard !lst.isEmpty else { return [] }
    var result = lst
    var min = Int.max
    var max = Int.min
    for i in 0..<result.count {
        if result[i] < min {
            min = result[i]
        }
        if result[i] > max {
            max = result[i]
        }
    }
    var index = 0
    while index < result.count {
        if result[index] == min {
            result.remove(at: index)
            min = Int.max
            for i in 0..<result.count {
                if result[i] < min {
                    min = result[i]
                }
            }
        } else if result[index] == max {
            result.remove(at: index)
            max = Int.min
            for i in 0..<result.count {
                if result[i] > max {
                    max = result[i]
                }
            }
        } else {
            index += 1
        }
    }
    return result
}
```swift
// Given array of integers, return array in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// strangeSortList(lst: [1, 2, 3, 4]) == [1, 4, 2, 3]
// strangeSortList(lst: [5, 5, 5, 5]) == [5, 5, 5, 5]
// strangeSortList(lst: [] as [Int]) == [] as [Int]
func strangeSortList(lst: [Int]) -> [Int] {
    guard !lst.isEmpty else { return [] }
    var result = lst
    var min = Int.max
    var max = Int.min
    for i in 0..<result.count {
        if result[i] < min {
            min = result[i]
        }
        if result[i] > max {
            max = result[i]
        }
    }
    var index = 0
    while index < result.count {
        if result[index] == min {
            result.remove(at: index)
            min = Int.max
            for i in 0..<result.count {
                if result[i] < min {
                    min = result[i]
                }
            }
        } else if result[index] == max {
            result.remove(at: index)
            max = Int.min
            for i in 0..<result.count {
                if result[i] > max {
                    max = result[i]
                }
            }
        } else {
            index += 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    guard lst.count > 0 else { return [] }
    var sorted = lst.sorted()
    var result = [Int]()
    var i = 0
    while i < sorted.count {
        result.append(sorted[i])
        i += 1
        if i < sorted.count {
            result.append(sorted[sorted.count - i - 1])
            i += 1
        }
    }
    return result
}
```swift
// Given array of integers, return array in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// strangeSortList(lst: [1, 2, 3, 4]) == [1, 4, 2, 3]
// strangeSortList(lst: [5, 5, 5, 5]) == [5, 5, 5, 5]
// strangeSortList(lst: [] as [Int]) == [] as [Int]
func strangeSortList(lst: [Int]) -> [Int] {
    guard lst.count > 0 else { return [] }
    var sorted = lst.sorted()
    var result = [Int]()
    var i = 0
    while i < sorted.count {
        result.append(sorted[i])
        i += 1
        if i < sorted.count {
            result.append(sorted[sorted.count - i - 1])
            i += 1
        }
    }
    return result
}
```
var sorted = lst.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    guard lst.count > 0 else { return [] }
    var result = [Int]()
    var min = lst[0]
    var max = lst[0]
    for i in 1..<lst.count {
        if lst[i] < min {
            min = lst[i]
        } else if lst[i] > max {
            max = lst[i]
        }
    }
    result.append(min)
    result.append(max)
    for i in 1..<lst.count {
        if lst[i] != min && lst[i] != max {
            result.append(lst[i])
        }
    }
    return result
}
```swift
// Given array of integers, return array in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// strangeSortList(lst: [1, 2, 3, 4]) == [1, 4, 2, 3]
// strangeSortList(lst: [5, 5, 5, 5]) == [5, 5, 5, 5]
// strangeSortList(lst: [] as [Int]) == [] as [Int]
func strangeSortList(lst: [Int]) -> [Int] {
    guard lst.count > 0 else { return [] }
    var result = [Int]()
    var min = lst[0]
    var max = lst[0]
    for i in 1..<lst.count {
        if lst[i] < min {
            min = lst[i]
        } else if lst[i] > max {
            max = lst[i]
        }
    }
    result.append(min)
    result.append(max)
    for i in 1..<lst.count {
        if lst[i] != min && lst[i] != max {
            result.append(lst[i])
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    guard lst.count > 0 else { return [] }
    var result = [Int]()
    var min = lst[0]
    var max = lst[0]
    for i in 1..<lst.count {
        if lst[i] < min {
            min = lst[i]
        }
        if lst[i] > max {
            max = lst[i]
        }
    }
    result.append(min)
    result.append(max)
    for i in 0..<lst.count {
        if lst[i] != min && lst[i] != max {
            result.append(lst[i])
        }
    }
    return result
}
```swift
// Given array of integers, return array in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// strangeSortList(lst: [1, 2, 3, 4]) == [1, 4, 2, 3]
// strangeSortList(lst: [5, 5, 5, 5]) == [5, 5, 5, 5]
// strangeSortList(lst: [] as [Int]) == [] as [Int]
func strangeSortList(lst: [Int]) -> [Int] {
    guard lst.count > 0 else { return [] }
    var result = [Int]()
    var min = lst[0]
    var max = lst[0]
    for i in 1..<lst.count {
        if lst[i] < min {
            min = lst[i]
        }
        if lst[i] > max {
            max = lst[i]
        }
    }
    result.append(min)
    result.append(max)
    for i in 0..<lst.count {
        if lst[i] != min && lst[i] != max {
            result.append(lst[i])
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    guard !lst.isEmpty else { return [] }
    var result = lst
    var min = Int.max
    var max = Int.min
    for i in 0..<result.count {
        if result[i] < min {
            min = result[i]
        }
        if result[i] > max {
            max = result[i]
        }
    }
    var index = 0
    while index < result.count {
        if result[index] == min {
            result.remove(at: index)
            result.append(min)
            min = Int.max
            for i in 0..<result.count {
                if result[i] < min {
                    min = result[i]
                }
            }
        } else if result[index] == max {
            result.remove(at: index)
            result.append(max)
            max = Int.min
            for i in 0..<result.count {
                if result[i] > max {
                    max = result[i]
                }
            }
        } else {
            index += 1
        }
    }
    return result
}
```swift
// Given array of integers, return array in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// strangeSortList(lst: [1, 2, 3, 4]) == [1, 4, 2, 3]
// strangeSortList(lst: [5, 5, 5, 5]) == [5, 5, 5, 5]
// strangeSortList(lst: [] as [Int]) == [] as [Int]
func strangeSortList(lst: [Int]) -> [Int] {
    guard !lst.isEmpty else { return [] }
    var result = lst
    var min = Int.max
    var max = Int.min
    for i in 0..<result.count {
        if result[i] < min {
            min = result[i]
        }
        if result[i] > max {
            max = result[i]
        }
    }
    var index = 0
    while index < result.count {
        if result[index] == min {
            result.remove(at: index)
            result.append(min)
            min = Int.max
            for i in 0..<result.count {
                if result[i] < min {
                    min = result[i]
                }
            }
        } else if result[index] == max {
            result.remove(at: index)
            result.append(max)
            max = Int.min
            for i in 0..<result.count {
                if result[i] > max {
                    max = result[i]
                }
            }
        } else {
            index += 1
        }
    }
    return result
}
```

func strangeSortList(lst: [Int]) -> [Int] {
    guard lst.count > 0 else { return [] }
    var result = lst
    var min = Int.max
    var max = Int.min
    for i in 0..<result.count {
        if result[i] < min {
            min = result[i]
        }
        if result[i] > max {
            max = result[i]
        }
    }
    var index = 0
    while index < result.count {
        if result[index] == min {
            result.remove(at: index)
            result.append(min)
            min = Int.max
            for i in 0..<result.count {
                if result[i] < min {
                    min = result[i]
                }
            }
        } else if result[index] == max {
            result.remove(at: index)
            result.append(max)
            max = Int.min
            for i in 0..<result.count {
                if result[i] > max {
                    max = result[i]
                }
            }
        } else {
            index += 1
        }
    }
    return result
}
```swift
// Given array of integers, return array in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// strangeSortList(lst: [1, 2, 3, 4]) == [1, 4, 2, 3]
// strangeSortList(lst: [5, 5, 5, 5]) == [5, 5, 5, 5]
// strangeSortList(lst: [] as [Int]) == [] as [Int]
func strangeSortList(lst: [Int]) -> [Int] {
    guard lst.count > 0 else { return [] }
    var result = lst
    var min = Int.max
    var max = Int.min
    for i in 0..<result.count {
        if result[i] < min {
            min = result[i]
        }
        if result[i] > max {
            max = result[i]
        }
    }
    var index = 0
    while index < result.count {
        if result[index] == min {
            result.remove(at: index)
            result.append(min)
            min = Int.max
            for i in 0..<result.count {
                if result[i] < min {
                    min = result[i]
                }
            }
        } else if result[index] == max {
            result.remove(at: index)
            result.append(max)
            max = Int.min
            for i in 0..<result.count {
                if result[i] > max {
                    max = result[i]
                }
            }
        } else {
            index += 1
        }
    }
    return result
}
```

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area.rounded(.toNearestOrAwayFromZero, scale: 2)
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area.rounded(.toNearestOrAwayFromZero, scale: 2)
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'
return area.rounded(.toNearestOrAwayFromZero, scale: 2) // cannot infer contextual base in reference to member 'toNearestOrAwayFromZero'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area.rounded(.toNearestOrAwayFromZero, scale: 2)
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area.rounded(.toNearestOrAwayFromZero, scale: 2)
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'
return area.rounded(.toNearestOrAwayFromZero, scale: 2) // cannot infer contextual base in reference to member 'toNearestOrAwayFromZero'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

func willItFly(q: [Int], w: Int) -> Bool {
    guard q.count > 0 else { return false }
    guard q.count % 2 == 0 else { return false }
    guard q.reduce(0, +) <= w else { return false }
    let half = q.count / 2
    let firstHalf = q[0..<half]
    let secondHalf = q[half..<q.count]
    return firstHalf == secondHalf.reversed()
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    guard q.count > 0 else { return false }
    guard q.count % 2 == 0 else { return false }
    guard q.reduce(0, +) <= w else { return false }
    let half = q.count / 2
    let firstHalf = q[0..<half]
    let secondHalf = q[half..<q.count]
    return firstHalf == secondHalf.reversed()
}
```
return firstHalf == secondHalf.reversed() // binary operator '==' cannot be applied to operands of type 'ArraySlice<Int>' and '[Int]'

func willItFly(q: [Int], w: Int) -> Bool {
    guard q.count > 0 else { return false }
    guard q.count % 2 == 0 else { return false }
    guard q.count == q.reversed().count else { return false }
    let sum = q.reduce(0, +)
    return sum <= w
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    guard q.count > 0 else { return false }
    guard q.count % 2 == 0 else { return false }
    guard q.count == q.reversed().count else { return false }
    let sum = q.reduce(0, +)
    return sum <= w
}
```
 // XCTAssertTrue failed

func willItFly(q: [Int], w: Int) -> Bool {
    return q.reduce(0, +) <= w && isPalindrome(q)
}

func isPalindrome(_ array: [Int]) -> Bool {
    return array == Array(array.reversed())
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    return q.reduce(0, +) <= w && isPalindrome(q)
}

func isPalindrome(_ array: [Int]) -> Bool {
    return array == Array(array.reversed())
}
```

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let isBalanced = q.reversed().elementsEqual(q)
    return sum <= w && isBalanced
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let isBalanced = q.reversed().elementsEqual(q)
    return sum <= w && isBalanced
}
```

func willItFly(q: [Int], w: Int) -> Bool {
    var sum = 0
    for i in q {
        sum += i
    }
    if sum <= w {
        if q.count == 1 {
            return true
        }
        if q.count % 2 == 0 {
            var half = q.count / 2
            var left = Array(q[0..<half])
            var right = Array(q[half..<q.count])
            if left == right.reversed() {
                return true
            }
        }
    }
    return false
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    var sum = 0
    for i in q {
        sum += i
    }
    if sum <= w {
        if q.count == 1 {
            return true
        }
        if q.count % 2 == 0 {
            var half = q.count / 2
            var left = Array(q[0..<half])
            var right = Array(q[half..<q.count])
            if left == right.reversed() {
                return true
            }
        }
    }
    return false
}
```
var half = q.count / 2 // variable 'half' was never mutated; consider changing to 'let' constant
var left = Array(q[0..<half]) // variable 'left' was never mutated; consider changing to 'let' constant
var right = Array(q[half..<q.count]) // variable 'right' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    if sum <= w {
        let reversed = q.reversed()
        for (index, value) in q.enumerated() {
            if value != reversed[index] {
                return false
            }
        }
        return true
    }
    return false
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    if sum <= w {
        let reversed = q.reversed()
        for (index, value) in q.enumerated() {
            if value != reversed[index] {
                return false
            }
        }
        return true
    }
    return false
}
```
if value != reversed[index] { // cannot convert value of type 'Int' to expected argument type 'ReversedCollection<[Int]>.Index'

func willItFly(q: [Int], w: Int) -> Bool {
    // Write your code here
    return false
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    // Write your code here
    return false
}
```
 // XCTAssertTrue failed

func willItFly(q: [Int], w: Int) -> Bool {
    return q.reduce(0, +) <= w && isPalindrome(q)
}

func isPalindrome(_ array: [Int]) -> Bool {
    guard array.count > 1 else { return true }
    let mid = array.count / 2
    return array[0..<mid] == array[mid..<array.count].reversed()
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    return q.reduce(0, +) <= w && isPalindrome(q)
}

func isPalindrome(_ array: [Int]) -> Bool {
    guard array.count > 1 else { return true }
    let mid = array.count / 2
    return array[0..<mid] == array[mid..<array.count].reversed()
}
```
return array[0..<mid] == array[mid..<array.count].reversed() // cannot convert value of type 'ReversedCollection<ArraySlice<Int>>' to expected argument type 'ArraySlice<Int>'

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    if sum > w {
        return false
    }
    let reversed = q.reversed()
    return q == reversed
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    if sum > w {
        return false
    }
    let reversed = q.reversed()
    return q == reversed
}
```
return q == reversed // cannot convert value of type 'ReversedCollection<[Int]>' to expected argument type '[Int]'

func willItFly(q: [Int], w: Int) -> Bool {
    return q.reduce(0, +) <= w && q.reduce(0, +) == q.reversed().reduce(0, +)
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    return q.reduce(0, +) <= w && q.reduce(0, +) == q.reversed().reduce(0, +)
}
```
 // XCTAssertTrue failed

```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    // 1. Find the longest palindrome in the array
    // 2. Find the number of elements that are not part of the palindrome
    // 3. Return the number of elements that need to be changed
    // 4. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 5. Else, return the number of elements that need to be changed
    // 6. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 7. Else, return the number of elements that need to be changed
    // 8. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 9. Else, return the number of elements that need to be changed
    // 10. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 11. Else, return the number of elements that need to be changed
    // 12. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 13. Else, return the number of elements that need to be changed
    // 14. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 15. Else, return the number of elements that need to be changed
    // 16. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 17. Else, return the number of elements that need to be changed
    // 18. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 19. Else, return the number of elements that need to be changed
    // 20. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 21. Else, return the number of elements that need to be changed
    // 22. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 23. Else, return the number of elements that need to be changed
    // 24. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 25. Else, return the number of elements that need to be changed
    // 26. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 27. Else, return the number of elements that need to be changed
    // 28. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 29. Else, return the number of elements that need to be changed
    // 30. If the number of elements that need to be changed is greater than the number of elements
    // that are not part of the palindrome, return the number of elements that are not part of the palindrome
    // 31. Else, return the number of elements that need to be
XCTAssertTrue(smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4) // cannot find 'smallestChange' in scope
XCTAssertTrue(smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1) // cannot find 'smallestChange' in scope
XCTAssertTrue(smallestChange(arr: [1, 4, 2]) == 1) // cannot find 'smallestChange' in scope
XCTAssertTrue(smallestChange(arr: [1, 4, 4, 2]) == 1) // cannot find 'smallestChange' in scope
XCTAssertTrue(smallestChange(arr: [1, 2, 3, 2, 1]) == 0) // cannot find 'smallestChange' in scope
XCTAssertTrue(smallestChange(arr: [3, 1, 1, 3]) == 0) // cannot find 'smallestChange' in scope
XCTAssertTrue(smallestChange(arr: [1]) == 0) // cannot find 'smallestChange' in scope
XCTAssertTrue(smallestChange(arr: [0, 1]) == 1) // cannot find 'smallestChange' in scope

func smallestChange(arr: [Int]) -> Int {
    var arr = arr
    var result = 0
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] == arr[j] {
            i += 1
            j -= 1
        } else {
            result += 1
            if arr[i] < arr[j] {
                i += 1
            } else {
                j -= 1
            }
        }
    }
    return result
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var arr = arr
    var result = 0
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] == arr[j] {
            i += 1
            j -= 1
        } else {
            result += 1
            if arr[i] < arr[j] {
                i += 1
            } else {
                j -= 1
            }
        }
    }
    return result
}
```
var arr = arr // variable 'arr' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func smallestChange(arr: [Int]) -> Int {
    guard arr.count > 0 else { return 0 }
    var arr = arr
    var count = 0
    for i in 0..<arr.count {
        if arr[i] != i + 1 {
            count += 1
            arr[i] = i + 1
        }
    }
    return count
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    guard arr.count > 0 else { return 0 }
    var arr = arr
    var count = 0
    for i in 0..<arr.count {
        if arr[i] != i + 1 {
            count += 1
            arr[i] = i + 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func smallestChange(arr: [Int]) -> Int {
    // Write your code here
    return 0
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    // Write your code here
    return 0
}
```
 // XCTAssertTrue failed

func smallestChange(arr: [Int]) -> Int {
    var arr = arr
    var result = 0
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] == arr[j] {
            i += 1
            j -= 1
        } else {
            result += 1
            if arr[i] < arr[j] {
                i += 1
            } else {
                j -= 1
            }
        }
    }
    return result
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var arr = arr
    var result = 0
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] == arr[j] {
            i += 1
            j -= 1
        } else {
            result += 1
            if arr[i] < arr[j] {
                i += 1
            } else {
                j -= 1
            }
        }
    }
    return result
}
```
var arr = arr // variable 'arr' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func smallestChange(arr: [Int]) -> Int {
    guard arr.count > 0 else { return 0 }
    var arr = arr
    var count = 0
    var i = 0
    while i < arr.count / 2 {
        if arr[i] != arr[arr.count - i - 1] {
            count += 1
            arr[i] = arr[arr.count - i - 1]
        }
        i += 1
    }
    return count
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    guard arr.count > 0 else { return 0 }
    var arr = arr
    var count = 0
    var i = 0
    while i < arr.count / 2 {
        if arr[i] != arr[arr.count - i - 1] {
            count += 1
            arr[i] = arr[arr.count - i - 1]
        }
        i += 1
    }
    return count
}
```

func smallestChange(arr: [Int]) -> Int {
    var arr = arr
    var result = 0
    for i in 0..<arr.count {
        if arr[i] != i + 1 {
            result += 1
            arr[i] = i + 1
        }
    }
    return result
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var arr = arr
    var result = 0
    for i in 0..<arr.count {
        if arr[i] != i + 1 {
            result += 1
            arr[i] = i + 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func smallestChange(arr: [Int]) -> Int {
    var arr = arr
    var result = 0
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] == arr[j] {
            i += 1
            j -= 1
        } else {
            result += 1
            if arr[i] < arr[j] {
                i += 1
            } else {
                j -= 1
            }
        }
    }
    return result
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var arr = arr
    var result = 0
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] == arr[j] {
            i += 1
            j -= 1
        } else {
            result += 1
            if arr[i] < arr[j] {
                i += 1
            } else {
                j -= 1
            }
        }
    }
    return result
}
```
var arr = arr // variable 'arr' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func smallestChange(arr: [Int]) -> Int {
    var arr = arr
    var result = 0
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] == arr[j] {
            i += 1
            j -= 1
        } else {
            result += 1
            if arr[i] < arr[j] {
                i += 1
            } else {
                j -= 1
            }
        }
    }
    return result
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var arr = arr
    var result = 0
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] == arr[j] {
            i += 1
            j -= 1
        } else {
            result += 1
            if arr[i] < arr[j] {
                i += 1
            } else {
                j -= 1
            }
        }
    }
    return result
}
```
var arr = arr // variable 'arr' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func smallestChange(arr: [Int]) -> Int {
    var arr = arr
    var result = 0
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] == arr[j] {
            i += 1
            j -= 1
        } else {
            result += 1
            if arr[i] < arr[j] {
                i += 1
            } else {
                j -= 1
            }
        }
    }
    return result
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var arr = arr
    var result = 0
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] == arr[j] {
            i += 1
            j -= 1
        } else {
            result += 1
            if arr[i] < arr[j] {
                i += 1
            } else {
                j -= 1
            }
        }
    }
    return result
}
```
var arr = arr // variable 'arr' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result = [String]()
    var count1 = 0
    var count2 = 0
    for i in 0..<lst1.count {
        count1 += lst1[i].count
    }
    for i in 0..<lst2.count {
        count2 += lst2[i].count
    }
    if count1 < count2 {
        result = lst1
    } else if count1 > count2 {
        result = lst2
    } else {
        result = lst1
    }
    return result
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result = [String]()
    var count1 = 0
    var count2 = 0
    for i in 0..<lst1.count {
        count1 += lst1[i].count
    }
    for i in 0..<lst2.count {
        count2 += lst2[i].count
    }
    if count1 < count2 {
        result = lst1
    } else if count1 > count2 {
        result = lst2
    } else {
        result = lst1
    }
    return result
}
```

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    let lst1Count = lst1.reduce(0) { $0 + $1.count }
    let lst2Count = lst2.reduce(0) { $0 + $1.count }
    
    if lst1Count < lst2Count {
        return lst1
    } else if lst1Count > lst2Count {
        return lst2
    } else {
        return lst1
    }
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    let lst1Count = lst1.reduce(0) { $0 + $1.count }
    let lst2Count = lst2.reduce(0) { $0 + $1.count }
    
    if lst1Count < lst2Count {
        return lst1
    } else if lst1Count > lst2Count {
        return lst2
    } else {
        return lst1
    }
}

// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    let lst1Count = lst1.reduce(0) { $0 + $1.count }
    let lst2Count = lst2.reduce(0) { $0 + $1.count }
    
    if lst1Count < lst2Count {
        return lst1
    } else if lst1Count > lst2Count {
        return lst2
    } else {
        return lst1
    }
}
```

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var total1 = 0
    var total2 = 0
    for string in lst1 {
        total1 += string.count
    }
    for string in lst2 {
        total2 += string.count
    }
    if total1 < total2 {
        return lst1
    } else if total1 > total2 {
        return lst2
    } else {
        return lst1
    }
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var total1 = 0
    var total2 = 0
    for string in lst1 {
        total1 += string.count
    }
    for string in lst2 {
        total2 += string.count
    }
    if total1 < total2 {
        return lst1
    } else if total1 > total2 {
        return lst2
    } else {
        return lst1
    }
}
```

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result = [String]()
    if lst1.count == lst2.count {
        for i in 0..<lst1.count {
            if lst1[i].count < lst2[i].count {
                result.append(lst1[i])
            } else {
                result.append(lst2[i])
            }
        }
    } else if lst1.count > lst2.count {
        for i in 0..<lst2.count {
            if lst1[i].count < lst2[i].count {
                result.append(lst1[i])
            } else {
                result.append(lst2[i])
            }
        }
    } else {
        for i in 0..<lst1.count {
            if lst1[i].count < lst2[i].count {
                result.append(lst1[i])
            } else {
                result.append(lst2[i])
            }
        }
    }
    return result
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result = [String]()
    if lst1.count == lst2.count {
        for i in 0..<lst1.count {
            if lst1[i].count < lst2[i].count {
                result.append(lst1[i])
            } else {
                result.append(lst2[i])
            }
        }
    } else if lst1.count > lst2.count {
        for i in 0..<lst2.count {
            if lst1[i].count < lst2[i].count {
                result.append(lst1[i])
            } else {
                result.append(lst2[i])
            }
        }
    } else {
        for i in 0..<lst1.count {
            if lst1[i].count < lst2[i].count {
                result.append(lst1[i])
            } else {
                result.append(lst2[i])
            }
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var lst1Count = 0
    var lst2Count = 0
    for i in lst1 {
        lst1Count += i.count
    }
    for i in lst2 {
        lst2Count += i.count
    }
    if lst1Count == lst2Count {
        return lst1
    } else if lst1Count < lst2Count {
        return lst1
    } else {
        return lst2
    }
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var lst1Count = 0
    var lst2Count = 0
    for i in lst1 {
        lst1Count += i.count
    }
    for i in lst2 {
        lst2Count += i.count
    }
    if lst1Count == lst2Count {
        return lst1
    } else if lst1Count < lst2Count {
        return lst1
    } else {
        return lst2
    }
}
```

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var lst1Chars = 0
    var lst2Chars = 0
    for i in 0..<lst1.count {
        lst1Chars += lst1[i].count
    }
    for i in 0..<lst2.count {
        lst2Chars += lst2[i].count
    }
    if lst1Chars < lst2Chars {
        return lst1
    } else if lst1Chars > lst2Chars {
        return lst2
    } else {
        return lst1
    }
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var lst1Chars = 0
    var lst2Chars = 0
    for i in 0..<lst1.count {
        lst1Chars += lst1[i].count
    }
    for i in 0..<lst2.count {
        lst2Chars += lst2[i].count
    }
    if lst1Chars < lst2Chars {
        return lst1
    } else if lst1Chars > lst2Chars {
        return lst2
    } else {
        return lst1
    }
}
```

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var lst1Chars = 0
    var lst2Chars = 0
    for str in lst1 {
        lst1Chars += str.count
    }
    for str in lst2 {
        lst2Chars += str.count
    }
    if lst1Chars < lst2Chars {
        return lst1
    } else if lst1Chars > lst2Chars {
        return lst2
    } else {
        return lst1
    }
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var lst1Chars = 0
    var lst2Chars = 0
    for str in lst1 {
        lst1Chars += str.count
    }
    for str in lst2 {
        lst2Chars += str.count
    }
    if lst1Chars < lst2Chars {
        return lst1
    } else if lst1Chars > lst2Chars {
        return lst2
    } else {
        return lst1
    }
}
```

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    // Your code here
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    // Your code here
}
```
} // missing return in global function expected to return '[String]'

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result = [String]()
    var count1 = 0
    var count2 = 0
    for i in 0..<lst1.count {
        count1 += lst1[i].count
    }
    for i in 0..<lst2.count {
        count2 += lst2[i].count
    }
    if count1 < count2 {
        result = lst1
    } else if count1 > count2 {
        result = lst2
    } else {
        result = lst1
    }
    return result
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result = [String]()
    var count1 = 0
    var count2 = 0
    for i in 0..<lst1.count {
        count1 += lst1[i].count
    }
    for i in 0..<lst2.count {
        count2 += lst2[i].count
    }
    if count1 < count2 {
        result = lst1
    } else if count1 > count2 {
        result = lst2
    } else {
        result = lst1
    }
    return result
}
```

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result = [String]()
    var count1 = 0
    var count2 = 0
    for string in lst1 {
        count1 += string.count
    }
    for string in lst2 {
        count2 += string.count
    }
    if count1 < count2 {
        result = lst1
    } else if count1 > count2 {
        result = lst2
    } else {
        result = lst1
    }
    return result
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result = [String]()
    var count1 = 0
    var count2 = 0
    for string in lst1 {
        count1 += string.count
    }
    for string in lst2 {
        count2 += string.count
    }
    if count1 < count2 {
        result = lst1
    } else if count1 > count2 {
        result = lst2
    } else {
        result = lst1
    }
    return result
}
```

func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}

// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}

func sumOfDigits(a: Int) -> Int {
    // Write your code here
    return 0
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}

// Write a function that returns the sum of the digits of a given number.
// Example:
// sumOfDigits(a: 123) == 6
// sumOfDigits(a: 1234) == 10
// sumOfDigits(a: 12345) == 15
func sumOfDigits(a: Int) -> Int {
    // Write your code here
    return 0
}

// Write a function that returns the sum of the digits of a given number.
// Example:
// sumOfDigits(a: 123) == 6
// sumOfDigits(a: 1234) == 10
// sumOfDigits(a: 12345) == 15
func sumOfDigits(a: Int) -> Int {
    // Write your code here
    return 0
}

// Write a function that returns the sum of the digits of a given number.
// Example:
// sumOfDigits(a: 123) == 6
// sumOfDigits(a: 1234) == 10
// sumOfDigits(a: 12345) == 15
func sumOfDigits(a: Int) -> Int {
    // Write your code here
    return 0
}

// Write a function that returns the sum of the digits of a given number.
// Example:
// sumOfDigits(a: 123) == 6
// sumOfDigits(a: 1234) == 10
// sumOfDigits(a: 12345) == 15
func sumOfDigits(a: Int) -> Int {
    // Write your code here
    return 0
}

// Write a function that returns the sum of the digits of a given number.
// Example:
// sumOfDigits(a: 123) == 6
// sumOfDigits(a: 1234) == 10
// sumOfDigits(a: 12345) == 15
func sumOfDigits(a: Int) -> Int {
    // Write your code here
    return 0
}

// Write a function that returns the sum of the digits of a given number.
// Example:
// sumOfDigits(a: 123) == 6
// sumOfDigits(a: 1234) == 10
// sumOfDigits(a: 12345) == 15
func sumOfDigits(a: Int) -> Int {
    // Write your code here
    return 0
}

// Write a function that returns the sum of the digits of a given number.
// Example:
// sumOfDigits(a: 123) == 6
// sumOfDigits(a: 1234) == 10
// sumOfDigits(a: 12345) == 15
func sumOfDigits(a: Int) -> Int {
    // Write your code here
    return 0
}

// Write a function that returns the sum of the digits of a given number.
// Example:
// sumOfDigits(a: 123) == 6
// sumOfDigits(a: 1234) == 10
// sumOfDigits(a: 12345) == 15
func sumOfDigits(a: Int) -> Int {
    // Write your code here
    return 0
}

// Write a function that returns the sum of the digits of a given number.
// Example:
// sumOfDigits(a: 123) == 6
// sumOfDigits(a: 1234) == 10
// sumOfDigits(a: 12345) == 15
func sumOfDigits(a: Int) -> Int {
    // Write your code here
    return 0
}

// Write a function that returns the sum of the digits of a given number.
// Example:
// sumOfDigits(a: 123) == 6
// sumOfDigits(a: 1234) == 1
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
}
```
} // missing return in global function expected to return 'Bool'

func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return true
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return true
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    guard a < 100 else { return false }
    var primeFactors = [Int]()
    for i in 2...a {
        if a % i == 0 {
            primeFactors.append(i)
        }
    }
    return primeFactors.count == 3
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    guard a < 100 else { return false }
    var primeFactors = [Int]()
    for i in 2...a {
        if a % i == 0 {
            primeFactors.append(i)
        }
    }
    return primeFactors.count == 3
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    return x == n ** Int(log(Double(x)) / log(Double(n)))
}
```swift
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// isSimplePower(x: 1, n: 4) == true
// isSimplePower(x: 2, n: 2) == true
// isSimplePower(x: 8, n: 2) == true
// isSimplePower(x: 3, n: 2) == false
// isSimplePower(x: 3, n: 1) == false
// isSimplePower(x: 5, n: 3) == false
func isSimplePower(x: Int, n: Int) -> Bool {
    return x == n ** Int(log(Double(x)) / log(Double(n)))
}
```
return x == n ** Int(log(Double(x)) / log(Double(n))) // no operator '**' is defined; did you mean 'pow(_:_:)'?

func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(pow(Double(n), Double(log2(Double(x)) / log2(Double(n)))) + 0.5) == x
}
```swift
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// isSimplePower(x: 1, n: 4) == true
// isSimplePower(x: 2, n: 2) == true
// isSimplePower(x: 8, n: 2) == true
// isSimplePower(x: 3, n: 2) == false
// isSimplePower(x: 3, n: 1) == false
// isSimplePower(x: 5, n: 3) == false
func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(pow(Double(n), Double(log2(Double(x)) / log2(Double(n)))) + 0.5) == x
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    return x == Int(pow(Double(n), Double(Int(log(Double(x)) / log(Double(n))))))
}
```swift
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// isSimplePower(x: 1, n: 4) == true
// isSimplePower(x: 2, n: 2) == true
// isSimplePower(x: 8, n: 2) == true
// isSimplePower(x: 3, n: 2) == false
// isSimplePower(x: 3, n: 1) == false
// isSimplePower(x: 5, n: 3) == false
func isSimplePower(x: Int, n: Int) -> Bool {
    return x == Int(pow(Double(n), Double(Int(log(Double(x)) / log(Double(n))))))
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(log10(Double(x)) / log10(Double(n))) == Int(log10(Double(x)) / log10(Double(n)))
}
```swift
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// isSimplePower(x: 1, n: 4) == true
// isSimplePower(x: 2, n: 2) == true
// isSimplePower(x: 8, n: 2) == true
// isSimplePower(x: 3, n: 2) == false
// isSimplePower(x: 3, n: 1) == false
// isSimplePower(x: 5, n: 3) == false
func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(log10(Double(x)) / log10(Double(n))) == Int(log10(Double(x)) / log10(Double(n)))
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(log10(Double(x)) / log10(Double(n))) == Int(log10(Double(x)) / log10(Double(n)))
}
```swift
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// isSimplePower(x: 1, n: 4) == true
// isSimplePower(x: 2, n: 2) == true
// isSimplePower(x: 8, n: 2) == true
// isSimplePower(x: 3, n: 2) == false
// isSimplePower(x: 3, n: 1) == false
// isSimplePower(x: 5, n: 3) == false
func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(log10(Double(x)) / log10(Double(n))) == Int(log10(Double(x)) / log10(Double(n)))
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(log10(Double(x)) / log10(Double(n))) == Int(log10(Double(x)) / log10(Double(n)))
}
```swift
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// isSimplePower(x: 1, n: 4) == true
// isSimplePower(x: 2, n: 2) == true
// isSimplePower(x: 8, n: 2) == true
// isSimplePower(x: 3, n: 2) == false
// isSimplePower(x: 3, n: 1) == false
// isSimplePower(x: 5, n: 3) == false
func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(log10(Double(x)) / log10(Double(n))) == Int(log10(Double(x)) / log10(Double(n)))
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(log10(Double(x))) == Int(log10(Double(n)))
}
```swift
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// isSimplePower(x: 1, n: 4) == true
// isSimplePower(x: 2, n: 2) == true
// isSimplePower(x: 8, n: 2) == true
// isSimplePower(x: 3, n: 2) == false
// isSimplePower(x: 3, n: 1) == false
// isSimplePower(x: 5, n: 3) == false
func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(log10(Double(x))) == Int(log10(Double(n)))
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(log10(Double(x))) == Int(log10(Double(n)))
}
```swift
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// isSimplePower(x: 1, n: 4) == true
// isSimplePower(x: 2, n: 2) == true
// isSimplePower(x: 8, n: 2) == true
// isSimplePower(x: 3, n: 2) == false
// isSimplePower(x: 3, n: 1) == false
// isSimplePower(x: 5, n: 3) == false
func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(log10(Double(x))) == Int(log10(Double(n)))
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(log10(Double(x))) == Int(log10(Double(n)))
}
```swift
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// isSimplePower(x: 1, n: 4) == true
// isSimplePower(x: 2, n: 2) == true
// isSimplePower(x: 8, n: 2) == true
// isSimplePower(x: 3, n: 2) == false
// isSimplePower(x: 3, n: 1) == false
// isSimplePower(x: 5, n: 3) == false
func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(log10(Double(x))) == Int(log10(Double(n)))
}
```
 // XCTAssertTrue failed

func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(pow(Double(n), Double(log2(Double(x)) / log2(Double(n)))) + 0.5) == x
}
```swift
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// isSimplePower(x: 1, n: 4) == true
// isSimplePower(x: 2, n: 2) == true
// isSimplePower(x: 8, n: 2) == true
// isSimplePower(x: 3, n: 2) == false
// isSimplePower(x: 3, n: 1) == false
// isSimplePower(x: 5, n: 3) == false
func isSimplePower(x: Int, n: Int) -> Bool {
    return Int(pow(Double(n), Double(log2(Double(x)) / log2(Double(n)))) + 0.5) == x
}
```
 // XCTAssertTrue failed

func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b -= c * c
    }
    return c * c * c == a
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b -= c * c
    }
    return c * c * c == a
}

iscube(a: 1) // true
iscube(a: 2) // false
iscube(a: -1) // true
iscube(a: 64) // true
iscube(a: 0) // true
iscube(a: 180) // false
```
 // XCTAssertTrue failed

func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b -= c * c
    }
    return c * c * c == a
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b -= c * c
    }
    return c * c * c == a
}
```
 // XCTAssertTrue failed

func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b -= c * c
    }
    return c * c * c == a
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b -= c * c
    }
    return c * c * c == a
}
```
 // XCTAssertTrue failed

func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b -= c * c
    }
    return c * c * c == a
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b -= c * c
    }
    return c * c * c == a
}
```
 // XCTAssertTrue failed

func iscube(a: Int) -> Bool {
    let b = Int(sqrt(Double(a)))
    return b * b * b == a
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    let b = Int(sqrt(Double(a)))
    return b * b * b == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b = b / c
    }
    return c * c * c == a
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b = b / c
    }
    return c * c * c == a
}
```
 // XCTAssertTrue failed

func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b /= c
    }
    return c * c * c == a
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b /= c
    }
    return c * c * c == a
}
```
 // XCTAssertTrue failed

func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b /= c
    }
    return c * c * c == a
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    var b = a
    var c = 0
    while b > 0 {
        c += 1
        b /= c
    }
    return c * c * c == a
}
```
 // XCTAssertTrue failed

func iscube(a: Int) -> Bool {
    let b = Int(sqrt(Double(a)))
    return b * b * b == a
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    let b = Int(sqrt(Double(a)))
    return b * b * b == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func iscube(a: Int) -> Bool {
    let b = Int(sqrt(Double(a)))
    return b * b * b == a
}
```swift
// Write a function that takes an integer a and returns true 
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(a: 1) == true
// iscube(a: 2) == false
// iscube(a: -1) == true
// iscube(a: 64) == true
// iscube(a: 0) == true
// iscube(a: 180) == false
func iscube(a: Int) -> Bool {
    let b = Int(sqrt(Double(a)))
    return b * b * b == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func hexKey(num: String) -> Int {
    // Write your code here
}
```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func hexKey(num: String) -> Int {
    // return the number of hexadecimal digits that are primes
}
```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    // return the number of hexadecimal digits that are primes
}
```
} // missing return in global function expected to return 'Int'

func hexKey(num: String) -> Int {
    let hexDigits = "0123456789ABCDEF"
    let hexSet = Set(hexDigits)
    var result = 0
    for digit in num {
        if hexSet.contains(digit) {
            result += 1
        }
    }
    return result
}
```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    let hexDigits = "0123456789ABCDEF"
    let hexSet = Set(hexDigits)
    var result = 0
    for digit in num {
        if hexSet.contains(digit) {
            result += 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func hexKey(num: String) -> Int {
    // Write your code here
}
```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func hexKey(num: String) -> Int {
    // Write your code here
}
```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func hexKey(num: String) -> Int {
    // write your code here
}
```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    // write your code here
}
```
} // missing return in global function expected to return 'Int'

func hexKey(num: String) -> Int {
    // Write your code here
}
```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func hexKey(num: String) -> Int {
    var result = 0
    let hexDigits = "0123456789ABCDEF"
    for digit in num {
        guard let index = hexDigits.firstIndex(of: digit) else {
            continue
        }
        let hexDigit = hexDigits[index]
        let hexDigitValue = Int(hexDigit, radix: 16)!
        if hexDigitValue == 2 || hexDigitValue == 3 || hexDigitValue == 5 || hexDigitValue == 7 || hexDigitValue == 11 || hexDigitValue == 13 {
            result += 1
        }
    }
    return result
}
```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    var result = 0
    let hexDigits = "0123456789ABCDEF"
    for digit in num {
        guard let index = hexDigits.firstIndex(of: digit) else {
            continue
        }
        let hexDigit = hexDigits[index]
        let hexDigitValue = Int(hexDigit, radix: 16)!
        if hexDigitValue == 2 || hexDigitValue == 3 || hexDigitValue == 5 || hexDigitValue == 7 || hexDigitValue == 11 || hexDigitValue == 13 {
            result += 1
        }
    }
    return result
}
```
let hexDigitValue = Int(hexDigit, radix: 16)! // initializer 'init(_:radix:)' requires that 'Character' conform to 'StringProtocol'

func hexKey(num: String) -> Int {
    var hexKey = 0
    let hexDigits = "0123456789ABCDEF"
    for digit in num {
        if let index = hexDigits.firstIndex(of: digit) {
            let hexDigit = hexDigits[index]
            if hexDigit == "2" || hexDigit == "3" || hexDigit == "5" || hexDigit == "7" || hexDigit == "B" || hexDigit == "D" {
                hexKey += 1
            }
        }
    }
    return hexKey
}
```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    var hexKey = 0
    let hexDigits = "0123456789ABCDEF"
    for digit in num {
        if let index = hexDigits.firstIndex(of: digit) {
            let hexDigit = hexDigits[index]
            if hexDigit == "2" || hexDigit == "3" || hexDigit == "5" || hexDigit == "7" || hexDigit == "B" || hexDigit == "D" {
                hexKey += 1
            }
        }
    }
    return hexKey
}
```

```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    let hexDigits = "0123456789ABCDEF"
    let hexDigitsArray = Array(hexDigits)
    let hexDigitsSet = Set(hexDigitsArray)
    let hexDigitsCount = hexDigitsArray.count
    let hexDigitsSetCount = hexDigitsSet.count
    let hexDigitsSetArray = Array(hexDigitsSet)
    let hexDigitsSetArrayCount = hexDigitsSetArray.count
    var hexDigitsSetArrayIndex = 0
    var hexDigitsSetArrayIndexCount = 0
    var hexDigitsSetArrayIndexCountCount = 0
    var hexDigitsSetArrayIndexCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var hexDigitsSetArrayIndexCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount
XCTAssertTrue(hexKey(num: "AB") == 1) // cannot find 'hexKey' in scope
XCTAssertTrue(hexKey(num: "1077E") == 2) // cannot find 'hexKey' in scope
XCTAssertTrue(hexKey(num: "ABED1A33") == 4) // cannot find 'hexKey' in scope
XCTAssertTrue(hexKey(num: "2020") == 2) // cannot find 'hexKey' in scope
XCTAssertTrue(hexKey(num: "123456789ABCDEF0") == 6) // cannot find 'hexKey' in scope
XCTAssertTrue(hexKey(num: "112233445566778899AABBCCDDEEFF00") == 12) // cannot find 'hexKey' in scope

func decimalToBinary(decimal: Int) -> String {
    // TODO: Return a string with the binary representation of the decimal number
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    // TODO: Return a string with the binary representation of the decimal number
}
```
} // missing return in global function expected to return 'String'

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = "\(decimal % 2)" + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = "\(decimal % 2)" + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = "\(decimal % 2)" + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = "\(decimal % 2)" + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    var binaryString = ""
    var decimalNumber = decimal
    while decimalNumber > 0 {
        binaryString = "\(decimalNumber % 2)" + binaryString
        decimalNumber /= 2
    }
    return "db" + binaryString + "db"
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    var binaryString = ""
    var decimalNumber = decimal
    while decimalNumber > 0 {
        binaryString = "\(decimalNumber % 2)" + binaryString
        decimalNumber /= 2
    }
    return "db" + binaryString + "db"
}
```
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = "\(decimal % 2)" + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = "\(decimal % 2)" + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    // TODO: Implement this function
    return ""
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    // TODO: Implement this function
    return ""
}
```
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    // Return the result of calling binaryString(for: decimal)
    return binaryString(for: decimal)
}

private func binaryString(for decimal: Int) -> String {
    // Declare a variable called binaryString and initialize it with an empty string
    var binaryString = ""
    
    // Declare a variable called remainder and initialize it with decimal
    var remainder = decimal
    
    // While remainder is greater than 0
    while remainder > 0 {
        // Declare a variable called quotient and initialize it with remainder divided by 2
        let quotient = remainder / 2
        
        // Declare a variable called remainder and initialize it with remainder modulo 2
        remainder = remainder % 2
        
        // Append the quotient to binaryString
        binaryString.append(String(quotient))
    }
    
    // Return binaryString
    return binaryString
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    // Return the result of calling binaryString(for: decimal)
    return binaryString(for: decimal)
}

// MARK: - Helper
private func binaryString(for decimal: Int) -> String {
    // Declare a variable called binaryString and initialize it with an empty string
    var binaryString = ""
    
    // Declare a variable called remainder and initialize it with decimal
    var remainder = decimal
    
    // While remainder is greater than 0
    while remainder > 0 {
        // Declare a variable called quotient and initialize it with remainder divided by 2
        let quotient = remainder / 2
        
        // Declare a variable called remainder and initialize it with remainder modulo 2
        remainder = remainder % 2
        
        // Append the quotient to binaryString
        binaryString.append(String(quotient))
    }
    
    // Return binaryString
    return binaryString
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var i = 0
    var j = 1
    var k = 2
    while k < s.count {
        if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] {
            return false
        }
        i += 1
        j += 1
        k += 1
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var i = 0
    var j = 1
    var k = 2
    while k < s.count {
        if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] {
            return false
        }
        i += 1
        j += 1
        k += 1
    }
    return true
}
```
if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let s = Array(s)
    var i = 0
    while i < s.count - 2 {
        if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] {
            return false
        }
        i += 3
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let s = Array(s)
    var i = 0
    while i < s.count - 2 {
        if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] {
            return false
        }
        i += 3
    }
    return true
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let s = Array(s)
    var i = 0
    while i < s.count - 2 {
        if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] {
            return false
        }
        i += 3
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let s = Array(s)
    var i = 0
    while i < s.count - 2 {
        if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] {
            return false
        }
        i += 3
    }
    return true
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var i = 0
    var j = 1
    var k = 2
    while k < s.count {
        if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] {
            return false
        }
        i += 1
        j += 1
        k += 1
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var i = 0
    var j = 1
    var k = 2
    while k < s.count {
        if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] {
            return false
        }
        i += 1
        j += 1
        k += 1
    }
    return true
}
```
if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[j] || s[i] == s[k] || s[j] == s[k] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let sArray = Array(s)
    var i = 0
    while i < sArray.count - 2 {
        if sArray[i] == sArray[i + 1] || sArray[i] == sArray[i + 2] {
            return false
        }
        i += 3
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let sArray = Array(s)
    var i = 0
    while i < sArray.count - 2 {
        if sArray[i] == sArray[i + 1] || sArray[i] == sArray[i + 2] {
            return false
        }
        i += 3
    }
    return true
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let sArray = Array(s)
    for i in stride(from: 0, to: sArray.count - 2, by: 3) {
        if sArray[i] == sArray[i + 1] || sArray[i] == sArray[i + 2] || sArray[i + 1] == sArray[i + 2] {
            return false
        }
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let sArray = Array(s)
    for i in stride(from: 0, to: sArray.count - 2, by: 3) {
        if sArray[i] == sArray[i + 1] || sArray[i] == sArray[i + 2] || sArray[i + 1] == sArray[i + 2] {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let sArray = Array(s)
    var i = 0
    while i < sArray.count {
        if sArray[i] == sArray[i + 1] || sArray[i] == sArray[i + 2] {
            return false
        }
        i += 3
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let sArray = Array(s)
    var i = 0
    while i < sArray.count {
        if sArray[i] == sArray[i + 1] || sArray[i] == sArray[i + 2] {
            return false
        }
        i += 3
    }
    return true
}
```
 // Fatal error: Index out of range

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let sArray = Array(s)
    for i in stride(from: 0, to: sArray.count - 2, by: 3) {
        if sArray[i] == sArray[i + 1] || sArray[i] == sArray[i + 2] || sArray[i + 1] == sArray[i + 2] {
            return false
        }
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let sArray = Array(s)
    for i in stride(from: 0, to: sArray.count - 2, by: 3) {
        if sArray[i] == sArray[i + 1] || sArray[i] == sArray[i + 2] || sArray[i + 1] == sArray[i + 2] {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var s = s
    var i = 0
    while i < s.count - 2 {
        if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] {
            return false
        }
        i += 3
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var s = s
    var i = 0
    while i < s.count - 2 {
        if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] {
            return false
        }
        i += 3
    }
    return true
}
```
var s = s // variable 's' was never mutated; consider changing to 'let' constant
if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var s = s
    var i = 0
    while i < s.count - 2 {
        if s[i] == s[i + 1] || s[i + 1] == s[i + 2] || s[i] == s[i + 2] {
            return false
        }
        i += 3
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var s = s
    var i = 0
    while i < s.count - 2 {
        if s[i] == s[i + 1] || s[i + 1] == s[i + 2] || s[i] == s[i + 2] {
            return false
        }
        i += 3
    }
    return true
}
```
var s = s // variable 's' was never mutated; consider changing to 'let' constant
if s[i] == s[i + 1] || s[i + 1] == s[i + 2] || s[i] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i + 1] == s[i + 2] || s[i] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i + 1] == s[i + 2] || s[i] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i + 1] == s[i + 2] || s[i] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i + 1] == s[i + 2] || s[i] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] == s[i + 1] || s[i + 1] == s[i + 2] || s[i] == s[i + 2] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func primeLength(string: String) -> Bool {
    // Write your code here
    return true
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    // Write your code here
    return true
}
```
 // XCTAssertTrue failed

func primeLength(string: String) -> Bool {
    return true
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    return true
}
```
 // XCTAssertTrue failed

```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    let length = string.count
    if length == 1 {
        return false
    }
    if length == 2 {
        return true
    }
    if length == 3 {
        return true
    }
    if length == 4 {
        return false
    }
    if length == 5 {
        return true
    }
    if length == 6 {
        return false
    }
    if length == 7 {
        return true
    }
    if length == 8 {
        return false
    }
    if length == 9 {
        return false
    }
    if length == 10 {
        return false
    }
    if length == 11 {
        return true
    }
    if length == 12 {
        return false
    }
    if length == 13 {
        return true
    }
    if length == 14 {
        return false
    }
    if length == 15 {
        return false
    }
    if length == 16 {
        return false
    }
    if length == 17 {
        return true
    }
    if length == 18 {
        return false
    }
    if length == 19 {
        return false
    }
    if length == 20 {
        return false
    }
    if length == 21 {
        return false
    }
    if length == 22 {
        return false
    }
    if length == 23 {
        return true
    }
    if length == 24 {
        return false
    }
    if length == 25 {
        return false
    }
    if length == 26 {
        return false
    }
    if length == 27 {
        return true
    }
    if length == 28 {
        return false
    }
    if length == 29 {
        return false
    }
    if length == 30 {
        return false
    }
    if length == 31 {
        return false
    }
    if length == 32 {
        return false
    }
    if length == 33 {
        return true
    }
    if length == 34 {
        return false
    }
    if length == 35 {
        return false
    }
    if length == 36 {
        return false
    }
    if length == 37 {
        return true
    }
    if length == 38 {
        return false
    }
    if length == 39 {
        return false
    }
    if length == 40 {
        return false
    }
    if length == 41 {
        return false
    }
    if length == 42 {
        return false
    }
    if length == 43 {
        return true
    }
    if length == 44 {
        return false
    }
    if length == 45 {
        return false
    }
    if length == 46 {
        return false
    }
    if length == 47 {
        return true
    }
    if length == 48 {
        return false
    }
    if length == 49 {
        return false
    }
    if length == 50 {
        return false
    }
    if length == 51 {
        return false
    }
    if length == 52 {
        return false
    }
    if length == 53 {
        return true
    }
    if length == 54 {
        return false
    }
    if length == 55 {
        return false
    }
    if length == 56 {
        return false
    }
    if length == 57 {
        return true
    }
    if length == 58 {
        return false
    }
    if length == 59 {
        return false
    }
    if length == 60 {
        return false
    }
    if length == 61 {
        return false
    }
    if length == 62 {
        return false
    }
    if length == 63 {
        return true
    }
    if length == 64 {
        return false
    }
XCTAssertTrue(primeLength(string: "Hello") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "abcdcba") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "kittens") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "orange") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "wow") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "world") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "MadaM") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "Wow") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "HI") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "go") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "gogo") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "aaaaaaaaaaaaaaa") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "Madam") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "M") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "0") == false) // cannot find 'primeLength' in scope

func primeLength(string: String) -> Bool {
    // Your code here
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    // Your code here
}
```
} // missing return in global function expected to return 'Bool'

func primeLength(string: String) -> Bool {
    // Your code here
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    // Your code here
}
```
} // missing return in global function expected to return 'Bool'

```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    let length = string.count
    if length == 1 {
        return false
    }
    if length == 2 {
        return true
    }
    if length == 3 {
        return true
    }
    if length == 4 {
        return false
    }
    if length == 5 {
        return true
    }
    if length == 6 {
        return false
    }
    if length == 7 {
        return true
    }
    if length == 8 {
        return false
    }
    if length == 9 {
        return false
    }
    if length == 10 {
        return false
    }
    if length == 11 {
        return true
    }
    if length == 12 {
        return false
    }
    if length == 13 {
        return true
    }
    if length == 14 {
        return false
    }
    if length == 15 {
        return false
    }
    if length == 16 {
        return false
    }
    if length == 17 {
        return true
    }
    if length == 18 {
        return false
    }
    if length == 19 {
        return false
    }
    if length == 20 {
        return false
    }
    if length == 21 {
        return false
    }
    if length == 22 {
        return false
    }
    if length == 23 {
        return true
    }
    if length == 24 {
        return false
    }
    if length == 25 {
        return false
    }
    if length == 26 {
        return false
    }
    if length == 27 {
        return true
    }
    if length == 28 {
        return false
    }
    if length == 29 {
        return false
    }
    if length == 30 {
        return false
    }
    if length == 31 {
        return false
    }
    if length == 32 {
        return false
    }
    if length == 33 {
        return true
    }
    if length == 34 {
        return false
    }
    if length == 35 {
        return false
    }
    if length == 36 {
        return false
    }
    if length == 37 {
        return true
    }
    if length == 38 {
        return false
    }
    if length == 39 {
        return false
    }
    if length == 40 {
        return false
    }
    if length == 41 {
        return false
    }
    if length == 42 {
        return false
    }
    if length == 43 {
        return true
    }
    if length == 44 {
        return false
    }
    if length == 45 {
        return false
    }
    if length == 46 {
        return false
    }
    if length == 47 {
        return true
    }
    if length == 48 {
        return false
    }
    if length == 49 {
        return false
    }
    if length == 50 {
        return false
    }
    if length == 51 {
        return false
    }
    if length == 52 {
        return false
    }
    if length == 53 {
        return true
    }
    if length == 54 {
        return false
    }
    if length == 55 {
        return false
    }
    if length == 56 {
        return false
    }
    if length == 57 {
        return true
    }
    if length == 58 {
        return false
    }
    if length == 59 {
        return false
    }
    if length == 60 {
        return false
    }
    if length == 61 {
        return false
    }
    if length == 62 {
        return true
    }
    if length == 63 {
        return false
    }
    if length == 64 {
        return false
    }
XCTAssertTrue(primeLength(string: "Hello") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "abcdcba") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "kittens") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "orange") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "wow") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "world") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "MadaM") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "Wow") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "HI") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "go") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "gogo") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "aaaaaaaaaaaaaaa") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "Madam") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "M") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "0") == false) // cannot find 'primeLength' in scope

func primeLength(string: String) -> Bool {
    return true
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    return true
}
```
 // XCTAssertTrue failed

func primeLength(string: String) -> Bool {
    // Write your code here
    return true
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    // Write your code here
    return true
}
```
 // XCTAssertTrue failed

```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    let length = string.count
    if length == 1 {
        return false
    }
    if length == 2 {
        return true
    }
    if length == 3 {
        return true
    }
    if length == 4 {
        return false
    }
    if length == 5 {
        return true
    }
    if length == 6 {
        return false
    }
    if length == 7 {
        return true
    }
    if length == 8 {
        return false
    }
    if length == 9 {
        return false
    }
    if length == 10 {
        return false
    }
    if length == 11 {
        return true
    }
    if length == 12 {
        return false
    }
    if length == 13 {
        return true
    }
    if length == 14 {
        return false
    }
    if length == 15 {
        return false
    }
    if length == 16 {
        return false
    }
    if length == 17 {
        return true
    }
    if length == 18 {
        return false
    }
    if length == 19 {
        return false
    }
    if length == 20 {
        return false
    }
    if length == 21 {
        return false
    }
    if length == 22 {
        return false
    }
    if length == 23 {
        return true
    }
    if length == 24 {
        return false
    }
    if length == 25 {
        return false
    }
    if length == 26 {
        return false
    }
    if length == 27 {
        return true
    }
    if length == 28 {
        return false
    }
    if length == 29 {
        return false
    }
    if length == 30 {
        return false
    }
    if length == 31 {
        return false
    }
    if length == 32 {
        return false
    }
    if length == 33 {
        return true
    }
    if length == 34 {
        return false
    }
    if length == 35 {
        return false
    }
    if length == 36 {
        return false
    }
    if length == 37 {
        return true
    }
    if length == 38 {
        return false
    }
    if length == 39 {
        return false
    }
    if length == 40 {
        return false
    }
    if length == 41 {
        return false
    }
    if length == 42 {
        return false
    }
    if length == 43 {
        return true
    }
    if length == 44 {
        return false
    }
    if length == 45 {
        return false
    }
    if length == 46 {
        return false
    }
    if length == 47 {
        return true
    }
    if length == 48 {
        return false
    }
    if length == 49 {
        return false
    }
    if length == 50 {
        return false
    }
    if length == 51 {
        return false
    }
    if length == 52 {
        return false
    }
    if length == 53 {
        return true
    }
    if length == 54 {
        return false
    }
    if length == 55 {
        return false
    }
    if length == 56 {
        return false
    }
    if length == 57 {
        return true
    }
    if length == 58 {
        return false
    }
    if length == 59 {
        return false
    }
    if length == 60 {
        return false
    }
    if length == 61 {
        return false
    }
    if length == 62 {
        return true
    }
    if length == 63 {
        return false
    }
    if length == 64 {
        return false
    }
XCTAssertTrue(primeLength(string: "Hello") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "abcdcba") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "kittens") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "orange") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "wow") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "world") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "MadaM") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "Wow") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "HI") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "go") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "gogo") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "aaaaaaaaaaaaaaa") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "Madam") == true) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "M") == false) // cannot find 'primeLength' in scope
XCTAssertTrue(primeLength(string: "0") == false) // cannot find 'primeLength' in scope

func primeLength(string: String) -> Bool {
    let length = string.count
    if length == 1 {
        return false
    }
    var prime = true
    for i in 2...length {
        if length % i == 0 {
            prime = false
        }
    }
    return prime
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    let length = string.count
    if length == 1 {
        return false
    }
    var prime = true
    for i in 2...length {
        if length % i == 0 {
            prime = false
        }
    }
    return prime
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    let start = 10 ** (n - 1)
    let end = 10 ** n - 1
    return start + end
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    let start = 10 ** (n - 1)
    let end = 10 ** n - 1
    return start + end
}
```
let start = 10 ** (n - 1) // no operator '**' is defined; did you mean 'pow(_:_:)'?
let end = 10 ** n - 1 // no operator '**' is defined; did you mean 'pow(_:_:)'?
return start + end // cannot convert return expression of type 'String' to return type 'Int'

func startsOneEnds(n: Int) -> Int {
    let max = Int(pow(10.0, Double(n))) - 1
    let min = 10 ** (n - 1)
    return (max - min) / 9
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    let max = Int(pow(10.0, Double(n))) - 1
    let min = 10 ** (n - 1)
    return (max - min) / 9
}
```
let min = 10 ** (n - 1) // no operator '**' is defined; did you mean 'pow(_:_:)'?

func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        let start = String(repeating: "1", count: i)
        let end = String(repeating: "1", count: n - i)
        count += Int(start)! + Int(end)!
    }
    return count
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        let start = String(repeating: "1", count: i)
        let end = String(repeating: "1", count: n - i)
        count += Int(start)! + Int(end)!
    }
    return count
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func startsOneEnds(n: Int) -> Int {
    let max = Int(pow(10.0, Double(n)))
    var count = 0
    for i in 1...max {
        let str = String(i)
        if str.hasPrefix("1") || str.hasSuffix("1") {
            count += 1
        }
    }
    return count
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    let max = Int(pow(10.0, Double(n)))
    var count = 0
    for i in 1...max {
        let str = String(i)
        if str.hasPrefix("1") || str.hasSuffix("1") {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += Int(pow(10, Double(i - 1)))
    }
    return count
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += Int(pow(10, Double(i - 1)))
    }
    return count
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    let max = Int(pow(Double(10), Double(n)))
    let min = Int(pow(Double(10), Double(n - 1)))
    var count = 0
    for i in min...max {
        if i / 10 == 1 || i % 10 == 1 {
            count += 1
        }
    }
    return count
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    let max = Int(pow(Double(10), Double(n)))
    let min = Int(pow(Double(10), Double(n - 1)))
    var count = 0
    for i in min...max {
        if i / 10 == 1 || i % 10 == 1 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += Int(pow(10, Double(i - 1)))
    }
    return count
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += Int(pow(10, Double(i - 1)))
    }
    return count
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    let max = Int(pow(Double(10), Double(n)))
    let min = Int(pow(Double(10), Double(n - 1)))
    var count = 0
    for i in min...max {
        if i / 10 == 1 || i % 10 == 1 {
            count += 1
        }
    }
    return count
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    let max = Int(pow(Double(10), Double(n)))
    let min = Int(pow(Double(10), Double(n - 1)))
    var count = 0
    for i in min...max {
        if i / 10 == 1 || i % 10 == 1 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
  var count = 0
  for i in 1...n {
    count += Int(pow(10, Double(i - 1)))
  }
  return count
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
  var count = 0
  for i in 1...n {
    count += Int(pow(10, Double(i - 1)))
  }
  return count
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
  let max = Int(pow(Double(10), Double(n)))
  var count = 0
  for i in 1...max {
    let str = String(i)
    if str.hasPrefix("1") || str.hasSuffix("1") {
      count += 1
    }
  }
  return count
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
  let max = Int(pow(Double(10), Double(n)))
  var count = 0
  for i in 1...max {
    let str = String(i)
    if str.hasPrefix("1") || str.hasSuffix("1") {
      count += 1
    }
  }
  return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
  let max = Int(pow(Double(10), Double(n)))
  var count = 0
  for i in 1...max {
    let str = String(i)
    if str.hasPrefix("1") || str.hasSuffix("1") {
      count += 1
    }
  }
  return count
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var result = ""
    var number = N
    while number > 0 {
        let remainder = number % 2
        result = String(remainder) + result
        number /= 2
    }
    return result
}
```swift
// Given a positive integer N, return the total sum of its digits in binary.
// Example
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
// solve(N: 1000) == "1"
// solve(N: 150) == "110"
// solve(N: 147) == "1100"
func solve(N: Int) -> String {
    var result = ""
    var number = N
    while number > 0 {
        let remainder = number % 2
        result = String(remainder) + result
        number /= 2
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var binary = ""
    var remainder = N
    while remainder > 0 {
        binary = "\(remainder % 2)" + binary
        remainder /= 2
    }
    return binary
}
```swift
// Given a positive integer N, return the total sum of its digits in binary.
// Example
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
// solve(N: 1000) == "1"
// solve(N: 150) == "110"
// solve(N: 147) == "1100"
func solve(N: Int) -> String {
    var binary = ""
    var remainder = N
    while remainder > 0 {
        binary = "\(remainder % 2)" + binary
        remainder /= 2
    }
    return binary
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var binary = ""
    var number = N
    while number > 0 {
        let remainder = number % 2
        binary = "\(remainder)" + binary
        number = number / 2
    }
    return binary
}
```swift
// Given a positive integer N, return the total sum of its digits in binary.
// Example
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
// solve(N: 1000) == "1"
// solve(N: 150) == "110"
// solve(N: 147) == "1100"
func solve(N: Int) -> String {
    var binary = ""
    var number = N
    while number > 0 {
        let remainder = number % 2
        binary = "\(remainder)" + binary
        number = number / 2
    }
    return binary
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var binary = ""
    var number = N
    while number > 0 {
        binary = String(number % 2) + binary
        number /= 2
    }
    return binary
}
```swift
// Given a positive integer N, return the total sum of its digits in binary.
// Example
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
// solve(N: 1000) == "1"
// solve(N: 150) == "110"
// solve(N: 147) == "1100"
func solve(N: Int) -> String {
    var binary = ""
    var number = N
    while number > 0 {
        binary = String(number % 2) + binary
        number /= 2
    }
    return binary
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var result = ""
    var number = N
    while number > 0 {
        let remainder = number % 2
        result += String(remainder)
        number /= 2
    }
    return result
}
```swift
// Given a positive integer N, return the total sum of its digits in binary.
// Example
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
// solve(N: 1000) == "1"
// solve(N: 150) == "110"
// solve(N: 147) == "1100"
func solve(N: Int) -> String {
    var result = ""
    var number = N
    while number > 0 {
        let remainder = number % 2
        result += String(remainder)
        number /= 2
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var result = ""
    var number = N
    while number > 0 {
        let remainder = number % 2
        result = String(remainder) + result
        number = number / 2
    }
    return result
}
```swift
// Given a positive integer N, return the total sum of its digits in binary.
// Example
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
// solve(N: 1000) == "1"
// solve(N: 150) == "110"
// solve(N: 147) == "1100"
func solve(N: Int) -> String {
    var result = ""
    var number = N
    while number > 0 {
        let remainder = number % 2
        result = String(remainder) + result
        number = number / 2
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var result = ""
    var number = N
    while number > 0 {
        let digit = number % 2
        result = String(digit) + result
        number /= 2
    }
    return result
}
```swift
// Given a positive integer N, return the total sum of its digits in binary.
// Example
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
// solve(N: 1000) == "1"
// solve(N: 150) == "110"
// solve(N: 147) == "1100"
func solve(N: Int) -> String {
    var result = ""
    var number = N
    while number > 0 {
        let digit = number % 2
        result = String(digit) + result
        number /= 2
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var binary = ""
    var number = N
    while number > 0 {
        binary = String(number % 2) + binary
        number /= 2
    }
    return binary
}
```swift
// Given a positive integer N, return the total sum of its digits in binary.
// Example
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
// solve(N: 1000) == "1"
// solve(N: 150) == "110"
// solve(N: 147) == "1100"
func solve(N: Int) -> String {
    var binary = ""
    var number = N
    while number > 0 {
        binary = String(number % 2) + binary
        number /= 2
    }
    return binary
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var result = ""
    var number = N
    while number > 0 {
        let digit = number % 2
        number = number / 2
        result = String(digit) + result
    }
    return result
}
```swift
// Given a positive integer N, return the total sum of its digits in binary.
// Example
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
// solve(N: 1000) == "1"
// solve(N: 150) == "110"
// solve(N: 147) == "1100"
func solve(N: Int) -> String {
    var result = ""
    var number = N
    while number > 0 {
        let digit = number % 2
        number = number / 2
        result = String(digit) + result
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var binary = ""
    var remainder = N
    while remainder > 0 {
        binary = String(remainder % 2) + binary
        remainder /= 2
    }
    return binary
}
```swift
// Given a positive integer N, return the total sum of its digits in binary.
// Example
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
// solve(N: 1000) == "1"
// solve(N: 150) == "110"
// solve(N: 147) == "1100"
func solve(N: Int) -> String {
    var binary = ""
    var remainder = N
    while remainder > 0 {
        binary = String(remainder % 2) + binary
        remainder /= 2
    }
    return binary
}
```
 // XCTAssertTrue failed

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 != 0 {
            sum += value
        }
    }
    return sum
}

func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 != 0 }.map { $0.element }.reduce(0, +)
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 != 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 != 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 != 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 != 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 != 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 != 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 != 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 != 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 != 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 != 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $
func add(lst: [Int]) -> Int { // invalid redeclaration of 'add(lst:)'

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 0 && element % 2 == 0 {
            sum += element
        }
    }
    return sum
}

func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 == 0 }.map { $0.element }.reduce(0, +)
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 0 && element % 2 == 0 {
            sum += element
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 == 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 == 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 == 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 == 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 == 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 == 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 == 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 == 0 }.map { $0.element }.reduce(0, +)
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset %
func add(lst: [Int]) -> Int { // invalid redeclaration of 'add(lst:)'

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```
 // XCTAssertTrue failed

func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 1 {
            sum += lst[i]
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 1 {
            sum += lst[i]
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 1 {
            sum += lst[i]
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 1 {
            sum += lst[i]
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 1 {
            sum += lst[i]
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 1 {
            sum += lst[i]
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 1 {
            sum += lst[i]
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 1 {
            sum += lst[i]
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 1 {
            sum += lst[i]
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 1 {
            sum += lst[i]
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<
 // XCTAssertTrue failed

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 1 && element % 2 == 0 {
            sum += element
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 1 && element % 2 == 0 {
            sum += element
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 1 && element % 2 == 0 {
            sum += element
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 1 && element % 2 == 0 {
            sum += element
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 1 && element % 2 == 0 {
            sum += element
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 1 && element % 2 == 0 {
            sum += element
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 1 && element % 2 == 0 {
            sum += element
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 1 && element % 2 == 0 {
            sum += element
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 1 && element % 2 == 0 {
            sum += element
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 1 && element % 2 == 0 {
            sum += element
        }
    }
    return sum
}

// Given a

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}

// Given a
 // XCTAssertTrue failed

func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 {
            sum += lst[i]
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 {
            sum += lst[i]
        }
    }
    return sum
}
```
 // XCTAssertTrue failed

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```
 // XCTAssertTrue failed

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    var result = ""
    var words = s.components(separatedBy: " ")
    for word in words {
        var characters = Array(word)
        characters.sort(by: { $0 < $1 })
        result += String(characters)
        result += " "
    }
    return result
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    var result = ""
    var words = s.components(separatedBy: " ")
    for word in words {
        var characters = Array(word)
        characters.sort(by: { $0 < $1 })
        result += String(characters)
        result += " "
    }
    return result
}
```
var words = s.components(separatedBy: " ") // variable 'words' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        if word == "" {
            result += " "
        } else {
            let chars = Array(word)
            let sortedChars = chars.sorted(by: { $0.asciiValue < $1.asciiValue })
            result += String(sortedChars)
        }
    }
    return result
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        if word == "" {
            result += " "
        } else {
            let chars = Array(word)
            let sortedChars = chars.sorted(by: { $0.asciiValue < $1.asciiValue })
            result += String(sortedChars)
        }
    }
    return result
}
```
let sortedChars = chars.sorted(by: { $0.asciiValue < $1.asciiValue }) // value of optional type 'UInt8?' must be unwrapped to a value of type 'UInt8'
let sortedChars = chars.sorted(by: { $0.asciiValue < $1.asciiValue }) // value of optional type 'UInt8?' must be unwrapped to a value of type 'UInt8'

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        if word == "" {
            result += " "
        } else {
            let sortedWord = String(word.sorted())
            result += sortedWord
        }
    }
    return result
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        if word == "" {
            result += " "
        } else {
            let sortedWord = String(word.sorted())
            result += sortedWord
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        if word == "" {
            result += " "
        } else {
            let sortedWord = String(word.sorted())
            result += sortedWord
        }
    }
    return result
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        if word == "" {
            result += " "
        } else {
            let sortedWord = String(word.sorted())
            result += sortedWord
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        if word.isEmpty {
            result += " "
        } else {
            let sortedWord = String(word.sorted())
            result += sortedWord
        }
    }
    return result
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        if word.isEmpty {
            result += " "
        } else {
            let sortedWord = String(word.sorted())
            result += sortedWord
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        if word.isEmpty {
            result += " "
        } else {
            let sorted = word.sorted()
            result += String(sorted)
        }
    }
    return result
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        if word.isEmpty {
            result += " "
        } else {
            let sorted = word.sorted()
            result += String(sorted)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let sortedWord = String(word.sorted())
        result += sortedWord + " "
    }
    return result.trimmingCharacters(in: .whitespaces)
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let sortedWord = String(word.sorted())
        result += sortedWord + " "
    }
    return result.trimmingCharacters(in: .whitespaces)
}
```

func antiShuffle(s: String) -> String {
    var result = ""
    var words = s.components(separatedBy: " ")
    for word in words {
        var characters = Array(word)
        characters.sort(by: { $0 < $1 })
        result += String(characters)
        result += " "
    }
    return result
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    var result = ""
    var words = s.components(separatedBy: " ")
    for word in words {
        var characters = Array(word)
        characters.sort(by: { $0 < $1 })
        result += String(characters)
        result += " "
    }
    return result
}
```
var words = s.components(separatedBy: " ") // variable 'words' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let characters = Array(word)
        let sortedCharacters = characters.sorted()
        result += String(sortedCharacters) + " "
    }
    return result.trimmingCharacters(in: .whitespaces)
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let characters = Array(word)
        let sortedCharacters = characters.sorted()
        result += String(sortedCharacters) + " "
    }
    return result.trimmingCharacters(in: .whitespaces)
}
```

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        if word == "" {
            result += " "
        } else {
            let sorted = word.sorted()
            result += String(sorted)
        }
    }
    return result
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello !!!Wdlor"
func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        if word == "" {
            result += " "
        } else {
            let sorted = word.sorted()
            result += String(sorted)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (i, row) in lst.enumerated() {
        for (j, column) in row.enumerated().reversed() {
            if column == x {
                result.append((i, j))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (i, row) in lst.enumerated() {
        for (j, column) in row.enumerated().reversed() {
            if column == x {
                result.append((i, j))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        for (index2, value) in row.enumerated().reversed() {
            if value == x {
                result.append((index, index2))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        for (index2, value) in row.enumerated().reversed() {
            if value == x {
                result.append((index, index2))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (rowIndex, row) in lst.enumerated() {
        for (columnIndex, column) in row.enumerated().reversed() {
            if column == x {
                result.append((rowIndex, columnIndex))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (rowIndex, row) in lst.enumerated() {
        for (columnIndex, column) in row.enumerated().reversed() {
            if column == x {
                result.append((rowIndex, columnIndex))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (row, subArray) in lst.enumerated() {
        if let index = subArray.firstIndex(of: x) {
            result.append((row, index))
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (row, subArray) in lst.enumerated() {
        if let index = subArray.firstIndex(of: x) {
            result.append((row, index))
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if row.contains(x) {
            result.append((index, row.firstIndex(of: x)!))
        }
    }
    return result.sorted(by: { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) })
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        if row.contains(x) {
            result.append((index, row.firstIndex(of: x)!))
        }
    }
    return result.sorted(by: { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) })
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (i, row) in lst.enumerated() {
        for (j, value) in row.enumerated().reversed() {
            if value == x {
                result.append((i, j))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (i, row) in lst.enumerated() {
        for (j, value) in row.enumerated().reversed() {
            if value == x {
                result.append((i, j))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (rowIndex, row) in lst.enumerated() {
        for (columnIndex, column) in row.enumerated().reversed() {
            if column == x {
                result.append((rowIndex, columnIndex))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (rowIndex, row) in lst.enumerated() {
        for (columnIndex, column) in row.enumerated().reversed() {
            if column == x {
                result.append((rowIndex, columnIndex))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (row, rowArray) in lst.enumerated() {
        for (column, value) in rowArray.enumerated().reversed() {
            if value == x {
                result.append((row, column))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (row, rowArray) in lst.enumerated() {
        for (column, value) in rowArray.enumerated().reversed() {
            if value == x {
                result.append((row, column))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (row, rowData) in lst.enumerated() {
        for (column, value) in rowData.enumerated().reversed() {
            if value == x {
                result.append((row, column))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (row, rowData) in lst.enumerated() {
        for (column, value) in rowData.enumerated().reversed() {
            if value == x {
                result.append((row, column))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (index, row) in lst.enumerated() {
        for (index2, value) in row.enumerated().reversed() {
            if value == x {
                result.append((index, index2))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (index, row) in lst.enumerated() {
        for (index2, value) in row.enumerated().reversed() {
            if value == x {
                result.append((index, index2))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1) }
}
```

func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```

func sortArray(array: [Int]) -> [Int] {
    guard array.count > 0 else { return array }
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    guard array.count > 0 else { return array }
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```

func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```

func sortArray(array: [Int]) -> [Int] {
    guard array.count > 0 else { return [] }
    
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    
    if sum % 2 == 0 {
        return sortedArray
    } else {
        return sortedArray.reversed()
    }
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    guard array.count > 0 else { return [] }
    
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    
    if sum % 2 == 0 {
        return sortedArray
    } else {
        return sortedArray.reversed()
    }
}
```
 // XCTAssertTrue failed

func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```

func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    var sortedArray = array
    sortedArray.sort()
    let sum = sortedArray.first! + sortedArray.last!
    if sum % 2 == 0 {
        sortedArray.reverse()
    }
    return sortedArray
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    var sortedArray = array
    sortedArray.sort()
    let sum = sortedArray.first! + sortedArray.last!
    if sum % 2 == 0 {
        sortedArray.reverse()
    }
    return sortedArray
}
```

func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    
    let sum = array.first! + array.last!
    
    if sum % 2 == 0 {
        return array.sorted(by: { $0 > $1 })
    } else {
        return array.sorted(by: { $0 < $1 })
    }
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    
    let sum = array.first! + array.last!
    
    if sum % 2 == 0 {
        return array.sorted(by: { $0 > $1 })
    } else {
        return array.sorted(by: { $0 < $1 })
    }
}
```

func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```

func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    guard array.count > 1 else { return array }
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```

func sortArray(array: [Int]) -> [Int] {
    guard array.count > 0 else { return array }
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    guard array.count > 0 else { return array }
    let sum = array.first! + array.last!
    let sortedArray = array.sorted(by: { $0 < $1 })
    return sum % 2 == 0 ? sortedArray.reversed() : sortedArray
}
```

func encrypt(s: String) -> String {
    return ""
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    return ""
}
```
 // XCTAssertTrue failed

func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encrypted = ""
    for char in s {
        let index = alphabet.index(of: String(char))!
        let newIndex = index + 4
        let newChar = alphabet[newIndex]
        encrypted.append(newChar)
    }
    return encrypted
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encrypted = ""
    for char in s {
        let index = alphabet.index(of: String(char))!
        let newIndex = index + 4
        let newChar = alphabet[newIndex]
        encrypted.append(newChar)
    }
    return encrypted
}
```
let index = alphabet.index(of: String(char))! // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')

func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encrypted = ""
    for letter in s {
        if alphabet.contains(letter) {
            let index = alphabet.index(of: letter)!
            let newIndex = index + 4
            if newIndex > 25 {
                let newIndex = newIndex - 26
                encrypted += alphabet[newIndex]
            } else {
                encrypted += alphabet[newIndex]
            }
        } else {
            encrypted += letter
        }
    }
    return encrypted
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encrypted = ""
    for letter in s {
        if alphabet.contains(letter) {
            let index = alphabet.index(of: letter)!
            let newIndex = index + 4
            if newIndex > 25 {
                let newIndex = newIndex - 26
                encrypted += alphabet[newIndex]
            } else {
                encrypted += alphabet[newIndex]
            }
        } else {
            encrypted += letter
        }
    }
    return encrypted
}
```
let index = alphabet.index(of: letter)! // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
let newIndex = index + 4 // cannot convert value of type 'String.Index' to expected argument type 'Int'
encrypted += letter // cannot convert value of type 'Character' to expected argument type 'String'

func encrypt(s: String) -> String {
    var result = ""
    for c in s {
        let i = String(c).unicodeScalars.first!.value
        let newValue = (i + 2 * 2) % 26 + 97
        result += String(UnicodeScalar(newValue)!)
    }
    return result
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    var result = ""
    for c in s {
        let i = String(c).unicodeScalars.first!.value
        let newValue = (i + 2 * 2) % 26 + 97
        result += String(UnicodeScalar(newValue)!)
    }
    return result
}
```
 // XCTAssertTrue failed

func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encrypted = ""
    for c in s {
        let index = alphabet.index(of: String(c))!
        let newIndex = index + alphabet.count / 2 * 2
        encrypted.append(alphabet[newIndex % alphabet.count])
    }
    return encrypted
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encrypted = ""
    for c in s {
        let index = alphabet.index(of: String(c))!
        let newIndex = index + alphabet.count / 2 * 2
        encrypted.append(alphabet[newIndex % alphabet.count])
    }
    return encrypted
}
```
let index = alphabet.index(of: String(c))! // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')

func encrypt(s: String) -> String {
    var result = ""
    for c in s {
        let ascii = Int(c.asciiValue!)
        let newAscii = (ascii + 2 * 2) % 26 + 97
        result += Character(UnicodeScalar(newAscii))
    }
    return result
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    var result = ""
    for c in s {
        let ascii = Int(c.asciiValue!)
        let newAscii = (ascii + 2 * 2) % 26 + 97
        result += Character(UnicodeScalar(newAscii))
    }
    return result
}
```
result += Character(UnicodeScalar(newAscii)) // cannot convert value of type 'Character' to expected argument type 'String'
result += Character(UnicodeScalar(newAscii)) // value of optional type 'UnicodeScalar?' (aka 'Optional<Unicode.Scalar>') must be unwrapped to a value of type 'UnicodeScalar' (aka 'Unicode.Scalar')

func encrypt(s: String) -> String {
    var result = ""
    for c in s {
        if c >= "a" && c <= "z" {
            let index = Int(c.unicodeScalars.first!.value) - 97
            result.append(UnicodeScalar(index + 2 * 26)!)
        } else if c >= "A" && c <= "Z" {
            let index = Int(c.unicodeScalars.first!.value) - 65
            result.append(UnicodeScalar(index + 2 * 26)!)
        } else {
            result.append(c)
        }
    }
    return result
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    var result = ""
    for c in s {
        if c >= "a" && c <= "z" {
            let index = Int(c.unicodeScalars.first!.value) - 97
            result.append(UnicodeScalar(index + 2 * 26)!)
        } else if c >= "A" && c <= "Z" {
            let index = Int(c.unicodeScalars.first!.value) - 65
            result.append(UnicodeScalar(index + 2 * 26)!)
        } else {
            result.append(c)
        }
    }
    return result
}
```
result.append(UnicodeScalar(index + 2 * 26)!) // no exact matches in call to instance method 'append'
result.append(UnicodeScalar(index + 2 * 26)!) // no exact matches in call to instance method 'append'

func encrypt(s: String) -> String {
    return s.map { String(UnicodeScalar($0.unicodeScalars.first!.value + 2 * 26)!) }
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    return s.map { String(UnicodeScalar($0.unicodeScalars.first!.value + 2 * 26)!) }
}
```
return s.map { String(UnicodeScalar($0.unicodeScalars.first!.value + 2 * 26)!) } // cannot convert return expression of type '[String]' to return type 'String'

func encrypt(s: String) -> String {
    return s.map { String($0.unicodeScalars.map { $0.value + 4 }.map { UnicodeScalar($0) }) }.joined()
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    return s.map { String($0.unicodeScalars.map { $0.value + 4 }.map { UnicodeScalar($0) }) }.joined()
}
```
return s.map { String($0.unicodeScalars.map { $0.value + 4 }.map { UnicodeScalar($0) }) }.joined() // no exact matches in call to initializer

func encrypt(s: String) -> String {
    return s.map { String(UnicodeScalar(Int($0.unicodeScalars.first!.value) + 2 * 2)!) }
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    return s.map { String(UnicodeScalar(Int($0.unicodeScalars.first!.value) + 2 * 2)!) }
}
```
return s.map { String(UnicodeScalar(Int($0.unicodeScalars.first!.value) + 2 * 2)!) } // cannot convert return expression of type '[String]' to return type 'String'

func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    if sorted.count == 2 { return sorted[1] }
    return sorted[1]
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    if sorted.count == 2 { return sorted[1] }
    return sorted[1]
}
```
var sorted = lst.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var min = lst[0]
    var minIndex = 0
    for i in 1..<lst.count {
        if lst[i] < min {
            min = lst[i]
            minIndex = i
        }
    }
    var max = lst[0]
    var maxIndex = 0
    for i in 1..<lst.count {
        if lst[i] > max {
            max = lst[i]
            maxIndex = i
        }
    }
    if lst[minIndex] == max {
        return nil
    }
    return lst[minIndex]
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var min = lst[0]
    var minIndex = 0
    for i in 1..<lst.count {
        if lst[i] < min {
            min = lst[i]
            minIndex = i
        }
    }
    var max = lst[0]
    var maxIndex = 0
    for i in 1..<lst.count {
        if lst[i] > max {
            max = lst[i]
            maxIndex = i
        }
    }
    if lst[minIndex] == max {
        return nil
    }
    return lst[minIndex]
}
```
var maxIndex = 0 // variable 'maxIndex' was written to, but never read
 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    var sorted = lst.sorted()
    if sorted.count < 2 {
        return nil
    }
    return sorted[1]
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    var sorted = lst.sorted()
    if sorted.count < 2 {
        return nil
    }
    return sorted[1]
}
```
var sorted = lst.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    var i = 1
    while i < sorted.count {
        if sorted[i] != sorted[i-1] {
            return sorted[i]
        }
        i += 1
    }
    return nil
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    var i = 1
    while i < sorted.count {
        if sorted[i] != sorted[i-1] {
            return sorted[i]
        }
        i += 1
    }
    return nil
}
```
var sorted = lst.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant

func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    var index = 0
    while sorted[index] == lst[index] {
        index += 1
    }
    return sorted[index]
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    var index = 0
    while sorted[index] == lst[index] {
        index += 1
    }
    return sorted[index]
}
```
var sorted = lst.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant
 // Fatal error: Index out of range

func nextSmallest(lst: [Int]) -> Int? {
    var sorted = lst.sorted()
    if sorted.count < 2 {
        return nil
    }
    return sorted[1]
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    var sorted = lst.sorted()
    if sorted.count < 2 {
        return nil
    }
    return sorted[1]
}
```
var sorted = lst.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    for i in 0..<sorted.count - 1 {
        if sorted[i] != sorted[i + 1] {
            return sorted[i + 1]
        }
    }
    return nil
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    for i in 0..<sorted.count - 1 {
        if sorted[i] != sorted[i + 1] {
            return sorted[i + 1]
        }
    }
    return nil
}
```
var sorted = lst.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant

func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    if sorted.count == 2 {
        return sorted[1]
    }
    var index = 1
    while sorted[index] == sorted[0] {
        index += 1
        if index == sorted.count {
            return nil
        }
    }
    return sorted[index]
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    if sorted.count == 2 {
        return sorted[1]
    }
    var index = 1
    while sorted[index] == sorted[0] {
        index += 1
        if index == sorted.count {
            return nil
        }
    }
    return sorted[index]
}
```
var sorted = lst.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    if sorted.count == 2 {
        return sorted[1]
    }
    var index = 0
    while sorted[index] == sorted[0] {
        index += 1
        if index == sorted.count {
            return nil
        }
    }
    return sorted[index]
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    if sorted.count == 2 {
        return sorted[1]
    }
    var index = 0
    while sorted[index] == sorted[0] {
        index += 1
        if index == sorted.count {
            return nil
        }
    }
    return sorted[index]
}
```
var sorted = lst.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    if sorted.first == sorted.last {
        return nil
    }
    if sorted.first == lst.first {
        return sorted[1]
    }
    return sorted[1]
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var sorted = lst.sorted()
    if sorted.first == sorted.last {
        return nil
    }
    if sorted.first == lst.first {
        return sorted[1]
    }
    return sorted[1]
}
```
var sorted = lst.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant

func isBored(S: String) -> Int {
    var boredom = 0
    var sentence = ""
    for character in S {
        if character == "." || character == "?" || character == "!" {
            if sentence.hasPrefix("I") {
                boredom += 1
            }
            sentence = ""
        } else {
            sentence += String(character)
        }
    }
    return boredom
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    var boredom = 0
    var sentence = ""
    for character in S {
        if character == "." || character == "?" || character == "!" {
            if sentence.hasPrefix("I") {
                boredom += 1
            }
            sentence = ""
        } else {
            sentence += String(character)
        }
    }
    return boredom
}
```
 // XCTAssertTrue failed

```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    var boredom = 0
    var isBored = false
    var isSentence = false
    var isI = false
    var isPeriod = false
    var isQuestion = false
    var isExclamation = false
    var isSpace = false
    var isAlpha = false
    var isNumber = false
    var isAlphaNumber = false
    var isAlphaNumberSpace = false
    var isAlphaNumberSpacePeriod = false
    var isAlphaNumberSpacePeriodQuestion = false
    var isAlphaNumberSpacePeriodExclamation = false
    var isAlphaNumberSpacePeriodQuestionExclamation = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriod = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpace = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlpha = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumber = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpace = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriod = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodQuestion = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamation = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriod = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpace = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlpha = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumber = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpace = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriod = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodQuestion = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamation = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriod = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpace = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlpha = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumber = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpace = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriod = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodQuestion = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamation = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriod = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpace = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlpha = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumber = false
    var isAlphaNumberSpacePeriodQuestionExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpacePeriodExclamationPeriodSpaceAlphaNumberSpace =
XCTAssertTrue(isBored(S: "Hello world") == 0) // cannot find 'isBored' in scope
XCTAssertTrue(isBored(S: "Is the sky blue?") == 0) // cannot find 'isBored' in scope
XCTAssertTrue(isBored(S: "I love It !") == 1) // cannot find 'isBored' in scope
XCTAssertTrue(isBored(S: "bIt") == 0) // cannot find 'isBored' in scope
XCTAssertTrue(isBored(S: "I feel good today. I will be productive. will kill It") == 2) // cannot find 'isBored' in scope
XCTAssertTrue(isBored(S: "You and I are going for a walk") == 0) // cannot find 'isBored' in scope

func isBored(S: String) -> Int {
    var boredom = 0
    var sentence = ""
    var word = ""
    var isBored = false
    for character in S {
        if character == "." || character == "?" || character == "!" {
            if word == "I" {
                boredom += 1
            }
            word = ""
            sentence = ""
        } else {
            word += String(character)
            sentence += String(character)
        }
    }
    return boredom
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    var boredom = 0
    var sentence = ""
    var word = ""
    var isBored = false
    for character in S {
        if character == "." || character == "?" || character == "!" {
            if word == "I" {
                boredom += 1
            }
            word = ""
            sentence = ""
        } else {
            word += String(character)
            sentence += String(character)
        }
    }
    return boredom
}
```
var isBored = false // initialization of variable 'isBored' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var count = 0
    var sentence = ""
    for char in S {
        if char == "." || char == "?" || char == "!" {
            if sentence.hasPrefix("I") {
                count += 1
            }
            sentence = ""
        } else {
            sentence += String(char)
        }
    }
    return count
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    var count = 0
    var sentence = ""
    for char in S {
        if char == "." || char == "?" || char == "!" {
            if sentence.hasPrefix("I") {
                count += 1
            }
            sentence = ""
        } else {
            sentence += String(char)
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    let words = S.componentsSeparatedByCharactersInSet(NSCharacterSet.whitespaceCharacterSet())
    var boredom = 0
    for word in words {
        if word == "I" {
            boredom += 1
        }
    }
    return boredom
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let words = S.componentsSeparatedByCharactersInSet(NSCharacterSet.whitespaceCharacterSet())
    var boredom = 0
    for word in words {
        if word == "I" {
            boredom += 1
        }
    }
    return boredom
}
```
let words = S.componentsSeparatedByCharactersInSet(NSCharacterSet.whitespaceCharacterSet()) // cannot call value of non-function type 'CharacterSet'
let words = S.componentsSeparatedByCharactersInSet(NSCharacterSet.whitespaceCharacterSet()) // value of type 'String' has no member 'componentsSeparatedByCharactersInSet'

func isBored(S: String) -> Int {
    var boredom = 0
    var sentence = ""
    for character in S {
        if character == "." || character == "?" || character == "!" {
            if sentence.hasPrefix("I") {
                boredom += 1
            }
            sentence = ""
        } else {
            sentence += String(character)
        }
    }
    return boredom
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    var boredom = 0
    var sentence = ""
    for character in S {
        if character == "." || character == "?" || character == "!" {
            if sentence.hasPrefix("I") {
                boredom += 1
            }
            sentence = ""
        } else {
            sentence += String(character)
        }
    }
    return boredom
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var boredomCount = 0
    var isBored = false
    var sentenceStarted = false
    var sentenceEnded = false
    var sentence = ""
    for character in S {
        if character == "." || character == "?" || character == "!" {
            sentenceEnded = true
        }
        if character == " " {
            if sentenceStarted && sentenceEnded {
                if sentence.hasPrefix("I") {
                    boredomCount += 1
                }
                sentenceStarted = false
                sentenceEnded = false
                sentence = ""
            }
        } else {
            if !sentenceStarted {
                sentenceStarted = true
            }
            sentence += String(character)
        }
    }
    return boredomCount
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    var boredomCount = 0
    var isBored = false
    var sentenceStarted = false
    var sentenceEnded = false
    var sentence = ""
    for character in S {
        if character == "." || character == "?" || character == "!" {
            sentenceEnded = true
        }
        if character == " " {
            if sentenceStarted && sentenceEnded {
                if sentence.hasPrefix("I") {
                    boredomCount += 1
                }
                sentenceStarted = false
                sentenceEnded = false
                sentence = ""
            }
        } else {
            if !sentenceStarted {
                sentenceStarted = true
            }
            sentence += String(character)
        }
    }
    return boredomCount
}
```
var isBored = false // initialization of variable 'isBored' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var boredomCount = 0
    var isBored = false
    var isSentence = false
    for character in S {
        if character == "." || character == "?" || character == "!" {
            isSentence = true
        }
        if character == "I" && isSentence {
            isBored = true
        }
        if character == "." || character == "?" || character == "!" {
            if isBored {
                boredomCount += 1
            }
            isBored = false
            isSentence = false
        }
    }
    return boredomCount
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    var boredomCount = 0
    var isBored = false
    var isSentence = false
    for character in S {
        if character == "." || character == "?" || character == "!" {
            isSentence = true
        }
        if character == "I" && isSentence {
            isBored = true
        }
        if character == "." || character == "?" || character == "!" {
            if isBored {
                boredomCount += 1
            }
            isBored = false
            isSentence = false
        }
    }
    return boredomCount
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var count = 0
    var sentence = ""
    for char in S {
        if char == "." || char == "?" || char == "!" {
            if sentence.hasPrefix("I") {
                count += 1
            }
            sentence = ""
        } else {
            sentence += String(char)
        }
    }
    return count
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    var count = 0
    var sentence = ""
    for char in S {
        if char == "." || char == "?" || char == "!" {
            if sentence.hasPrefix("I") {
                count += 1
            }
            sentence = ""
        } else {
            sentence += String(char)
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var boredom = 0
    var sentence = ""
    for char in S {
        if char == "." || char == "?" || char == "!" {
            if sentence.hasPrefix("I") {
                boredom += 1
            }
            sentence = ""
        } else {
            sentence += String(char)
        }
    }
    return boredom
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    var boredom = 0
    var sentence = ""
    for char in S {
        if char == "." || char == "?" || char == "!" {
            if sentence.hasPrefix("I") {
                boredom += 1
            }
            sentence = ""
        } else {
            sentence += String(char)
        }
    }
    return boredom
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    let x = Int(x)
    let y = Int(y)
    let z = Int(z)
    return (x == y + z || y == x + z || z == x + y) && (x == Int(x) && y == Int(y) && z == Int(z))
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    let x = Int(x)
    let y = Int(y)
    let z = Int(z)
    return (x == y + z || y == x + z || z == x + y) && (x == Int(x) && y == Int(y) && z == Int(z))
}
```

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```swift
// Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// anyInt(x: 5, y: 2, z: 7) == true
// anyInt(x: 3, y: 2, z: 2) == false
// anyInt(x: 3, y: -2, z: 1) == true
// anyInt(x: 3.6, y: -2.2, z: 2) == false
func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return false
}
```
 // XCTAssertTrue failed

func encode(message: String) -> String {
    var encodedMessage = ""
    for letter in message {
        if let encodedLetter = encode(letter: letter) {
            encodedMessage += encodedLetter
        }
    }
    return encodedMessage
}

func encode(letter: Character) -> Character? {
    let letter = String(letter)
    let letterIndex = letter.index(letter.startIndex, offsetBy: 1)
    let letterAfter = String(letter[letterIndex])
    if let letterAfter = letterAfter.first {
        if let encodedLetter = encode(letter: letterAfter) {
            return encodedLetter
        }
    }
    return nil
}

func encode(letter: Character) -> Character? {
    let letter = String(letter)
    if letter.rangeOfCharacter(from: .letters) != nil {
        let letterIndex = letter.index(letter.startIndex, offsetBy: 1)
        let letterAfter = String(letter[letterIndex])
        if let letterAfter = letterAfter.first {
            if let encodedLetter = encode(letter: letterAfter) {
                return encodedLetter
            }
        }
    }
    return nil
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var encodedMessage = ""
    for letter in message {
        if let encodedLetter = encode(letter: letter) {
            encodedMessage += encodedLetter
        }
    }
    return encodedMessage
}

func encode(letter: Character) -> Character? {
    let letter = String(letter)
    let letterIndex = letter.index(letter.startIndex, offsetBy: 1)
    let letterAfter = String(letter[letterIndex])
    if let letterAfter = letterAfter.first {
        if let encodedLetter = encode(letter: letterAfter) {
            return encodedLetter
        }
    }
    return nil
}

func encode(letter: Character) -> Character? {
    let letter = String(letter)
    if letter.rangeOfCharacter(from: .letters) != nil {
        let letterIndex = letter.index(letter.startIndex, offsetBy: 1)
        let letterAfter = String(letter[letterIndex])
        if let letterAfter = letterAfter.first {
            if let encodedLetter = encode(letter: letterAfter) {
                return encodedLetter
            }
        }
    }
    return nil
}

func encode(letter: Character) -> Character? {
    let letter = String(letter)
    if letter.rangeOfCharacter(from: .letters) != nil {
        let letterIndex = letter.index(letter.startIndex, offsetBy: 1)
        let letterAfter = String(letter[letterIndex])
        if let letterAfter = letterAfter.first {
            if let encodedLetter = encode(letter: letterAfter) {
                return encodedLetter
            }
        }
    }
    return nil
}

func encode(letter: Character) -> Character? {
    let letter = String(letter)
    if letter.rangeOfCharacter(from: .letters) != nil {
        let letterIndex = letter.index(letter.startIndex, offsetBy: 1)
        let letterAfter = String(letter[letterIndex])
        if let letterAfter = letterAfter.first {
            if let encodedLetter = encode(letter: letterAfter) {
                return encodedLetter
            }
        }
    }
    return nil
}

func encode(letter: Character) -> Character? {
    let letter = String(letter)
    if letter.rangeOfCharacter(from: .letters) != nil {
        let letterIndex = letter.index(letter.startIndex, offsetBy: 1)
        let letterAfter = String(letter[letterIndex])
        if let letterAfter = letterAfter.first {
            if let encodedLetter = encode(letter: letterAfter) {
                return encodedLetter
            }
        }
    }
    return nil
}

func encode(letter: Character) -> Character? {
    let letter = String(letter)
    if letter.rangeOfCharacter(from: .letters) != nil {
        let letterIndex = letter.index(letter.startIndex, offsetBy: 1)
        let letterAfter = String(letter[letterIndex])
        if let letterAfter = letterAfter.first {
            if let encodedLetter = encode(letter: letterAfter) {
                return encodedLetter
            }
        }
    }
    return nil
}

func encode(letter: Character) -> Character? {
    let letter = String(letter)
    if letter.rangeOfCharacter(from: .letters) != nil {
        let letterIndex = letter.index(letter.startIndex, offsetBy: 1)
        let letterAfter = String(letter[letterIndex])
        if let letterAfter = letterAfter.first {
            if let encodedLetter = encode(letter: letterAfter) {
                return encodedLetter
            }
        }
    }
    return nil
}

func encode(letter: Character) -> Character? {
    let letter = String(letter)
    if letter.rangeOfCharacter(from: .letters) != nil {
        let letterIndex = letter.index(letter.startIndex, offsetBy: 1)
        let letterAfter = String(letter[letterIndex])
        if let letterAfter = letterAfter.first {
            if let encodedLetter = encode(letter: letterAfter) {
                return encodedLetter
            }
        }
    }
    return nil
}

func encode(letter: Character) -> Character
encodedMessage += encodedLetter // cannot convert value of type 'Character' to expected argument type 'String'
func encode(letter: Character) -> Character? { // invalid redeclaration of 'encode(letter:)'

func encode(message: String) -> String {
    var result = ""
    for letter in message {
        if isVowel(letter) {
            result += getNextVowel(letter)
        } else {
            result += letter.uppercased()
        }
    }
    return result
}

func isVowel(_ letter: Character) -> Bool {
    return letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u"
}

func getNextVowel(_ letter: Character) -> String {
    let index = getVowelIndex(letter)
    let nextIndex = index + 2
    return String(getVowel(nextIndex))
}

func getVowelIndex(_ letter: Character) -> Int {
    let vowels = ["a", "e", "i", "o", "u"]
    return vowels.firstIndex(of: letter)!
}

func getVowel(_ index: Int) -> Character {
    let vowels = ["a", "e", "i", "o", "u"]
    return vowels[index]
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var result = ""
    for letter in message {
        if isVowel(letter) {
            result += getNextVowel(letter)
        } else {
            result += letter.uppercased()
        }
    }
    return result
}

func isVowel(_ letter: Character) -> Bool {
    return letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u"
}

func getNextVowel(_ letter: Character) -> String {
    let index = getVowelIndex(letter)
    let nextIndex = index + 2
    return String(getVowel(nextIndex))
}

func getVowelIndex(_ letter: Character) -> Int {
    let vowels = ["a", "e", "i", "o", "u"]
    return vowels.firstIndex(of: letter)!
}

func getVowel(_ index: Int) -> Character {
    let vowels = ["a", "e", "i", "o", "u"]
    return vowels[index]
}
```
return vowels.firstIndex(of: letter)! // cannot convert value of type 'Character' to expected argument type 'String'
return vowels[index] // cannot convert return expression of type 'String' to return type 'Character'

func encode(message: String) -> String {
    var encodedMessage = ""
    for character in message {
        if character.isLetter {
            let encodedCharacter = character.isUppercase ? character.lowercased() : character.uppercased()
            let encodedCharacterIndex = encodedCharacter.index(encodedCharacter.startIndex, offsetBy: 2)
            let encodedCharacter = encodedCharacter.index(encodedCharacterIndex, offsetBy: 1)
            encodedMessage += String(encodedCharacter)
        } else {
            encodedMessage += character
        }
    }
    return encodedMessage
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var encodedMessage = ""
    for character in message {
        if character.isLetter {
            let encodedCharacter = character.isUppercase ? character.lowercased() : character.uppercased()
            let encodedCharacterIndex = encodedCharacter.index(encodedCharacter.startIndex, offsetBy: 2)
            let encodedCharacter = encodedCharacter.index(encodedCharacterIndex, offsetBy: 1)
            encodedMessage += String(encodedCharacter)
        } else {
            encodedMessage += character
        }
    }
    return encodedMessage
}
```
let encodedCharacter = encodedCharacter.index(encodedCharacterIndex, offsetBy: 1) // invalid redeclaration of 'encodedCharacter'
encodedMessage += character // cannot convert value of type 'Character' to expected argument type 'String'

func encode(message: String) -> String {
    var encodedMessage = ""
    for character in message {
        if character.isLetter {
            encodedMessage += character.isUppercase ? character.lowercased() : character.uppercased()
        } else {
            encodedMessage += character
        }
    }
    return encodedMessage
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var encodedMessage = ""
    for character in message {
        if character.isLetter {
            encodedMessage += character.isUppercase ? character.lowercased() : character.uppercased()
        } else {
            encodedMessage += character
        }
    }
    return encodedMessage
}

print(encode(message: "test"))
print(encode(message: "This is a message"))
```
encodedMessage += character // cannot convert value of type 'Character' to expected argument type 'String'

func encode(message: String) -> String {
    var encodedMessage = ""
    for character in message {
        let character = String(character)
        if character.isUppercase {
            encodedMessage += character.lowercased()
        } else {
            encodedMessage += character.uppercased()
        }
    }
    return encodedMessage
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var encodedMessage = ""
    for character in message {
        let character = String(character)
        if character.isUppercase {
            encodedMessage += character.lowercased()
        } else {
            encodedMessage += character.uppercased()
        }
    }
    return encodedMessage
}
```
if character.isUppercase { // value of type 'String' has no member 'isUppercase'

func encode(message: String) -> String {
    return ""
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    return ""
}
```
 // XCTAssertTrue failed

func encode(message: String) -> String {
    let lowercased = message.lowercased()
    let uppercased = message.uppercased()
    var encoded = ""
    for (index, letter) in lowercased.enumerated() {
        if letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u" {
            encoded += uppercased[index + 2]
        } else {
            encoded += letter
        }
    }
    return encoded
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    let lowercased = message.lowercased()
    let uppercased = message.uppercased()
    var encoded = ""
    for (index, letter) in lowercased.enumerated() {
        if letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u" {
            encoded += uppercased[index + 2]
        } else {
            encoded += letter
        }
    }
    return encoded
}
```
encoded += uppercased[index + 2] // no exact matches in call to subscript
encoded += letter // cannot convert value of type 'String.Element' (aka 'Character') to expected argument type 'String'

func encode(message: String) -> String {
    var encodedMessage = ""
    for letter in message {
        if letter.isUppercase {
            encodedMessage += letter.lowercased()
        } else if letter.isLowercase {
            encodedMessage += letter.uppercased()
        } else {
            encodedMessage += letter
        }
    }
    return encodedMessage
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var encodedMessage = ""
    for letter in message {
        if letter.isUppercase {
            encodedMessage += letter.lowercased()
        } else if letter.isLowercase {
            encodedMessage += letter.uppercased()
        } else {
            encodedMessage += letter
        }
    }
    return encodedMessage
}
```
encodedMessage += letter // cannot convert value of type 'Character' to expected argument type 'String'

func encode(message: String) -> String {
    return ""
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    return ""
}
```
 // XCTAssertTrue failed

func encode(message: String) -> String {
    return ""
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    return ""
}
```
 // XCTAssertTrue failed

func skjkasdkd(lst: [Int]) -> Int {
    // Write your code here
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func skjkasdkd(lst: [Int]) -> Int {
    // Write your code here
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func skjkasdkd(lst: [Int]) -> Int {
    // Write your code here
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func skjkasdkd(lst: [Int]) -> Int {
    return 0
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    return 0
}
```
 // XCTAssertTrue failed

func skjkasdkd(lst: [Int]) -> Int {
    let primes = lst.filter { isPrime($0) }
    let largestPrime = primes.max()
    let largestPrimeDigits = largestPrime.digits
    return largestPrimeDigits.reduce(0, +)
}

func isPrime(_ number: Int) -> Bool {
    if number == 2 {
        return true
    }
    if number % 2 == 0 {
        return false
    }
    var i = 3
    while i * i <= number {
        if number % i == 0 {
            return false
        }
        i += 2
    }
    return true
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    let primes = lst.filter { isPrime($0) }
    let largestPrime = primes.max()
    let largestPrimeDigits = largestPrime.digits
    return largestPrimeDigits.reduce(0, +)
}

func isPrime(_ number: Int) -> Bool {
    if number == 2 {
        return true
    }
    if number % 2 == 0 {
        return false
    }
    var i = 3
    while i * i <= number {
        if number % i == 0 {
            return false
        }
        i += 2
    }
    return true
}
```
let largestPrimeDigits = largestPrime.digits // value of type 'Int?' has no member 'digits'

func skjkasdkd(lst: [Int]) -> Int {
    return 0
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    return 0
}
```
 // XCTAssertTrue failed

func skjkasdkd(lst: [Int]) -> Int {
    // Your code goes here
    return 0
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    // Your code goes here
    return 0
}
```
 // XCTAssertTrue failed

func skjkasdkd(lst: [Int]) -> Int {
    let primes = getPrimes(lst)
    let largestPrime = primes.max()
    let largestPrimeDigits = getDigits(largestPrime!)
    return largestPrimeDigits.reduce(0, +)
}

func getDigits(_ number: Int) -> [Int] {
    return String(number).map { Int(String($0))! }
}

func getPrimes(_ lst: [Int]) -> [Int] {
    var primes = [Int]()
    for number in lst {
        if isPrime(number) {
            primes.append(number)
        }
    }
    return primes
}

func isPrime(_ number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2...number / 2 {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    let primes = getPrimes(lst)
    let largestPrime = primes.max()
    let largestPrimeDigits = getDigits(largestPrime!)
    return largestPrimeDigits.reduce(0, +)
}

func getDigits(_ number: Int) -> [Int] {
    return String(number).map { Int(String($0))! }
}

func getPrimes(_ lst: [Int]) -> [Int] {
    var primes = [Int]()
    for number in lst {
        if isPrime(number) {
            primes.append(number)
        }
    }
    return primes
}

func isPrime(_ number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2...number / 2 {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func skjkasdkd(lst: [Int]) -> Int {
    var prime = 0
    var sum = 0
    for i in lst {
        if isPrime(i) {
            prime = i
            break
        }
    }
    for i in String(prime).characters.map({ Int(String($0))! }) {
        sum += i
    }
    return sum
}

func isPrime(_ n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    if n <= 3 {
        return true
    }
    if n % 2 == 0 || n % 3 == 0 {
        return false
    }
    var i = 5
    while i * i <= n {
        if n % i == 0 || n % (i + 2) == 0 {
            return false
        }
        i += 6
    }
    return true
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    var prime = 0
    var sum = 0
    for i in lst {
        if isPrime(i) {
            prime = i
            break
        }
    }
    for i in String(prime).characters.map({ Int(String($0))! }) {
        sum += i
    }
    return sum
}

func isPrime(_ n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    if n <= 3 {
        return true
    }
    if n % 2 == 0 || n % 3 == 0 {
        return false
    }
    var i = 5
    while i * i <= n {
        if n % i == 0 || n % (i + 2) == 0 {
            return false
        }
        i += 6
    }
    return true
}
```
for i in String(prime).characters.map({ Int(String($0))! }) { // 'characters' is unavailable: Please use String directly

func skjkasdkd(lst: [Int]) -> Int {
    let primes = lst.filter({ isPrime($0) })
    let prime = primes.max()
    return prime == nil ? 0 : primeDigitSum(prime!)
}

func isPrime(_ number: Int) -> Bool {
    if number < 2 {
        return false
    }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}

func primeDigitSum(_ number: Int) -> Int {
    var sum = 0
    var temp = number
    while temp > 0 {
        sum += temp % 10
        temp /= 10
    }
    return sum
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    let primes = lst.filter({ isPrime($0) })
    let prime = primes.max()
    return prime == nil ? 0 : primeDigitSum(prime!)
}

func isPrime(_ number: Int) -> Bool {
    if number < 2 {
        return false
    }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}

func primeDigitSum(_ number: Int) -> Int {
    var sum = 0
    var temp = number
    while temp > 0 {
        sum += temp % 10
        temp /= 10
    }
    return sum
}
```

func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes: [Int] = []
    for i in 2...n {
        var isPrime = true
        for j in 2...i/2 {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes: [Int] = []
    for i in 2...n {
        var isPrime = true
        for j in 2...i/2 {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            primes.append(i)
        }
    }
    return primes
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [2]
    var number = 3
    while primes.last! < n {
        if isPrime(number) {
            primes.append(number)
        }
        number += 2
    }
    return primes
}

func isPrime(_ number: Int) -> Bool {
    guard number > 1 else { return false }
    var i = 2
    while i * i <= number {
        if number % i == 0 {
            return false
        }
        i += 1
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [2]
    var number = 3
    while primes.last! < n {
        if isPrime(number) {
            primes.append(number)
        }
        number += 2
    }
    return primes
}

func isPrime(_ number: Int) -> Bool {
    guard number > 1 else { return false }
    var i = 2
    while i * i <= number {
        if number % i == 0 {
            return false
        }
        i += 1
    }
    return true
}
```
 // XCTAssertTrue failed

func countUpTo(n: Int) -> [Int] {
    var primes: [Int] = []
    var i = 2
    while primes.count < n {
        if isPrime(i) {
            primes.append(i)
        }
        i += 1
    }
    return primes
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    if n == 2 {
        return true
    }
    if n % 2 == 0 {
        return false
    }
    var i = 3
    while i * i <= n {
        if n % i == 0 {
            return false
        }
        i += 2
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primes: [Int] = []
    var i = 2
    while primes.count < n {
        if isPrime(i) {
            primes.append(i)
        }
        i += 1
    }
    return primes
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    if n == 2 {
        return true
    }
    if n % 2 == 0 {
        return false
    }
    var i = 3
    while i * i <= n {
        if n % i == 0 {
            return false
        }
        i += 2
    }
    return true
}
```
 // XCTAssertTrue failed

func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [2]
    var number = 3
    while primes.last! < n {
        if isPrime(number) {
            primes.append(number)
        }
        number += 2
    }
    return primes
}

func isPrime(_ number: Int) -> Bool {
    guard number > 1 else { return false }
    for i in 2...Int(sqrt(Double(number))) {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [2]
    var number = 3
    while primes.last! < n {
        if isPrime(number) {
            primes.append(number)
        }
        number += 2
    }
    return primes
}

func isPrime(_ number: Int) -> Bool {
    guard number > 1 else { return false }
    for i in 2...Int(sqrt(Double(number))) {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes: [Int] = []
    var number = 2
    while primes.count < n {
        if isPrime(number) {
            primes.append(number)
        }
        number += 1
    }
    return primes
}

func isPrime(_ number: Int) -> Bool {
    guard number > 1 else { return false }
    for i in 2...number / 2 {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes: [Int] = []
    var number = 2
    while primes.count < n {
        if isPrime(number) {
            primes.append(number)
        }
        number += 1
    }
    return primes
}

func isPrime(_ number: Int) -> Bool {
    guard number > 1 else { return false }
    for i in 2...number / 2 {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes: [Int] = []
    for i in 2...n {
        if i > 1 {
            var isPrime = true
            for j in 2...i/2 {
                if i % j == 0 {
                    isPrime = false
                    break
                }
            }
            if isPrime {
                primes.append(i)
            }
        }
    }
    return primes
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes: [Int] = []
    for i in 2...n {
        if i > 1 {
            var isPrime = true
            for j in 2...i/2 {
                if i % j == 0 {
                    isPrime = false
                    break
                }
            }
            if isPrime {
                primes.append(i)
            }
        }
    }
    return primes
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [2]
    var i = 3
    while primes.count < n {
        if isPrime(i) {
            primes.append(i)
        }
        i += 2
    }
    return primes
}

func isPrime(_ n: Int) -> Bool {
    guard n > 1 else { return false }
    var i = 2
    while i * i <= n {
        if n % i == 0 {
            return false
        }
        i += 1
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    var primes = [2]
    var i = 3
    while primes.count < n {
        if isPrime(i) {
            primes.append(i)
        }
        i += 2
    }
    return primes
}

func isPrime(_ n: Int) -> Bool {
    guard n > 1 else { return false }
    var i = 2
    while i * i <= n {
        if n % i == 0 {
            return false
        }
        i += 1
    }
    return true
}
```
 // XCTAssertTrue failed

func countUpTo(n: Int) -> [Int] {
    var result = [Int]()
    var i = 2
    while i < n {
        if isPrime(i) {
            result.append(i)
        }
        i += 1
    }
    return result
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    var i = 2
    while i * i <= n {
        if n % i == 0 {
            return false
        }
        i += 1
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var result = [Int]()
    var i = 2
    while i < n {
        if isPrime(i) {
            result.append(i)
        }
        i += 1
    }
    return result
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    var i = 2
    while i * i <= n {
        if n % i == 0 {
            return false
        }
        i += 1
    }
    return true
}
```

func countUpTo(n: Int) -> [Int] {
    var result = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2...i/2 {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            result.append(i)
        }
    }
    return result
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var result = [Int]()
    for i in 2...n {
        var isPrime = true
        for j in 2...i/2 {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            result.append(i)
        }
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func countUpTo(n: Int) -> [Int] {
    var primes: [Int] = []
    for i in 2...n {
        if isPrime(i) {
            primes.append(i)
        }
    }
    return primes
}

func isPrime(_ n: Int) -> Bool {
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primes: [Int] = []
    for i in 2...n {
        if isPrime(i) {
            primes.append(i)
        }
    }
    return primes
}

func isPrime(_ n: Int) -> Bool {
    for i in 2...n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func multiply(a: Int, b: Int) -> Int {
    // Return the product of the unit digits of a and b
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    // Return the product of the unit digits of a and b
}
```
} // missing return in global function expected to return 'Int'

func multiply(a: Int, b: Int) -> Int {
    // Return the product of their unit digits
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    // Return the product of their unit digits
}
```
} // missing return in global function expected to return 'Int'

func multiply(a: Int, b: Int) -> Int {
    // Return the product of the unit digits of a and b
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    // Return the product of the unit digits of a and b
}
```
} // missing return in global function expected to return 'Int'

func multiply(a: Int, b: Int) -> Int {
    let aDigits = String(a).map { Int(String($0))! }
    let bDigits = String(b).map { Int(String($0))! }
    return aDigits.reduce(0, *) * bDigits.reduce(0, *)
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    let aDigits = String(a).map { Int(String($0))! }
    let bDigits = String(b).map { Int(String($0))! }
    return aDigits.reduce(0, *) * bDigits.reduce(0, *)
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    // Return the product of their unit digits.
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    // Return the product of their unit digits.
}
```
} // missing return in global function expected to return 'Int'

func multiply(a: Int, b: Int) -> Int {
    // Return the product of the unit digits of a and b
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    // Return the product of the unit digits of a and b
}
```
} // missing return in global function expected to return 'Int'

func multiply(a: Int, b: Int) -> Int {
    // Your code goes here
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Int'

func multiply(a: Int, b: Int) -> Int {
    // Return the product of their unit digits
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    // Return the product of their unit digits
}
```
} // missing return in global function expected to return 'Int'

func multiply(a: Int, b: Int) -> Int {
    let aDigits = [Int](String(a).map { Int(String($0))! })
    let bDigits = [Int](String(b).map { Int(String($0))! })
    var result = 0
    for i in 0..<aDigits.count {
        for j in 0..<bDigits.count {
            result += aDigits[i] * bDigits[j]
        }
    }
    return result
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    let aDigits = [Int](String(a).map { Int(String($0))! })
    let bDigits = [Int](String(b).map { Int(String($0))! })
    var result = 0
    for i in 0..<aDigits.count {
        for j in 0..<bDigits.count {
            result += aDigits[i] * bDigits[j]
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    // Return the product of their unit digits
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    // Return the product of their unit digits
}
```
} // missing return in global function expected to return 'Int'

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0, char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0, char.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, character) in s.enumerated() {
        if index % 2 == 0 && character.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, character) in s.enumerated() {
        if index % 2 == 0 && character.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number)
    let roundedInt = Int(rounded)
    return roundedInt
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number)
    let roundedInt = Int(rounded)
    return roundedInt
}
```
let rounded = round(number) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number)
    let integer = Int(rounded)
    return integer
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number)
    let integer = Int(rounded)
    return integer
}

closestInteger(value: "10") // 10
closestInteger(value: "15.3") // 15
closestInteger(value: "14.5") // 15
closestInteger(value: "14.4") // 14
closestInteger(value: "14.6") // 15
closestInteger(value: "14.51") // 15
closestInteger(value: "14.49") // 14
closestInteger(value: "14.50") // 15
closestInteger(value: "14.45") // 14
closestInteger(value: "14.55") // 15
```
let rounded = round(number) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let roundedNumber = round(number)
    return Int(roundedNumber)
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let number = Double(value)
    let roundedNumber = round(number)
    return Int(roundedNumber)
}
```
let roundedNumber = round(number) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let roundedNumber = round(number)
    return Int(roundedNumber)
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let number = Double(value)
    let roundedNumber = round(number)
    return Int(roundedNumber)
}

closestInteger(value: "10")
closestInteger(value: "15.3")
```
let roundedNumber = round(number) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number)
    let roundedInt = Int(rounded)
    return roundedInt
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number)
    let roundedInt = Int(rounded)
    return roundedInt
}
```
let rounded = round(number) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number)
    let roundedInt = Int(rounded)
    return roundedInt!
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number)
    let roundedInt = Int(rounded)
    return roundedInt!
}
```
let rounded = round(number) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number)
    let roundedInt = Int(rounded)
    return roundedInt
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number)
    let roundedInt = Int(rounded)
    return roundedInt
}
```
let rounded = round(number) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number)
    let roundedInt = Int(rounded)
    return roundedInt!
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let number = Double(value)
    let rounded = round(number)
    let roundedInt = Int(rounded)
    return roundedInt!
}
```
let rounded = round(number) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    // Your code here
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    // Your code here
}
```
} // missing return in global function expected to return 'Int'

func closestInteger(value: String) -> Int {
    return 0
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    return 0
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var pile = [Int]()
    for i in 1...n {
        pile.append(i)
    }
    return pile
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var pile = [Int]()
    for i in 1...n {
        pile.append(i)
    }
    return pile
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<n {
        result.append(i + 1)
    }
    return result
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<n {
        result.append(i + 1)
    }
    return result
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        result.append(i)
    }
    return result
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        result.append(i)
    }
    return result
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var i = 1
    while i <= n {
        result.append(i)
        i += 1
        if i % 2 == 0 {
            i += 1
        }
    }
    return result
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var i = 1
    while i <= n {
        result.append(i)
        i += 1
        if i % 2 == 0 {
            i += 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<n {
        result.append(i + 1)
    }
    return result
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<n {
        result.append(i + 1)
    }
    return result
}

// makeAPile(n: 3) == [3, 5, 7]
// makeAPile(n: 4) == [4, 6, 8, 10]
// makeAPile(n: 5) == [5, 7, 9, 11, 13]
// makeAPile(n: 6) == [6, 8, 10, 12, 14, 16]
// makeAPile(n: 7) == [7, 9, 11, 13, 15, 17, 19]
// makeAPile(n: 8) == [8, 10, 12, 14, 16, 18, 20, 22]
// makeAPile(n: 9) == [9, 11, 13, 15, 17, 19, 21, 23, 25]
// makeAPile(n: 10) == [10, 12, 14, 16, 18, 20, 22, 24, 26, 28]
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level = level % 2 == 0 ? level / 2 : level + 1
    }
    return result
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level = level % 2 == 0 ? level / 2 : level + 1
    }
    return result
}
```

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level = level % 2 == 0 ? level + 1 : level + 2
    }
    return result
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level = level % 2 == 0 ? level + 1 : level + 2
    }
    return result
}
```

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level = level % 2 == 0 ? level + 1 : level + 2
    }
    return result
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level = level % 2 == 0 ? level + 1 : level + 2
    }
    return result
}
```

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level += 1
        if level % 2 == 0 {
            level += 1
        }
    }
    return result
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level += 1
        if level % 2 == 0 {
            level += 1
        }
    }
    return result
}

// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level += 1
        if level % 2 == 0 {
            level += 1
        }
    }
    return result
}

// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level += 1
        if level % 2 == 0 {
            level += 1
        }
    }
    return result
}

// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level += 1
        if level % 2 == 0 {
            level += 1
        }
    }
    return result
}

// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level += 1
        if level % 2 == 0 {
            level += 1
        }
    }
    return result
}

// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level = level % 2 == 0 ? level / 2 + 1 : level / 2 + 2
    }
    return result
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = n
    while level > 0 {
        result.append(level)
        level = level % 2 == 0 ? level / 2 + 1 : level / 2 + 2
    }
    return result
}
```

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,").inverted)
}
```swift
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array of the words.
// For example:
// wordsString(s: "Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
// wordsString(s: "One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,").inverted)
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: ", ").inverted)
}
```swift
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array of the words.
// For example:
// wordsString(s: "Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
// wordsString(s: "One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: ", ").inverted)
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,").inverted)
}
```swift
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array of the words.
// For example:
// wordsString(s: "Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
// wordsString(s: "One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,").inverted)
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,").inverted)
}
```swift
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array of the words.
// For example:
// wordsString(s: "Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
// wordsString(s: "One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,").inverted)
}

wordsString(s: "Hi, my name is John") // ["Hi", "my", "name", "is", "John"]
wordsString(s: "One, two, three, four, five, six") // ["One", "two", "three", "four", "five", "six"]
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,"))
}
```swift
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array of the words.
// For example:
// wordsString(s: "Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
// wordsString(s: "One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,"))
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet.alphanumerics.inverted)
}
```swift
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array of the words.
// For example:
// wordsString(s: "Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
// wordsString(s: "One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet.alphanumerics.inverted)
}

wordsString(s: "Hi, my name is John")
wordsString(s: "One, two, three, four, five, six")
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,").inverted)
}
```swift
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array of the words.
// For example:
// wordsString(s: "Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
// wordsString(s: "One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,").inverted)
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: ", ").inverted)
}
```swift
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array of the words.
// For example:
// wordsString(s: "Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
// wordsString(s: "One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: ", ").inverted)
}

wordsString(s: "Hi, my name is John")
wordsString(s: "One, two, three, four, five, six")
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,").inverted)
}
```swift
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array of the words.
// For example:
// wordsString(s: "Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
// wordsString(s: "One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,").inverted)
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,").inverted)
}
```swift
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array of the words.
// For example:
// wordsString(s: "Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
// wordsString(s: "One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
func wordsString(s: String) -> [String] {
    return s.components(separatedBy: CharacterSet(charactersIn: " ,").inverted)
}
```
 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}

// This function takes two positive numbers x and y and returns the
// biggest odd integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 13
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}

// This function takes two positive numbers x and y and returns the
// biggest integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 15
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}

// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Your code here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}

// This function takes two positive numbers x and y and returns the
// smallest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}

// This function takes two positive numbers x and y and returns the
// biggest odd integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 13
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}

// This function takes two positive numbers x and y and returns the
// smallest odd integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 13
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
    return 0
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
    return 0
}
```
 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    // Your code here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Int'

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let average = (n + m) / 2
    return .success(String(average, radix: 2))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let average = (n + m) / 2
    return .success(String(average, radix: 2))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let average = (n + m) / 2
    let rounded = Int(average.rounded())
    let binary = String(rounded, radix: 2)
    return .success(binary)
}

func testRoundedAvg() {
    let actual = roundedAvg(n: 1, m: 5)
    let expected = Result.success("0b11")
    XCTAssertEqual(actual, expected)
    
    let actual2 = roundedAvg(n: 7, m: 5)
    let expected2 = Result.failure(-1)
    XCTAssertEqual(actual2, expected2)
    
    let actual3 = roundedAvg(n: 10, m: 20)
    let expected3 = Result.success("0b1111")
    XCTAssertEqual(actual3, expected3)
    
    let actual4 = roundedAvg(n: 20, m: 33)
    let expected4 = Result.success("0b11010")
    XCTAssertEqual(actual4, expected4)
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let average = (n + m) / 2
    let rounded = Int(average.rounded())
    let binary = String(rounded, radix: 2)
    return .success(binary)
}

// MARK: - Tests
func testRoundedAvg() {
    let actual = roundedAvg(n: 1, m: 5)
    let expected = Result.success("0b11")
    XCTAssertEqual(actual, expected)
    
    let actual2 = roundedAvg(n: 7, m: 5)
    let expected2 = Result.failure(-1)
    XCTAssertEqual(actual2, expected2)
    
    let actual3 = roundedAvg(n: 10, m: 20)
    let expected3 = Result.success("0b1111")
    XCTAssertEqual(actual3, expected3)
    
    let actual4 = roundedAvg(n: 20, m: 33)
    let expected4 = Result.success("0b11010")
    XCTAssertEqual(actual4, expected4)
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let rounded = Int(average.rounded()) // value of type 'Int' has no member 'rounded'
let expected = Result.success("0b11") // generic parameter 'Failure' could not be inferred
let expected2 = Result.failure(-1) // generic parameter 'Success' could not be inferred
let expected3 = Result.success("0b1111") // generic parameter 'Failure' could not be inferred
let expected4 = Result.success("0b11010") // generic parameter 'Failure' could not be inferred

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let average = (n + m) / 2
    let rounded = Int(average.rounded())
    return .success(String(format: "%b", rounded))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let average = (n + m) / 2
    let rounded = Int(average.rounded())
    return .success(String(format: "%b", rounded))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let rounded = Int(average.rounded()) // value of type 'Int' has no member 'rounded'

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let avg = (n + m) / 2
    return .success(String(avg, radix: 2))
}

func removeFirstDuplicate(s: String) -> String {
    var chars = [Character]()
    for char in s {
        if chars.contains(char) {
            chars.removeAll(where: { $0 == char })
        } else {
            chars.append(char)
        }
    }
    return String(chars)
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let avg = (n + m) / 2
    return .success(String(avg, radix: 2))
}

// You are given a string s. Your task is to find the first non-repeating character
// in the string and remove it. If there is no such character, return the string
// unchanged.
// Example:
// removeFirstDuplicate("abaccdeff") == "baccdeff"
// removeFirstDuplicate("beabe") == "beabe"
// removeFirstDuplicate("aabb") == ""
// removeFirstDuplicate("aabAa") == "aabA"
func removeFirstDuplicate(s: String) -> String {
    var chars = [Character]()
    for char in s {
        if chars.contains(char) {
            chars.removeAll(where: { $0 == char })
        } else {
            chars.append(char)
        }
    }
    return String(chars)
}

// You are given a string s. Your task is to find the first non-repeating character
// in the string and remove it. If there is no such character, return the string
// unchanged.
// Example:
// removeFirstDuplicate("abaccdeff") == "baccdeff"
// removeFirstDuplicate("beabe") == "beabe"
// removeFirstDuplicate("aabb") == ""
// removeFirstDuplicate("aabAa") == "aabA"
func removeFirstDuplicate(s: String) -> String {
    var chars = [Character]()
    for char in s {
        if chars.contains(char) {
            chars.removeAll(where: { $0 == char })
        } else {
            chars.append(char)
        }
    }
    return String(chars)
}

// You are given a string s. Your task is to find the first non-repeating character
// in the string and remove it. If there is no such character, return the string
// unchanged.
// Example:
// removeFirstDuplicate("abaccdeff") == "baccdeff"
// removeFirstDuplicate("beabe") == "beabe"
// removeFirstDuplicate("aabb") == ""
// removeFirstDuplicate("aabAa") == "aabA"
func removeFirstDuplicate(s: String) -> String {
    var chars = [Character]()
    for char in s {
        if chars.contains(char) {
            chars.removeAll(where: { $0 == char })
        } else {
            chars.append(char)
        }
    }
    return String(chars)
}

// You are given a string s. Your task is to find the first non-repeating character
// in the string and remove it. If there is no such character, return the string
// unchanged.
// Example:
// removeFirstDuplicate("abaccdeff") == "baccdeff"
// removeFirstDuplicate("beabe") == "beabe"
// removeFirstDuplicate("aabb") == ""
// removeFirstDuplicate("aabAa") == "aabA"
func removeFirstDuplicate(s: String) -> String {
    var chars = [Character]()
    for char in s {
        if chars.contains(char) {
            chars.removeAll(where: { $0 == char })
        } else {
            chars.append(char)
        }
    }
    return String(chars)
}

// You are given a string s. Your task is to find the first non-repeating character
// in the string and remove it. If there is no such character, return the string
// unchanged.
// Example:
// removeFirstDuplicate("abaccdeff") == "baccdeff"
// removeFirstDuplicate("beabe") == "beabe"
// removeFirstDuplicate("aabb") == ""
// removeFirstDuplicate("aabAa") == "aabA"
func removeFirstDuplicate(s: String) -> String {
    var chars = [Character]()
    for char in s {
        if chars.contains(char)
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let avg = (n + m) / 2
    let rounded = Int(round(Double(avg)))
    return .success(String(rounded, radix: 2))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let avg = (n + m) / 2
    let rounded = Int(round(Double(avg)))
    return .success(String(rounded, radix: 2))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let avg = (n + m) / 2
    let rounded = Int(round(Double(avg)))
    return .success(String(rounded, radix: 2))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let avg = (n + m) / 2
    let rounded = Int(round(Double(avg)))
    return .success(String(rounded, radix: 2))
}

roundedAvg(n: 1, m: 5)
roundedAvg(n: 7, m: 5)
roundedAvg(n: 10, m: 20)
roundedAvg(n: 20, m: 33)
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let avg = (n + m) / 2
    let rounded = Int(round(Double(avg)))
    let binary = String(rounded, radix: 2)
    return .success(binary)
}

func testRoundedAvg() {
    let actual = roundedAvg(n: 1, m: 5)
    let expected = Result<String, Int>.success("0b11")
    XCTAssertEqual(actual, expected)
    
    let actual2 = roundedAvg(n: 7, m: 5)
    let expected2 = Result<String, Int>.failure(-1)
    XCTAssertEqual(actual2, expected2)
    
    let actual3 = roundedAvg(n: 10, m: 20)
    let expected3 = Result<String, Int>.success("0b1111")
    XCTAssertEqual(actual3, expected3)
    
    let actual4 = roundedAvg(n: 20, m: 33)
    let expected4 = Result<String, Int>.success("0b11010")
    XCTAssertEqual(actual4, expected4)
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let avg = (n + m) / 2
    let rounded = Int(round(Double(avg)))
    let binary = String(rounded, radix: 2)
    return .success(binary)
}

// MARK: - Tests
func testRoundedAvg() {
    let actual = roundedAvg(n: 1, m: 5)
    let expected = Result<String, Int>.success("0b11")
    XCTAssertEqual(actual, expected)
    
    let actual2 = roundedAvg(n: 7, m: 5)
    let expected2 = Result<String, Int>.failure(-1)
    XCTAssertEqual(actual2, expected2)
    
    let actual3 = roundedAvg(n: 10, m: 20)
    let expected3 = Result<String, Int>.success("0b1111")
    XCTAssertEqual(actual3, expected3)
    
    let actual4 = roundedAvg(n: 20, m: 33)
    let expected4 = Result<String, Int>.success("0b11010")
    XCTAssertEqual(actual4, expected4)
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let average = (n + m) / 2
    let rounded = Int(average.rounded())
    let binary = String(rounded, radix: 2)
    return .success(binary)
}

func testRoundedAvg() {
    let actual = roundedAvg(n: 1, m: 5)
    let expected = .success("0b11")
    XCTAssertEqual(actual, expected)
    
    let actual2 = roundedAvg(n: 7, m: 5)
    let expected2 = .failure(-1)
    XCTAssertEqual(actual2, expected2)
    
    let actual3 = roundedAvg(n: 10, m: 20)
    let expected3 = .success("0b1111")
    XCTAssertEqual(actual3, expected3)
    
    let actual4 = roundedAvg(n: 20, m: 33)
    let expected4 = .success("0b11010")
    XCTAssertEqual(actual4, expected4)
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let average = (n + m) / 2
    let rounded = Int(average.rounded())
    let binary = String(rounded, radix: 2)
    return .success(binary)
}

// MARK: - Tests
func testRoundedAvg() {
    let actual = roundedAvg(n: 1, m: 5)
    let expected = .success("0b11")
    XCTAssertEqual(actual, expected)
    
    let actual2 = roundedAvg(n: 7, m: 5)
    let expected2 = .failure(-1)
    XCTAssertEqual(actual2, expected2)
    
    let actual3 = roundedAvg(n: 10, m: 20)
    let expected3 = .success("0b1111")
    XCTAssertEqual(actual3, expected3)
    
    let actual4 = roundedAvg(n: 20, m: 33)
    let expected4 = .success("0b11010")
    XCTAssertEqual(actual4, expected4)
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let rounded = Int(average.rounded()) // value of type 'Int' has no member 'rounded'
let expected = .success("0b11") // reference to member 'success' cannot be resolved without a contextual type
let expected2 = .failure(-1) // reference to member 'failure' cannot be resolved without a contextual type
let expected3 = .success("0b1111") // reference to member 'success' cannot be resolved without a contextual type
let expected4 = .success("0b11010") // reference to member 'success' cannot be resolved without a contextual type

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let avg = (n + m) / 2
    return .success(String(avg, radix: 2))
}

func letterCount(s: String) -> [(String, Int)] {
    var result = [(String, Int)]()
    for letter in s {
        if let index = result.firstIndex(where: { $0.0 == String(letter) }) {
            result[index].1 += 1
        } else {
            result.append((String(letter), 1))
        }
    }
    return result.sorted { $0.1 > $1.1 }
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let avg = (n + m) / 2
    return .success(String(avg, radix: 2))
}

// You are given a string s consisting of lowercase English letters. 
// Your task is to count the number of occurrences of each letter. 
// Return the result as an array of pairs (letter, count) ordered in non-increasing order by count. 
// If two or more letters occur the same number of times, order them lexicographically (alphabetically).
// Example:
// letterCount("aabbbc") == [("b", 3), ("a", 2), ("c", 1)]
// letterCount("aabbcc") == [("c", 2), ("b", 2), ("a", 1)]
// letterCount("abc") == [("c", 1), ("b", 1), ("a", 1)]
// letterCount("aabbccdd") == [("d", 2), ("c", 2), ("b", 2), ("a", 1)]
func letterCount(s: String) -> [(String, Int)] {
    var result = [(String, Int)]()
    for letter in s {
        if let index = result.firstIndex(where: { $0.0 == String(letter) }) {
            result[index].1 += 1
        } else {
            result.append((String(letter), 1))
        }
    }
    return result.sorted { $0.1 > $1.1 }
}

// You are given a string s consisting of lowercase English letters. 
// Your task is to count the number of occurrences of each letter. 
// Return the result as an array of pairs (letter, count) ordered in non-increasing order by count. 
// If two or more letters occur the same number of times, order them lexicographically (alphabetically).
// Example:
// letterCount("aabbbc") == [("b", 3), ("a", 2), ("c", 1)]
// letterCount("aabbcc") == [("c", 2), ("b", 2), ("a", 1)]
// letterCount("abc") == [("c", 1), ("b", 1), ("a", 1)]
// letterCount("aabbccdd") == [("d", 2), ("c", 2), ("b", 2), ("a", 1)]
func letterCount(s: String) -> [(String, Int)] {
    var result = [(String, Int)]()
    for letter in s {
        if let index = result.firstIndex(where: { $0.0 == String(letter) }) {
            result[index].1 += 1
        } else {
            result.append((String(letter), 1))
        }
    }
    return result.sorted { $0.1 > $1.1 }
}

// You are given a string s consisting of lowercase English letters. 
// Your task is to count the number of occurrences of each letter. 
// Return the result as an array of pairs (letter, count) ordered in non-increasing order by count. 
// If two or more letters occur the same number of times, order them lexicographically (alphabetically).
// Example:
// letterCount("aabbbc") == [("b", 3), ("a", 2), ("c", 1)]
// letterCount("aabbcc") == [("c", 2), ("b", 2), ("a", 1)]
// letterCount("abc") == [("c", 1), ("b", 1), ("a", 1)]
// letterCount("aabbccdd") == [("d", 2), ("c", 2), ("b", 2), ("a", 1)]
func letterCount(s: String) -> [(String, Int)] {
    var result = [(String, Int)]()
    for letter in s {
        if let index = result.firstIndex(where: { $0.0 == String(letter) }) {
            result[index].1 += 1
        } else {
            result.append((String(letter), 1))
        }
    }
    return result.sorted { $0.1 > $1.1 }
}

//
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let average = (n + m) / 2
    let rounded = Int(average.rounded())
    let binary = String(rounded, radix: 2)
    return .success(binary)
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) == .success("0b11")
// roundedAvg(n: 7, m: 5) == .failure(-1)
// roundedAvg(n: 10, m: 20) == .success("0b1111")
// roundedAvg(n: 20, m: 33) == .success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return .failure(-1) }
    let average = (n + m) / 2
    let rounded = Int(average.rounded())
    let binary = String(rounded, radix: 2)
    return .success(binary)
}

// You are given a positive integer n, and your task is to compute the sum of the
// digits of n.
// Example:
// sumDigits(n: 123) == .success(6)
// sumDigits(n: 1000) == .success(1)
// sumDigits(n: 10000) == .success(1)
// sumDigits(n: 100000) == .success(1)
// sumDigits(n: 1000000) == .success(2)
// sumDigits(n: 10000000) == .success(2)
// sumDigits(n: 100000000) == .success(2)
// sumDigits(n: 1000000000) == .success(2)
// sumDigits(n: 10000000000) == .success(2)
// sumDigits(n: 100000000000) == .success(2)
// sumDigits(n: 1000000000000) == .success(2)
// sumDigits(n: 10000000000000) == .success(2)
// sumDigits(n: 100000000000000) == .success(2)
// sumDigits(n: 1000000000000000) == .success(2)
// sumDigits(n: 10000000000000000) == .success(2)
// sumDigits(n: 100000000000000000) == .success(2)
// sumDigits(n: 1000000000000000000) == .success(2)
// sumDigits(n: 10000000000000000000) == .success(2)
// sumDigits(n: 100000000000000000000) == .success(2)
// sumDigits(n: 1000000000000000000000) == .success(2)
// sumDigits(n: 10000000000000000000000) == .success(2)
// sumDigits(n: 100000000000000000000000) == .success(2)
// sumDigits(n: 1000000000000000000000000) == .success(2)
// sumDigits(n: 10000000000000000000000000) == .success(2)
// sumDigits(n: 100000000000000000000000000) == .success(2)
// sumDigits(n: 1000000000000000000000000000) == .success(2)
// sumDigits(n: 10000000000000000000000000000) == .success(2)
// sumDigits(n: 100000000000000000000000000000) == .success(2)
// sumDigits(n: 100000
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let rounded = Int(average.rounded()) // value of type 'Int' has no member 'rounded'

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        var hasEvenDigit = false
        while number > 0 {
            let digit = number % 10
            if digit % 2 == 0 {
                hasEvenDigit = true
                break
            }
            number /= 10
        }
        if !hasEvenDigit {
            result.append(number)
        }
    }
    return result
}
```swift
// Given an array of positive integers x. return a sorted array of all 
// elements that hasn't any even digit.
// Note: Returned array should be sorted in increasing order.
// For example:
// uniqueDigits(x: [15, 33, 1422, 1]) == [1, 15, 33]
// uniqueDigits(x: [152, 323, 1422, 10]) == [] as [Int]
func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        var hasEvenDigit = false
        while number > 0 {
            let digit = number % 10
            if digit % 2 == 0 {
                hasEvenDigit = true
                break
            }
            number /= 10
        }
        if !hasEvenDigit {
            result.append(number)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        while number > 0 {
            let digit = number % 10
            if digit % 2 != 0 {
                result.append(number)
                break
            }
            number = number / 10
        }
    }
    return result.sorted()
}
```swift
// Given an array of positive integers x. return a sorted array of all 
// elements that hasn't any even digit.
// Note: Returned array should be sorted in increasing order.
// For example:
// uniqueDigits(x: [15, 33, 1422, 1]) == [1, 15, 33]
// uniqueDigits(x: [152, 323, 1422, 10]) == [] as [Int]
func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        while number > 0 {
            let digit = number % 10
            if digit % 2 != 0 {
                result.append(number)
                break
            }
            number = number / 10
        }
    }
    return result.sorted()
}
```
 // XCTAssertTrue failed

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        var hasEvenDigit = false
        while number > 0 {
            let digit = number % 10
            if digit % 2 == 0 {
                hasEvenDigit = true
                break
            }
            number /= 10
        }
        if !hasEvenDigit {
            result.append(number)
        }
    }
    return result.sorted()
}
```swift
// Given an array of positive integers x. return a sorted array of all 
// elements that hasn't any even digit.
// Note: Returned array should be sorted in increasing order.
// For example:
// uniqueDigits(x: [15, 33, 1422, 1]) == [1, 15, 33]
// uniqueDigits(x: [152, 323, 1422, 10]) == [] as [Int]
func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        var hasEvenDigit = false
        while number > 0 {
            let digit = number % 10
            if digit % 2 == 0 {
                hasEvenDigit = true
                break
            }
            number /= 10
        }
        if !hasEvenDigit {
            result.append(number)
        }
    }
    return result.sorted()
}
```
 // XCTAssertTrue failed

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        while number > 0 {
            let digit = number % 10
            if digit % 2 != 0 {
                result.append(number)
                break
            }
            number /= 10
        }
    }
    return result.sorted()
}
```swift
// Given an array of positive integers x. return a sorted array of all 
// elements that hasn't any even digit.
// Note: Returned array should be sorted in increasing order.
// For example:
// uniqueDigits(x: [15, 33, 1422, 1]) == [1, 15, 33]
// uniqueDigits(x: [152, 323, 1422, 10]) == [] as [Int]
func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        while number > 0 {
            let digit = number % 10
            if digit % 2 != 0 {
                result.append(number)
                break
            }
            number /= 10
        }
    }
    return result.sorted()
}
```
 // XCTAssertTrue failed

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        var hasEvenDigit = false
        while number > 0 {
            let digit = number % 10
            if digit % 2 == 0 {
                hasEvenDigit = true
                break
            }
            number /= 10
        }
        if !hasEvenDigit {
            result.append(number)
        }
    }
    return result
}
```swift
// Given an array of positive integers x. return a sorted array of all 
// elements that hasn't any even digit.
// Note: Returned array should be sorted in increasing order.
// For example:
// uniqueDigits(x: [15, 33, 1422, 1]) == [1, 15, 33]
// uniqueDigits(x: [152, 323, 1422, 10]) == [] as [Int]
func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        var hasEvenDigit = false
        while number > 0 {
            let digit = number % 10
            if digit % 2 == 0 {
                hasEvenDigit = true
                break
            }
            number /= 10
        }
        if !hasEvenDigit {
            result.append(number)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        var hasEvenDigit = false
        while number > 0 {
            let digit = number % 10
            if digit % 2 == 0 {
                hasEvenDigit = true
                break
            }
            number /= 10
        }
        if !hasEvenDigit {
            result.append(number)
        }
    }
    return result.sorted()
}
```swift
// Given an array of positive integers x. return a sorted array of all 
// elements that hasn't any even digit.
// Note: Returned array should be sorted in increasing order.
// For example:
// uniqueDigits(x: [15, 33, 1422, 1]) == [1, 15, 33]
// uniqueDigits(x: [152, 323, 1422, 10]) == [] as [Int]
func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        var hasEvenDigit = false
        while number > 0 {
            let digit = number % 10
            if digit % 2 == 0 {
                hasEvenDigit = true
                break
            }
            number /= 10
        }
        if !hasEvenDigit {
            result.append(number)
        }
    }
    return result.sorted()
}
```
 // XCTAssertTrue failed

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        var isUnique = true
        while number > 0 {
            let digit = number % 10
            if digit % 2 == 0 {
                isUnique = false
                break
            }
            number /= 10
        }
        if isUnique {
            result.append(number)
        }
    }
    return result
}
```swift
// Given an array of positive integers x. return a sorted array of all 
// elements that hasn't any even digit.
// Note: Returned array should be sorted in increasing order.
// For example:
// uniqueDigits(x: [15, 33, 1422, 1]) == [1, 15, 33]
// uniqueDigits(x: [152, 323, 1422, 10]) == [] as [Int]
func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        var isUnique = true
        while number > 0 {
            let digit = number % 10
            if digit % 2 == 0 {
                isUnique = false
                break
            }
            number /= 10
        }
        if isUnique {
            result.append(number)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        var temp = i
        while temp > 0 {
            let digit = temp % 10
            if digit % 2 != 0 {
                result.append(digit)
            }
            temp /= 10
        }
    }
    return result.sorted()
}
```swift
// Given an array of positive integers x. return a sorted array of all 
// elements that hasn't any even digit.
// Note: Returned array should be sorted in increasing order.
// For example:
// uniqueDigits(x: [15, 33, 1422, 1]) == [1, 15, 33]
// uniqueDigits(x: [152, 323, 1422, 10]) == [] as [Int]
func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        var temp = i
        while temp > 0 {
            let digit = temp % 10
            if digit % 2 != 0 {
                result.append(digit)
            }
            temp /= 10
        }
    }
    return result.sorted()
}
```
 // XCTAssertTrue failed

func uniqueDigits(x: [Int]) -> [Int] {
    var result: [Int] = []
    for number in x {
        var number = number
        var hasEvenDigit = false
        while number > 0 {
            let digit = number % 10
            if digit % 2 == 0 {
                hasEvenDigit = true
                break
            }
            number /= 10
        }
        if !hasEvenDigit {
            result.append(number)
        }
    }
    return result.sorted()
}
```swift
// Given an array of positive integers x. return a sorted array of all 
// elements that hasn't any even digit.
// Note: Returned array should be sorted in increasing order.
// For example:
// uniqueDigits(x: [15, 33, 1422, 1]) == [1, 15, 33]
// uniqueDigits(x: [152, 323, 1422, 10]) == [] as [Int]
func uniqueDigits(x: [Int]) -> [Int] {
    var result: [Int] = []
    for number in x {
        var number = number
        var hasEvenDigit = false
        while number > 0 {
            let digit = number % 10
            if digit % 2 == 0 {
                hasEvenDigit = true
                break
            }
            number /= 10
        }
        if !hasEvenDigit {
            result.append(number)
        }
    }
    return result.sorted()
}
```
 // XCTAssertTrue failed

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        while number > 0 {
            let digit = number % 10
            if digit % 2 != 0 {
                result.append(number % 10)
            }
            number /= 10
        }
    }
    return result.sorted()
}
```swift
// Given an array of positive integers x. return a sorted array of all 
// elements that hasn't any even digit.
// Note: Returned array should be sorted in increasing order.
// For example:
// uniqueDigits(x: [15, 33, 1422, 1]) == [1, 15, 33]
// uniqueDigits(x: [152, 323, 1422, 10]) == [] as [Int]
func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for number in x {
        var number = number
        while number > 0 {
            let digit = number % 10
            if digit % 2 != 0 {
                result.append(number % 10)
            }
            number /= 10
        }
    }
    return result.sorted()
}
```
 // XCTAssertTrue failed

func byLength(arr: [Int]) -> [String] {
    let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    var result = [String]()
    for number in numbers {
        if let index = arr.firstIndex(of: number) {
            result.append(String(number))
            arr.remove(at: index)
        }
    }
    return result.reversed()
}
```swift
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace each digit by its corresponding name from
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// If the array is empty, return an empty array:
// If the array has any strange number ignore it:
// byLength(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
// byLength(arr: [] as [Int]) == [] as [String]
// byLength(arr: [1, -1, 55]) == ["One"]
func byLength(arr: [Int]) -> [String] {
    let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    var result = [String]()
    for number in numbers {
        if let index = arr.firstIndex(of: number) {
            result.append(String(number))
            arr.remove(at: index)
        }
    }
    return result.reversed()
}
```
arr.remove(at: index) // cannot use mutating member on immutable value: 'arr' is a 'let' constant

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var temp = [Int]()
    for i in 1...9 {
        for j in arr {
            if j == i {
                temp.append(j)
            }
        }
        result.append(String(temp.reversed().map { String($0) }))
        temp.removeAll()
    }
    return result
}
```swift
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace each digit by its corresponding name from
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// If the array is empty, return an empty array:
// If the array has any strange number ignore it:
// byLength(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
// byLength(arr: [] as [Int]) == [] as [String]
// byLength(arr: [1, -1, 55]) == ["One"]
func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var temp = [Int]()
    for i in 1...9 {
        for j in arr {
            if j == i {
                temp.append(j)
            }
        }
        result.append(String(temp.reversed().map { String($0) }))
        temp.removeAll()
    }
    return result
}
```
result.append(String(temp.reversed().map { String($0) })) // no exact matches in call to initializer

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    for i in 1...9 {
        if let index = arr.firstIndex(where: { $0 == i }) {
            result.append(String(i))
            arr.remove(at: index)
        }
    }
    return result.reversed()
}
```swift
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace each digit by its corresponding name from
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// If the array is empty, return an empty array:
// If the array has any strange number ignore it:
// byLength(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
// byLength(arr: [] as [Int]) == [] as [String]
// byLength(arr: [1, -1, 55]) == ["One"]
func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    for i in 1...9 {
        if let index = arr.firstIndex(where: { $0 == i }) {
            result.append(String(i))
            arr.remove(at: index)
        }
    }
    return result.reversed()
}
```
arr.remove(at: index) // cannot use mutating member on immutable value: 'arr' is a 'let' constant

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var temp = [Int]()
    for i in 1...9 {
        for j in arr {
            if j == i {
                temp.append(i)
            }
        }
        result.append(String(temp.reversed().map { String($0) }))
        temp.removeAll()
    }
    return result
}
```swift
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace each digit by its corresponding name from
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// If the array is empty, return an empty array:
// If the array has any strange number ignore it:
// byLength(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
// byLength(arr: [] as [Int]) == [] as [String]
// byLength(arr: [1, -1, 55]) == ["One"]
func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var temp = [Int]()
    for i in 1...9 {
        for j in arr {
            if j == i {
                temp.append(i)
            }
        }
        result.append(String(temp.reversed().map { String($0) }))
        temp.removeAll()
    }
    return result
}
```
result.append(String(temp.reversed().map { String($0) })) // no exact matches in call to initializer

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var temp = [Int]()
    for i in 1...9 {
        for j in 0..<arr.count {
            if arr[j] == i {
                temp.append(i)
            }
        }
        result.append(String(temp.reversed().map { String($0) }))
        temp.removeAll()
    }
    return result
}
```swift
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace each digit by its corresponding name from
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// If the array is empty, return an empty array:
// If the array has any strange number ignore it:
// byLength(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
// byLength(arr: [] as [Int]) == [] as [String]
// byLength(arr: [1, -1, 55]) == ["One"]
func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var temp = [Int]()
    for i in 1...9 {
        for j in 0..<arr.count {
            if arr[j] == i {
                temp.append(i)
            }
        }
        result.append(String(temp.reversed().map { String($0) }))
        temp.removeAll()
    }
    return result
}
```
result.append(String(temp.reversed().map { String($0) })) // no exact matches in call to initializer

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var numbers = [Int]()
    for number in arr {
        if number >= 1 && number <= 9 {
            numbers.append(number)
        }
    }
    numbers.sort()
    numbers.reverse()
    for number in numbers {
        switch number {
        case 1:
            result.append("One")
        case 2:
            result.append("Two")
        case 3:
            result.append("Three")
        case 4:
            result.append("Four")
        case 5:
            result.append("Five")
        case 6:
            result.append("Six")
        case 7:
            result.append("Seven")
        case 8:
            result.append("Eight")
        case 9:
            result.append("Nine")
        default:
            break
        }
    }
    return result
}
```swift
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace each digit by its corresponding name from
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// If the array is empty, return an empty array:
// If the array has any strange number ignore it:
// byLength(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
// byLength(arr: [] as [Int]) == [] as [String]
// byLength(arr: [1, -1, 55]) == ["One"]
func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var numbers = [Int]()
    for number in arr {
        if number >= 1 && number <= 9 {
            numbers.append(number)
        }
    }
    numbers.sort()
    numbers.reverse()
    for number in numbers {
        switch number {
        case 1:
            result.append("One")
        case 2:
            result.append("Two")
        case 3:
            result.append("Three")
        case 4:
            result.append("Four")
        case 5:
            result.append("Five")
        case 6:
            result.append("Six")
        case 7:
            result.append("Seven")
        case 8:
            result.append("Eight")
        case 9:
            result.append("Nine")
        default:
            break
        }
    }
    return result
}
```

func byLength(arr: [Int]) -> [String] {
    guard !arr.isEmpty else { return [] }
    var result = [String]()
    for i in 1...9 {
        if arr.contains(i) {
            result.append(String(i))
        }
    }
    result.reverse()
    return result.map { String(format: "%d", $0) }
}
```swift
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace each digit by its corresponding name from
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// If the array is empty, return an empty array:
// If the array has any strange number ignore it:
// byLength(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
// byLength(arr: [] as [Int]) == [] as [String]
// byLength(arr: [1, -1, 55]) == ["One"]
func byLength(arr: [Int]) -> [String] {
    guard !arr.isEmpty else { return [] }
    var result = [String]()
    for i in 1...9 {
        if arr.contains(i) {
            result.append(String(i))
        }
    }
    result.reverse()
    return result.map { String(format: "%d", $0) }
}
```
 // XCTAssertTrue failed

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    for number in arr {
        if number >= 1 && number <= 9 {
            result.append(String(number))
            numbers.remove(at: numbers.firstIndex(of: number)!)
        }
    }
    result.append(contentsOf: numbers.reversed().map { String($0) })
    return result
}
```swift
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace each digit by its corresponding name from
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// If the array is empty, return an empty array:
// If the array has any strange number ignore it:
// byLength(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
// byLength(arr: [] as [Int]) == [] as [String]
// byLength(arr: [1, -1, 55]) == ["One"]
func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    for number in arr {
        if number >= 1 && number <= 9 {
            result.append(String(number))
            numbers.remove(at: numbers.firstIndex(of: number)!)
        }
    }
    result.append(contentsOf: numbers.reversed().map { String($0) })
    return result
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var sorted = arr.sorted()
    for i in 1...9 {
        if let index = sorted.firstIndex(of: i) {
            result.append(String(i))
            sorted.remove(at: index)
        }
    }
    return result.reversed()
}
```swift
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace each digit by its corresponding name from
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// If the array is empty, return an empty array:
// If the array has any strange number ignore it:
// byLength(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
// byLength(arr: [] as [Int]) == [] as [String]
// byLength(arr: [1, -1, 55]) == ["One"]
func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var sorted = arr.sorted()
    for i in 1...9 {
        if let index = sorted.firstIndex(of: i) {
            result.append(String(i))
            sorted.remove(at: index)
        }
    }
    return result.reversed()
}
```
 // XCTAssertTrue failed

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var temp = [Int]()
    for i in 1...9 {
        if arr.contains(i) {
            temp.append(i)
        }
    }
    temp.sort()
    temp.reverse()
    for i in 0..<temp.count {
        result.append(String(temp[i]))
    }
    return result
}
```swift
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace each digit by its corresponding name from
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// If the array is empty, return an empty array:
// If the array has any strange number ignore it:
// byLength(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
// byLength(arr: [] as [Int]) == [] as [String]
// byLength(arr: [1, -1, 55]) == ["One"]
func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var temp = [Int]()
    for i in 1...9 {
        if arr.contains(i) {
            temp.append(i)
        }
    }
    temp.sort()
    temp.reverse()
    for i in 0..<temp.count {
        result.append(String(temp[i]))
    }
    return result
}
```
 // XCTAssertTrue failed

func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 1...n {
        if i % 2 == 0 {
            result[i - 1] = factorial(i)
        } else {
            result[i - 1] = sum(1...i)
        }
    }
    return result
}

func factorial(_ n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}

func sum(_ n: Int) -> Int {
    var result = 0
    for i in 1...n {
        result += i
    }
    return result
}
```swift
// Implement the function f that takes n as a parameter,
// and returns an array of size n, such that the value of the element at index i is the factorial of i if i is even
// or the sum of numbers from 1 to i otherwise.
// i starts from 1.
// the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
// Example:
// f(n: 5) == [1, 2, 6, 24, 15]
func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 1...n {
        if i % 2 == 0 {
            result[i - 1] = factorial(i)
        } else {
            result[i - 1] = sum(1...i)
        }
    }
    return result
}

func factorial(_ n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}

func sum(_ n: Int) -> Int {
    var result = 0
    for i in 1...n {
        result += i
    }
    return result
}
```
result[i - 1] = sum(1...i) // cannot convert value of type 'ClosedRange<Int>' to expected argument type 'Int'

func f(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        if i % 2 == 0 {
            result.append(i)
        } else {
            var sum = 0
            for j in 1...i {
                sum += j
            }
            result.append(sum)
        }
    }
    return result
}
```swift
// Implement the function f that takes n as a parameter,
// and returns an array of size n, such that the value of the element at index i is the factorial of i if i is even
// or the sum of numbers from 1 to i otherwise.
// i starts from 1.
// the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
// Example:
// f(n: 5) == [1, 2, 6, 24, 15]
func f(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        if i % 2 == 0 {
            result.append(i)
        } else {
            var sum = 0
            for j in 1...i {
                sum += j
            }
            result.append(sum)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 1...n {
        if i % 2 == 0 {
            result[i - 1] = factorial(n: i)
        } else {
            result[i - 1] = sum(n: i)
        }
    }
    return result
}

func factorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}

func sum(n: Int) -> Int {
    var result = 0
    for i in 1...n {
        result += i
    }
    return result
}
```swift
// Implement the function f that takes n as a parameter,
// and returns an array of size n, such that the value of the element at index i is the factorial of i if i is even
// or the sum of numbers from 1 to i otherwise.
// i starts from 1.
// the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
// Example:
// f(n: 5) == [1, 2, 6, 24, 15]
func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 1...n {
        if i % 2 == 0 {
            result[i - 1] = factorial(n: i)
        } else {
            result[i - 1] = sum(n: i)
        }
    }
    return result
}

func factorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}

func sum(n: Int) -> Int {
    var result = 0
    for i in 1...n {
        result += i
    }
    return result
}
```

func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 1...n {
        if i % 2 == 0 {
            result[i - 1] = i
        } else {
            result[i - 1] = result[i - 2] + i
        }
    }
    return result
}
```swift
// Implement the function f that takes n as a parameter,
// and returns an array of size n, such that the value of the element at index i is the factorial of i if i is even
// or the sum of numbers from 1 to i otherwise.
// i starts from 1.
// the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
// Example:
// f(n: 5) == [1, 2, 6, 24, 15]
func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 1...n {
        if i % 2 == 0 {
            result[i - 1] = i
        } else {
            result[i - 1] = result[i - 2] + i
        }
    }
    return result
}
```
 // Fatal error: Index out of range

func f(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        if i % 2 == 0 {
            result.append(factorial(i))
        } else {
            result.append(sum(1...i))
        }
    }
    return result
}

func factorial(_ n: Int) -> Int {
    if n == 1 {
        return 1
    }
    return n * factorial(n - 1)
}

func sum(_ n: Int...) -> Int {
    return n.reduce(0, +)
}
```swift
// Implement the function f that takes n as a parameter,
// and returns an array of size n, such that the value of the element at index i is the factorial of i if i is even
// or the sum of numbers from 1 to i otherwise.
// i starts from 1.
// the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
// Example:
// f(n: 5) == [1, 2, 6, 24, 15]
func f(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        if i % 2 == 0 {
            result.append(factorial(i))
        } else {
            result.append(sum(1...i))
        }
    }
    return result
}

func factorial(_ n: Int) -> Int {
    if n == 1 {
        return 1
    }
    return n * factorial(n - 1)
}

func sum(_ n: Int...) -> Int {
    return n.reduce(0, +)
}
```
result.append(sum(1...i)) // cannot convert value of type 'ClosedRange<Int>' to expected argument type 'Int'

func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 1...n {
        if i % 2 == 0 {
            result[i - 1] = factorial(i)
        } else {
            result[i - 1] = sum(i)
        }
    }
    return result
}

func factorial(_ n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}

func sum(_ n: Int) -> Int {
    var result = 0
    for i in 1...n {
        result += i
    }
    return result
}
```swift
// Implement the function f that takes n as a parameter,
// and returns an array of size n, such that the value of the element at index i is the factorial of i if i is even
// or the sum of numbers from 1 to i otherwise.
// i starts from 1.
// the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
// Example:
// f(n: 5) == [1, 2, 6, 24, 15]
func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 1...n {
        if i % 2 == 0 {
            result[i - 1] = factorial(i)
        } else {
            result[i - 1] = sum(i)
        }
    }
    return result
}

func factorial(_ n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}

func sum(_ n: Int) -> Int {
    var result = 0
    for i in 1...n {
        result += i
    }
    return result
}
```

func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 1...n {
        if i % 2 == 0 {
            result[i - 1] = factorial(i)
        } else {
            result[i - 1] = sum(i)
        }
    }
    return result
}

func factorial(_ n: Int) -> Int {
    if n == 1 {
        return 1
    }
    return n * factorial(n - 1)
}

func sum(_ n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```swift
// Implement the function f that takes n as a parameter,
// and returns an array of size n, such that the value of the element at index i is the factorial of i if i is even
// or the sum of numbers from 1 to i otherwise.
// i starts from 1.
// the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
// Example:
// f(n: 5) == [1, 2, 6, 24, 15]
func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 1...n {
        if i % 2 == 0 {
            result[i - 1] = factorial(i)
        } else {
            result[i - 1] = sum(i)
        }
    }
    return result
}

func factorial(_ n: Int) -> Int {
    if n == 1 {
        return 1
    }
    return n * factorial(n - 1)
}

func sum(_ n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```

func f(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        if i % 2 == 0 {
            result.append(i)
        } else {
            var sum = 0
            for j in 1...i {
                sum += j
            }
            result.append(sum)
        }
    }
    return result
}
```swift
// Implement the function f that takes n as a parameter,
// and returns an array of size n, such that the value of the element at index i is the factorial of i if i is even
// or the sum of numbers from 1 to i otherwise.
// i starts from 1.
// the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
// Example:
// f(n: 5) == [1, 2, 6, 24, 15]
func f(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        if i % 2 == 0 {
            result.append(i)
        } else {
            var sum = 0
            for j in 1...i {
                sum += j
            }
            result.append(sum)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 1...n {
        if i % 2 == 0 {
            result[i - 1] = i
        } else {
            result[i - 1] = (1...i).reduce(0, +)
        }
    }
    return result
}
```swift
// Implement the function f that takes n as a parameter,
// and returns an array of size n, such that the value of the element at index i is the factorial of i if i is even
// or the sum of numbers from 1 to i otherwise.
// i starts from 1.
// the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
// Example:
// f(n: 5) == [1, 2, 6, 24, 15]
func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 1...n {
        if i % 2 == 0 {
            result[i - 1] = i
        } else {
            result[i - 1] = (1...i).reduce(0, +)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 0..<n {
        if i % 2 == 0 {
            result[i] = factorial(of: i)
        } else {
            result[i] = sum(of: i)
        }
    }
    return result
}

func factorial(of n: Int) -> Int {
    guard n > 0 else { return 1 }
    return n * factorial(of: n - 1)
}

func sum(of n: Int) -> Int {
    guard n > 0 else { return 0 }
    return n + sum(of: n - 1)
}
```swift
// Implement the function f that takes n as a parameter,
// and returns an array of size n, such that the value of the element at index i is the factorial of i if i is even
// or the sum of numbers from 1 to i otherwise.
// i starts from 1.
// the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
// Example:
// f(n: 5) == [1, 2, 6, 24, 15]
func f(n: Int) -> [Int] {
    var result = [Int](repeating: 0, count: n)
    for i in 0..<n {
        if i % 2 == 0 {
            result[i] = factorial(of: i)
        } else {
            result[i] = sum(of: i)
        }
    }
    return result
}

func factorial(of n: Int) -> Int {
    guard n > 0 else { return 1 }
    return n * factorial(of: n - 1)
}

func sum(of n: Int) -> Int {
    guard n > 0 else { return 0 }
    return n + sum(of: n - 1)
}
```
 // XCTAssertTrue failed

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        let str = String(i)
        if str == str.reversed() {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}
```swift
// Given a positive integer n, return a tuple that has the number of even and odd
// integer palindromes that fall within the range(1, n), inclusive.
// Example 1:
// Explanation:
// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
// Example 2:
// Explanation:
// Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
// Note:
// 1. 1 <= n <= 10^3
// 2. returned tuple has the number of even and odd integer palindromes respectively.
// evenOddPalindrome(n: 3) == (1, 2)
// evenOddPalindrome(n: 12) == (4, 6)
func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        let str = String(i)
        if str == str.reversed() {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}
```
if str == str.reversed() { // binary operator '==' cannot be applied to operands of type 'String' and '[String.Element]' (aka 'Array<Character>')

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(_ n: Int) -> Bool {
    var n = n
    var reversed = 0
    while n > 0 {
        reversed = reversed * 10 + n % 10
        n /= 10
    }
    return n == reversed
}
```swift
// Given a positive integer n, return a tuple that has the number of even and odd
// integer palindromes that fall within the range(1, n), inclusive.
// Example 1:
// Explanation:
// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
// Example 2:
// Explanation:
// Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
// Note:
// 1. 1 <= n <= 10^3
// 2. returned tuple has the number of even and odd integer palindromes respectively.
// evenOddPalindrome(n: 3) == (1, 2)
// evenOddPalindrome(n: 12) == (4, 6)
func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(_ n: Int) -> Bool {
    var n = n
    var reversed = 0
    while n > 0 {
        reversed = reversed * 10 + n % 10
        n /= 10
    }
    return n == reversed
}
```
 // XCTAssertTrue failed

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if isEvenPalindrome(i) {
            even += 1
        }
        if isOddPalindrome(i) {
            odd += 1
        }
    }
    return (even, odd)
}

func isEvenPalindrome(_ n: Int) -> Bool {
    let str = String(n)
    let strReverse = String(str.reversed())
    return str == strReverse
}

func isOddPalindrome(_ n: Int) -> Bool {
    let str = String(n)
    let strReverse = String(str.reversed())
    return str.dropFirst() == strReverse.dropLast()
}
```swift
// Given a positive integer n, return a tuple that has the number of even and odd
// integer palindromes that fall within the range(1, n), inclusive.
// Example 1:
// Explanation:
// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
// Example 2:
// Explanation:
// Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
// Note:
// 1. 1 <= n <= 10^3
// 2. returned tuple has the number of even and odd integer palindromes respectively.
// evenOddPalindrome(n: 3) == (1, 2)
// evenOddPalindrome(n: 12) == (4, 6)
func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if isEvenPalindrome(i) {
            even += 1
        }
        if isOddPalindrome(i) {
            odd += 1
        }
    }
    return (even, odd)
}

func isEvenPalindrome(_ n: Int) -> Bool {
    let str = String(n)
    let strReverse = String(str.reversed())
    return str == strReverse
}

func isOddPalindrome(_ n: Int) -> Bool {
    let str = String(n)
    let strReverse = String(str.reversed())
    return str.dropFirst() == strReverse.dropLast()
}
```
 // XCTAssertTrue failed

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        let str = String(i)
        if str.isPalindrome && i % 2 == 0 {
            even += 1
        } else if str.isPalindrome && i % 2 != 0 {
            odd += 1
        }
    }
    return (even, odd)
}
```swift
// Given a positive integer n, return a tuple that has the number of even and odd
// integer palindromes that fall within the range(1, n), inclusive.
// Example 1:
// Explanation:
// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
// Example 2:
// Explanation:
// Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
// Note:
// 1. 1 <= n <= 10^3
// 2. returned tuple has the number of even and odd integer palindromes respectively.
// evenOddPalindrome(n: 3) == (1, 2)
// evenOddPalindrome(n: 12) == (4, 6)
func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        let str = String(i)
        if str.isPalindrome && i % 2 == 0 {
            even += 1
        } else if str.isPalindrome && i % 2 != 0 {
            odd += 1
        }
    }
    return (even, odd)
}
```
if str.isPalindrome && i % 2 == 0 { // value of type 'String' has no member 'isPalindrome'
} else if str.isPalindrome && i % 2 != 0 { // value of type 'String' has no member 'isPalindrome'

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if i.description.isPalindrome && i % 2 == 0 {
            even += 1
        } else if i.description.isPalindrome && i % 2 != 0 {
            odd += 1
        }
    }
    return (even, odd)
}
```swift
// Given a positive integer n, return a tuple that has the number of even and odd
// integer palindromes that fall within the range(1, n), inclusive.
// Example 1:
// Explanation:
// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
// Example 2:
// Explanation:
// Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
// Note:
// 1. 1 <= n <= 10^3
// 2. returned tuple has the number of even and odd integer palindromes respectively.
// evenOddPalindrome(n: 3) == (1, 2)
// evenOddPalindrome(n: 12) == (4, 6)
func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if i.description.isPalindrome && i % 2 == 0 {
            even += 1
        } else if i.description.isPalindrome && i % 2 != 0 {
            odd += 1
        }
    }
    return (even, odd)
}
```
if i.description.isPalindrome && i % 2 == 0 { // value of type 'String' has no member 'isPalindrome'
} else if i.description.isPalindrome && i % 2 != 0 { // value of type 'String' has no member 'isPalindrome'

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        let s = String(i)
        if s == s.reversed() {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}
```swift
// Given a positive integer n, return a tuple that has the number of even and odd
// integer palindromes that fall within the range(1, n), inclusive.
// Example 1:
// Explanation:
// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
// Example 2:
// Explanation:
// Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
// Note:
// 1. 1 <= n <= 10^3
// 2. returned tuple has the number of even and odd integer palindromes respectively.
// evenOddPalindrome(n: 3) == (1, 2)
// evenOddPalindrome(n: 12) == (4, 6)
func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        let s = String(i)
        if s == s.reversed() {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}
```
if s == s.reversed() { // binary operator '==' cannot be applied to operands of type 'String' and '[String.Element]' (aka 'Array<Character>')

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if i.description.isPalindrome && i % 2 == 0 {
            even += 1
        } else if i.description.isPalindrome && i % 2 != 0 {
            odd += 1
        }
    }
    return (even, odd)
}
```swift
// Given a positive integer n, return a tuple that has the number of even and odd
// integer palindromes that fall within the range(1, n), inclusive.
// Example 1:
// Explanation:
// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
// Example 2:
// Explanation:
// Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
// Note:
// 1. 1 <= n <= 10^3
// 2. returned tuple has the number of even and odd integer palindromes respectively.
// evenOddPalindrome(n: 3) == (1, 2)
// evenOddPalindrome(n: 12) == (4, 6)
func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if i.description.isPalindrome && i % 2 == 0 {
            even += 1
        } else if i.description.isPalindrome && i % 2 != 0 {
            odd += 1
        }
    }
    return (even, odd)
}
```
if i.description.isPalindrome && i % 2 == 0 { // value of type 'String' has no member 'isPalindrome'
} else if i.description.isPalindrome && i % 2 != 0 { // value of type 'String' has no member 'isPalindrome'

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        let str = String(i)
        if str == str.reversed() {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}
```swift
// Given a positive integer n, return a tuple that has the number of even and odd
// integer palindromes that fall within the range(1, n), inclusive.
// Example 1:
// Explanation:
// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
// Example 2:
// Explanation:
// Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
// Note:
// 1. 1 <= n <= 10^3
// 2. returned tuple has the number of even and odd integer palindromes respectively.
// evenOddPalindrome(n: 3) == (1, 2)
// evenOddPalindrome(n: 12) == (4, 6)
func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        let str = String(i)
        if str == str.reversed() {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}
```
if str == str.reversed() { // binary operator '==' cannot be applied to operands of type 'String' and '[String.Element]' (aka 'Array<Character>')

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(_ n: Int) -> Bool {
    var n = n
    var reversed = 0
    while n > 0 {
        reversed = reversed * 10 + n % 10
        n /= 10
    }
    return n == reversed
}
```swift
// Given a positive integer n, return a tuple that has the number of even and odd
// integer palindromes that fall within the range(1, n), inclusive.
// Example 1:
// Explanation:
// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
// Example 2:
// Explanation:
// Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
// Note:
// 1. 1 <= n <= 10^3
// 2. returned tuple has the number of even and odd integer palindromes respectively.
// evenOddPalindrome(n: 3) == (1, 2)
// evenOddPalindrome(n: 12) == (4, 6)
func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(_ n: Int) -> Bool {
    var n = n
    var reversed = 0
    while n > 0 {
        reversed = reversed * 10 + n % 10
        n /= 10
    }
    return n == reversed
}
```
 // XCTAssertTrue failed

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if i == Int(String(i).reversed().map { Int(String($0))! }) {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}
```swift
// Given a positive integer n, return a tuple that has the number of even and odd
// integer palindromes that fall within the range(1, n), inclusive.
// Example 1:
// Explanation:
// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
// Example 2:
// Explanation:
// Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
// Note:
// 1. 1 <= n <= 10^3
// 2. returned tuple has the number of even and odd integer palindromes respectively.
// evenOddPalindrome(n: 3) == (1, 2)
// evenOddPalindrome(n: 12) == (4, 6)
func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if i == Int(String(i).reversed().map { Int(String($0))! }) {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}
```
if i == Int(String(i).reversed().map { Int(String($0))! }) { // no exact matches in call to initializer

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        if sumOfDigits(num) > 0 {
            count += 1
        }
    }
    return count
}

func sumOfDigits(_ num: Int) -> Int {
    var sum = 0
    var n = num
    while n > 0 {
        sum += n % 10
        n /= 10
    }
    return sum
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        if sumOfDigits(num) > 0 {
            count += 1
        }
    }
    return count
}

func sumOfDigits(_ num: Int) -> Int {
    var sum = 0
    var n = num
    while n > 0 {
        sum += n % 10
        n /= 10
    }
    return sum
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var num = num
        while num != 0 {
            sum += num % 10
            num /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var num = num
        while num != 0 {
            sum += num % 10
            num /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        if num > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        if num > 0 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var n = num
        while n > 0 {
            sum += n % 10
            n /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var n = num
        while n > 0 {
            sum += n % 10
            n /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var n = num
        while n != 0 {
            sum += n % 10
            n /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var n = num
        while n != 0 {
            sum += n % 10
            n /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        if num > 0 {
            count += 1
        } else {
            var sum = 0
            var num = num
            while num != 0 {
                sum += num % 10
                num /= 10
            }
            if sum > 0 {
                count += 1
            }
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        if num > 0 {
            count += 1
        } else {
            var sum = 0
            var num = num
            while num != 0 {
                sum += num % 10
                num /= 10
            }
            if sum > 0 {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var num = num
        while num != 0 {
            sum += num % 10
            num /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var num = num
        while num != 0 {
            sum += num % 10
            num /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var num = num
        while num != 0 {
            sum += num % 10
            num /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var num = num
        while num != 0 {
            sum += num % 10
            num /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var num = num
        while num != 0 {
            sum += num % 10
            num /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var num = num
        while num != 0 {
            sum += num % 10
            num /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var num = num
        while num != 0 {
            sum += num % 10
            num /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        var num = num
        while num != 0 {
            sum += num % 10
            num /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var arr = arr
    var i = 0
    while i < arr.count {
        if arr[i] < arr[i + 1] {
            arr[i] = arr[i + 1]
            i += 1
        } else {
            break
        }
    }
    return i == arr.count - 1
}
```swift
// We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
// numbers in the array will be randomly ordered. Your task is to determine if
// it is possible to get an array sorted in non-decreasing order by performing 
// the following operation on the given array:
// You are allowed to perform right shift operation any number of times.
// One right shift operation means shifting all elements of the array by one
// position in the right direction. The last element of the array will be moved to
// the starting position in the array i.e. 0th index. 
// If it is possible to obtain the sorted array by performing the above operation
// then return true else return false.
// If the given array is empty then return true.
// Note: The given array is guaranteed to have unique elements.
// For Example:
// Explanation: By performin 2 right shift operations, non-decreasing order can
// be achieved for the given array.
// Explanation:It is not possible to get non-decreasing order for the given
// array by performing any number of right shift operations.
// moveOneBall(arr: [3, 4, 5, 1, 2]) == true
// moveOneBall(arr: [3, 5, 4, 1, 2]) == false
func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var arr = arr
    var i = 0
    while i < arr.count {
        if arr[i] < arr[i + 1] {
            arr[i] = arr[i + 1]
            i += 1
        } else {
            break
        }
    }
    return i == arr.count - 1
}
```
 // XCTAssertTrue failed

func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var arr = arr
    var i = 0
    while i < arr.count {
        if arr[i] < arr[i + 1] {
            arr[i] = arr[i + 1]
            arr[i + 1] = arr[i + 2]
            arr[i + 2] = arr[i + 3]
            arr[i + 3] = arr[i + 4]
            arr[i + 4] = arr[i]
            i += 1
        } else {
            i += 1
        }
    }
    return arr.sorted() == arr
}
```swift
// We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
// numbers in the array will be randomly ordered. Your task is to determine if
// it is possible to get an array sorted in non-decreasing order by performing 
// the following operation on the given array:
// You are allowed to perform right shift operation any number of times.
// One right shift operation means shifting all elements of the array by one
// position in the right direction. The last element of the array will be moved to
// the starting position in the array i.e. 0th index. 
// If it is possible to obtain the sorted array by performing the above operation
// then return true else return false.
// If the given array is empty then return true.
// Note: The given array is guaranteed to have unique elements.
// For Example:
// Explanation: By performin 2 right shift operations, non-decreasing order can
// be achieved for the given array.
// Explanation:It is not possible to get non-decreasing order for the given
// array by performing any number of right shift operations.
// moveOneBall(arr: [3, 4, 5, 1, 2]) == true
// moveOneBall(arr: [3, 5, 4, 1, 2]) == false
func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var arr = arr
    var i = 0
    while i < arr.count {
        if arr[i] < arr[i + 1] {
            arr[i] = arr[i + 1]
            arr[i + 1] = arr[i + 2]
            arr[i + 2] = arr[i + 3]
            arr[i + 3] = arr[i + 4]
            arr[i + 4] = arr[i]
            i += 1
        } else {
            i += 1
        }
    }
    return arr.sorted() == arr
}
```
 // Fatal error: Index out of range

func moveOneBall(arr: [Int]) -> Bool {
    var arr = arr
    var i = 0
    while i < arr.count {
        if arr[i] < arr[i + 1] {
            return true
        }
        i += 1
    }
    return false
}
```swift
// We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
// numbers in the array will be randomly ordered. Your task is to determine if
// it is possible to get an array sorted in non-decreasing order by performing 
// the following operation on the given array:
// You are allowed to perform right shift operation any number of times.
// One right shift operation means shifting all elements of the array by one
// position in the right direction. The last element of the array will be moved to
// the starting position in the array i.e. 0th index. 
// If it is possible to obtain the sorted array by performing the above operation
// then return true else return false.
// If the given array is empty then return true.
// Note: The given array is guaranteed to have unique elements.
// For Example:
// Explanation: By performin 2 right shift operations, non-decreasing order can
// be achieved for the given array.
// Explanation:It is not possible to get non-decreasing order for the given
// array by performing any number of right shift operations.
// moveOneBall(arr: [3, 4, 5, 1, 2]) == true
// moveOneBall(arr: [3, 5, 4, 1, 2]) == false
func moveOneBall(arr: [Int]) -> Bool {
    var arr = arr
    var i = 0
    while i < arr.count {
        if arr[i] < arr[i + 1] {
            return true
        }
        i += 1
    }
    return false
}
```
var arr = arr // variable 'arr' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var sorted = arr.sorted()
    var index = 0
    while index < arr.count {
        if arr[index] != sorted[index] {
            return false
        }
        index += 1
    }
    return true
}
```swift
// We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
// numbers in the array will be randomly ordered. Your task is to determine if
// it is possible to get an array sorted in non-decreasing order by performing 
// the following operation on the given array:
// You are allowed to perform right shift operation any number of times.
// One right shift operation means shifting all elements of the array by one
// position in the right direction. The last element of the array will be moved to
// the starting position in the array i.e. 0th index. 
// If it is possible to obtain the sorted array by performing the above operation
// then return true else return false.
// If the given array is empty then return true.
// Note: The given array is guaranteed to have unique elements.
// For Example:
// Explanation: By performin 2 right shift operations, non-decreasing order can
// be achieved for the given array.
// Explanation:It is not possible to get non-decreasing order for the given
// array by performing any number of right shift operations.
// moveOneBall(arr: [3, 4, 5, 1, 2]) == true
// moveOneBall(arr: [3, 5, 4, 1, 2]) == false
func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var sorted = arr.sorted()
    var index = 0
    while index < arr.count {
        if arr[index] != sorted[index] {
            return false
        }
        index += 1
    }
    return true
}
```
var sorted = arr.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var arr = arr
    var i = 0
    while i < arr.count - 1 {
        if arr[i] > arr[i + 1] {
            arr.remove(at: i + 1)
            arr.insert(arr[i], at: 0)
            i = 0
        } else {
            i += 1
        }
    }
    return arr.sorted() == arr
}
```swift
// We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
// numbers in the array will be randomly ordered. Your task is to determine if
// it is possible to get an array sorted in non-decreasing order by performing 
// the following operation on the given array:
// You are allowed to perform right shift operation any number of times.
// One right shift operation means shifting all elements of the array by one
// position in the right direction. The last element of the array will be moved to
// the starting position in the array i.e. 0th index. 
// If it is possible to obtain the sorted array by performing the above operation
// then return true else return false.
// If the given array is empty then return true.
// Note: The given array is guaranteed to have unique elements.
// For Example:
// Explanation: By performin 2 right shift operations, non-decreasing order can
// be achieved for the given array.
// Explanation:It is not possible to get non-decreasing order for the given
// array by performing any number of right shift operations.
// moveOneBall(arr: [3, 4, 5, 1, 2]) == true
// moveOneBall(arr: [3, 5, 4, 1, 2]) == false
func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var arr = arr
    var i = 0
    while i < arr.count - 1 {
        if arr[i] > arr[i + 1] {
            arr.remove(at: i + 1)
            arr.insert(arr[i], at: 0)
            i = 0
        } else {
            i += 1
        }
    }
    return arr.sorted() == arr
}
```
 // XCTAssertTrue failed

func moveOneBall(arr: [Int]) -> Bool {
    var arr = arr
    var i = 0
    while i < arr.count {
        if arr[i] < arr[i + 1] {
            arr[i] = arr[i + 1]
            arr[i + 1] = arr[i + 2]
            arr[i + 2] = arr[i + 3]
            arr[i + 3] = arr[i + 4]
            arr[i + 4] = arr[i]
            i = 0
        } else {
            i += 1
        }
    }
    return arr.sorted() == arr
}
```swift
// We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
// numbers in the array will be randomly ordered. Your task is to determine if
// it is possible to get an array sorted in non-decreasing order by performing 
// the following operation on the given array:
// You are allowed to perform right shift operation any number of times.
// One right shift operation means shifting all elements of the array by one
// position in the right direction. The last element of the array will be moved to
// the starting position in the array i.e. 0th index. 
// If it is possible to obtain the sorted array by performing the above operation
// then return true else return false.
// If the given array is empty then return true.
// Note: The given array is guaranteed to have unique elements.
// For Example:
// Explanation: By performin 2 right shift operations, non-decreasing order can
// be achieved for the given array.
// Explanation:It is not possible to get non-decreasing order for the given
// array by performing any number of right shift operations.
// moveOneBall(arr: [3, 4, 5, 1, 2]) == true
// moveOneBall(arr: [3, 5, 4, 1, 2]) == false
func moveOneBall(arr: [Int]) -> Bool {
    var arr = arr
    var i = 0
    while i < arr.count {
        if arr[i] < arr[i + 1] {
            arr[i] = arr[i + 1]
            arr[i + 1] = arr[i + 2]
            arr[i + 2] = arr[i + 3]
            arr[i + 3] = arr[i + 4]
            arr[i + 4] = arr[i]
            i = 0
        } else {
            i += 1
        }
    }
    return arr.sorted() == arr
}
```
 // Fatal error: Index out of range

func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var arr = arr
    var i = 0
    while i < arr.count {
        if arr[i] < arr[i + 1] {
            arr.remove(at: i + 1)
            arr.insert(arr[i], at: 0)
            i = 0
        } else {
            i += 1
        }
    }
    return arr.count == 1
}
```swift
// We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
// numbers in the array will be randomly ordered. Your task is to determine if
// it is possible to get an array sorted in non-decreasing order by performing 
// the following operation on the given array:
// You are allowed to perform right shift operation any number of times.
// One right shift operation means shifting all elements of the array by one
// position in the right direction. The last element of the array will be moved to
// the starting position in the array i.e. 0th index. 
// If it is possible to obtain the sorted array by performing the above operation
// then return true else return false.
// If the given array is empty then return true.
// Note: The given array is guaranteed to have unique elements.
// For Example:
// Explanation: By performin 2 right shift operations, non-decreasing order can
// be achieved for the given array.
// Explanation:It is not possible to get non-decreasing order for the given
// array by performing any number of right shift operations.
// moveOneBall(arr: [3, 4, 5, 1, 2]) == true
// moveOneBall(arr: [3, 5, 4, 1, 2]) == false
func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var arr = arr
    var i = 0
    while i < arr.count {
        if arr[i] < arr[i + 1] {
            arr.remove(at: i + 1)
            arr.insert(arr[i], at: 0)
            i = 0
        } else {
            i += 1
        }
    }
    return arr.count == 1
}
```
 // Fatal error: Index out of range

func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var arr = arr
    var i = 0
    while i < arr.count - 1 {
        if arr[i] > arr[i + 1] {
            arr.remove(at: i + 1)
            arr.insert(arr[i], at: 0)
            i = 0
        } else {
            i += 1
        }
    }
    return arr.sorted() == arr
}
```swift
// We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
// numbers in the array will be randomly ordered. Your task is to determine if
// it is possible to get an array sorted in non-decreasing order by performing 
// the following operation on the given array:
// You are allowed to perform right shift operation any number of times.
// One right shift operation means shifting all elements of the array by one
// position in the right direction. The last element of the array will be moved to
// the starting position in the array i.e. 0th index. 
// If it is possible to obtain the sorted array by performing the above operation
// then return true else return false.
// If the given array is empty then return true.
// Note: The given array is guaranteed to have unique elements.
// For Example:
// Explanation: By performin 2 right shift operations, non-decreasing order can
// be achieved for the given array.
// Explanation:It is not possible to get non-decreasing order for the given
// array by performing any number of right shift operations.
// moveOneBall(arr: [3, 4, 5, 1, 2]) == true
// moveOneBall(arr: [3, 5, 4, 1, 2]) == false
func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var arr = arr
    var i = 0
    while i < arr.count - 1 {
        if arr[i] > arr[i + 1] {
            arr.remove(at: i + 1)
            arr.insert(arr[i], at: 0)
            i = 0
        } else {
            i += 1
        }
    }
    return arr.sorted() == arr
}
```
 // XCTAssertTrue failed

func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var sorted = arr.sorted()
    var index = 0
    while index < arr.count {
        if arr[index] != sorted[index] {
            return false
        }
        index += 1
    }
    return true
}
```swift
// We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
// numbers in the array will be randomly ordered. Your task is to determine if
// it is possible to get an array sorted in non-decreasing order by performing 
// the following operation on the given array:
// You are allowed to perform right shift operation any number of times.
// One right shift operation means shifting all elements of the array by one
// position in the right direction. The last element of the array will be moved to
// the starting position in the array i.e. 0th index. 
// If it is possible to obtain the sorted array by performing the above operation
// then return true else return false.
// If the given array is empty then return true.
// Note: The given array is guaranteed to have unique elements.
// For Example:
// Explanation: By performin 2 right shift operations, non-decreasing order can
// be achieved for the given array.
// Explanation:It is not possible to get non-decreasing order for the given
// array by performing any number of right shift operations.
// moveOneBall(arr: [3, 4, 5, 1, 2]) == true
// moveOneBall(arr: [3, 5, 4, 1, 2]) == false
func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var sorted = arr.sorted()
    var index = 0
    while index < arr.count {
        if arr[index] != sorted[index] {
            return false
        }
        index += 1
    }
    return true
}
```
var sorted = arr.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var arr = arr
    var i = 0
    while i < arr.count {
        if arr[i] > arr[i + 1] {
            arr.remove(at: i + 1)
            arr.insert(arr[arr.count - 1], at: 0)
            i = 0
        } else {
            i += 1
        }
    }
    return arr == arr.sorted()
}
```swift
// We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
// numbers in the array will be randomly ordered. Your task is to determine if
// it is possible to get an array sorted in non-decreasing order by performing 
// the following operation on the given array:
// You are allowed to perform right shift operation any number of times.
// One right shift operation means shifting all elements of the array by one
// position in the right direction. The last element of the array will be moved to
// the starting position in the array i.e. 0th index. 
// If it is possible to obtain the sorted array by performing the above operation
// then return true else return false.
// If the given array is empty then return true.
// Note: The given array is guaranteed to have unique elements.
// For Example:
// Explanation: By performin 2 right shift operations, non-decreasing order can
// be achieved for the given array.
// Explanation:It is not possible to get non-decreasing order for the given
// array by performing any number of right shift operations.
// moveOneBall(arr: [3, 4, 5, 1, 2]) == true
// moveOneBall(arr: [3, 5, 4, 1, 2]) == false
func moveOneBall(arr: [Int]) -> Bool {
    guard !arr.isEmpty else { return true }
    var arr = arr
    var i = 0
    while i < arr.count {
        if arr[i] > arr[i + 1] {
            arr.remove(at: i + 1)
            arr.insert(arr[arr.count - 1], at: 0)
            i = 0
        } else {
            i += 1
        }
    }
    return arr == arr.sorted()
}
```
 // Fatal error: Index out of range

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Your code goes here
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Your code goes here
}
```
} // missing return in global function expected to return 'String'

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    
    var isEven = true
    
    for i in 0..<lst1.count {
        if lst1[i] % 2 != 0 {
            isEven = false
            break
        }
    }
    
    if isEven {
        return "YES"
    }
    
    for i in 0..<lst2.count {
        if lst2[i] % 2 != 0 {
            isEven = false
            break
        }
    }
    
    if isEven {
        return "YES"
    }
    
    return "NO"
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    
    var isEven = true
    
    for i in 0..<lst1.count {
        if lst1[i] % 2 != 0 {
            isEven = false
            break
        }
    }
    
    if isEven {
        return "YES"
    }
    
    for i in 0..<lst2.count {
        if lst2[i] % 2 != 0 {
            isEven = false
            break
        }
    }
    
    if isEven {
        return "YES"
    }
    
    return "NO"
}
```
var lst1 = lst1 // variable 'lst1' was never mutated; consider changing to 'let' constant
var lst2 = lst2 // variable 'lst2' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Your code goes here
    return "YES"
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Your code goes here
    return "YES"
}
```
 // XCTAssertTrue failed

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // TODO: Write your code here
    var lst1 = lst1
    var lst2 = lst2
    var lst1Count = 0
    var lst2Count = 0
    var lst1Even = 0
    var lst2Even = 0
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            lst1Even += 1
        }
    }
    for i in 0..<lst2.count {
        if lst2[i] % 2 == 0 {
            lst2Even += 1
        }
    }
    if lst1Even == lst2Even {
        return "YES"
    } else {
        return "NO"
    }
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    // TODO: Write your code here
    var lst1 = lst1
    var lst2 = lst2
    var lst1Count = 0
    var lst2Count = 0
    var lst1Even = 0
    var lst2Even = 0
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            lst1Even += 1
        }
    }
    for i in 0..<lst2.count {
        if lst2[i] % 2 == 0 {
            lst2Even += 1
        }
    }
    if lst1Even == lst2Even {
        return "YES"
    } else {
        return "NO"
    }
}
```
var lst1 = lst1 // variable 'lst1' was never mutated; consider changing to 'let' constant
var lst2 = lst2 // variable 'lst2' was never mutated; consider changing to 'let' constant
var lst1Count = 0 // initialization of variable 'lst1Count' was never used; consider replacing with assignment to '_' or removing it
var lst2Count = 0 // initialization of variable 'lst2Count' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    
    var isEven = true
    for i in 0..<lst1.count {
        if lst1[i] % 2 != 0 {
            isEven = false
            break
        }
    }
    
    if isEven {
        return "YES"
    }
    
    isEven = true
    for i in 0..<lst2.count {
        if lst2[i] % 2 != 0 {
            isEven = false
            break
        }
    }
    
    if isEven {
        return "YES"
    }
    
    return "NO"
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    
    var isEven = true
    for i in 0..<lst1.count {
        if lst1[i] % 2 != 0 {
            isEven = false
            break
        }
    }
    
    if isEven {
        return "YES"
    }
    
    isEven = true
    for i in 0..<lst2.count {
        if lst2[i] % 2 != 0 {
            isEven = false
            break
        }
    }
    
    if isEven {
        return "YES"
    }
    
    return "NO"
}
```
var lst1 = lst1 // variable 'lst1' was never mutated; consider changing to 'let' constant
var lst2 = lst2 // variable 'lst2' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Your code goes here
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Your code goes here
}
```
} // missing return in global function expected to return 'String'

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var i = 0
    var j = 0
    while i < lst1.count && j < lst2.count {
        if lst1[i] % 2 == 0 {
            i += 1
        } else if lst2[j] % 2 == 0 {
            j += 1
        } else {
            let temp = lst1[i]
            lst1[i] = lst2[j]
            lst2[j] = temp
            i += 1
            j += 1
        }
    }
    return lst1.allSatisfy { $0 % 2 == 0 } ? "YES" : "NO"
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var i = 0
    var j = 0
    while i < lst1.count && j < lst2.count {
        if lst1[i] % 2 == 0 {
            i += 1
        } else if lst2[j] % 2 == 0 {
            j += 1
        } else {
            let temp = lst1[i]
            lst1[i] = lst2[j]
            lst2[j] = temp
            i += 1
            j += 1
        }
    }
    return lst1.allSatisfy { $0 % 2 == 0 } ? "YES" : "NO"
}
```
 // XCTAssertTrue failed

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var even = 0
    var odd = 0
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
    }
    for i in 0..<lst2.count {
        if lst2[i] % 2 == 0 {
            even -= 1
        } else {
            odd -= 1
        }
    }
    if even == 0 && odd == 0 {
        return "YES"
    } else {
        return "NO"
    }
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var even = 0
    var odd = 0
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
    }
    for i in 0..<lst2.count {
        if lst2[i] % 2 == 0 {
            even -= 1
        } else {
            odd -= 1
        }
    }
    if even == 0 && odd == 0 {
        return "YES"
    } else {
        return "NO"
    }
}
```
var lst1 = lst1 // variable 'lst1' was never mutated; consider changing to 'let' constant
var lst2 = lst2 // variable 'lst2' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Your code goes here
    var lst1 = lst1
    var lst2 = lst2
    var count = 0
    var i = 0
    var j = 0
    while i < lst1.count && j < lst2.count {
        if lst1[i] % 2 == 0 {
            i += 1
        } else if lst2[j] % 2 == 0 {
            j += 1
        } else {
            count += 1
            let temp = lst1[i]
            lst1[i] = lst2[j]
            lst2[j] = temp
            i += 1
            j += 1
        }
    }
    if count == lst1.count + lst2.count {
        return "YES"
    } else {
        return "NO"
    }
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    // Your code goes here
    var lst1 = lst1
    var lst2 = lst2
    var count = 0
    var i = 0
    var j = 0
    while i < lst1.count && j < lst2.count {
        if lst1[i] % 2 == 0 {
            i += 1
        } else if lst2[j] % 2 == 0 {
            j += 1
        } else {
            count += 1
            let temp = lst1[i]
            lst1[i] = lst2[j]
            lst2[j] = temp
            i += 1
            j += 1
        }
    }
    if count == lst1.count + lst2.count {
        return "YES"
    } else {
        return "NO"
    }
}
```
 // XCTAssertTrue failed

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var isEven = true
    while isEven {
        isEven = false
        for i in 0..<lst1.count {
            if lst1[i] % 2 == 1 {
                isEven = true
                lst1[i] = lst2[i]
                lst2[i] = lst1[i]
            }
        }
    }
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 1 {
            return "NO"
        }
    }
    return "YES"
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var isEven = true
    while isEven {
        isEven = false
        for i in 0..<lst1.count {
            if lst1[i] % 2 == 1 {
                isEven = true
                lst1[i] = lst2[i]
                lst2[i] = lst1[i]
            }
        }
    }
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 1 {
            return "NO"
        }
    }
    return "YES"
}
```

func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    for letter in test.split(separator: " ") {
        if histogram[letter] == nil {
            histogram[letter] = 1
        } else {
            histogram[letter] = histogram[letter]! + 1
        }
    }
    return histogram
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    for letter in test.split(separator: " ") {
        if histogram[letter] == nil {
            histogram[letter] = 1
        } else {
            histogram[letter] = histogram[letter]! + 1
        }
    }
    return histogram
}
```
if histogram[letter] == nil { // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
histogram[letter] = 1 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
histogram[letter] = histogram[letter]! + 1 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
histogram[letter] = histogram[letter]! + 1 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'

func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = histogram[word] {
            histogram[word] = count + 1
        } else {
            histogram[word] = 1
        }
    }
    return histogram
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = histogram[word] {
            histogram[word] = count + 1
        } else {
            histogram[word] = 1
        }
    }
    return histogram
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let letters = test.components(separatedBy: " ")
    for letter in letters {
        if histogram[letter] == nil {
            histogram[letter] = 1
        } else {
            histogram[letter] = histogram[letter]! + 1
        }
    }
    return histogram
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let letters = test.components(separatedBy: " ")
    for letter in letters {
        if histogram[letter] == nil {
            histogram[letter] = 1
        } else {
            histogram[letter] = histogram[letter]! + 1
        }
    }
    return histogram
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = histogram[word] {
            histogram[word] = count + 1
        } else {
            histogram[word] = 1
        }
    }
    return histogram
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = histogram[word] {
            histogram[word] = count + 1
        } else {
            histogram[word] = 1
        }
    }
    return histogram
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = histogram[word] {
            histogram[word] = count + 1
        } else {
            histogram[word] = 1
        }
    }
    return histogram
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = histogram[word] {
            histogram[word] = count + 1
        } else {
            histogram[word] = 1
        }
    }
    return histogram
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = histogram[word] {
            histogram[word] = count + 1
        } else {
            histogram[word] = 1
        }
    }
    return histogram
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = histogram[word] {
            histogram[word] = count + 1
        } else {
            histogram[word] = 1
        }
    }
    return histogram
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = histogram[word] {
            histogram[word] = count + 1
        } else {
            histogram[word] = 1
        }
    }
    return histogram
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = histogram[word] {
            histogram[word] = count + 1
        } else {
            histogram[word] = 1
        }
    }
    return histogram
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let letters = test.components(separatedBy: " ")
    for letter in letters {
        if histogram[letter] != nil {
            histogram[letter]! += 1
        } else {
            histogram[letter] = 1
        }
    }
    return histogram
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let letters = test.components(separatedBy: " ")
    for letter in letters {
        if histogram[letter] != nil {
            histogram[letter]! += 1
        } else {
            histogram[letter] = 1
        }
    }
    return histogram
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = histogram[word] {
            histogram[word] = count + 1
        } else {
            histogram[word] = 1
        }
    }
    return histogram
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var histogram = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = histogram[word] {
            histogram[word] = count + 1
        } else {
            histogram[word] = 1
        }
    }
    return histogram
}
```
 // XCTAssertTrue failed

func reverseDelete(s: String, c: String) -> (String, Bool) {
    // Write your code here
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    // Write your code here
}
```
} // missing return in global function expected to return '(String, Bool)'

func reverseDelete(s: String, c: String) -> (String, Bool) {
    let set = Set(c)
    var result = ""
    for char in s {
        if !set.contains(char) {
            result.append(char)
        }
    }
    return (result, result.reverse() == result)
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    let set = Set(c)
    var result = ""
    for char in s {
        if !set.contains(char) {
            result.append(char)
        }
    }
    return (result, result.reverse() == result)
}
```
return (result, result.reverse() == result) // value of type 'String' has no member 'reverse'

func reverseDelete(s: String, c: String) -> (String, Bool) {
    let set = Set(c)
    var result = ""
    for char in s {
        if !set.contains(char) {
            result.append(char)
        }
    }
    return (result, result.reverse() == result)
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    let set = Set(c)
    var result = ""
    for char in s {
        if !set.contains(char) {
            result.append(char)
        }
    }
    return (result, result.reverse() == result)
}
```
return (result, result.reverse() == result) // value of type 'String' has no member 'reverse'

func reverseDelete(s: String, c: String) -> (String, Bool) {
    return ("", false)
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    return ("", false)
}
```
 // XCTAssertTrue failed

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    for char in s {
        if !c.contains(char) {
            result.append(char)
        }
    }
    return (result, result.reverse() == result)
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    for char in s {
        if !c.contains(char) {
            result.append(char)
        }
    }
    return (result, result.reverse() == result)
}

// Solution
// 1. Iterate through the string and check if the character is in the c string
// 2. If it is not, append it to the result string
// 3. Reverse the result string and compare it to the original string
// 4. Return the result string and the boolean
```
return (result, result.reverse() == result) // value of type 'String' has no member 'reverse'

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for char in c {
        result = result.replacingOccurrences(of: String(char), with: "")
    }
    return (result, result == String(result.reversed()))
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for char in c {
        result = result.replacingOccurrences(of: String(char), with: "")
    }
    return (result, result == String(result.reversed()))
}
```

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for char in c {
        result = result.replacingOccurrences(of: String(char), with: "")
    }
    return (result, result == String(result.reversed()))
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for char in c {
        result = result.replacingOccurrences(of: String(char), with: "")
    }
    return (result, result == String(result.reversed()))
}
```

func reverseDelete(s: String, c: String) -> (String, Bool) {
    let s = s.filter { !c.contains($0) }
    return (s, s == s.reversed())
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    let s = s.filter { !c.contains($0) }
    return (s, s == s.reversed())
}
```
return (s, s == s.reversed()) // binary operator '==' cannot be applied to operands of type 'String' and '[String.Element]' (aka 'Array<Character>')

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for char in c {
        result = result.replacingOccurrences(of: String(char), with: "")
    }
    return (result, result == String(result.reversed()))
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for char in c {
        result = result.replacingOccurrences(of: String(char), with: "")
    }
    return (result, result == String(result.reversed()))
}
```

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for char in c {
        result = result.replacingOccurrences(of: String(char), with: "")
    }
    return (result, result == String(result.reversed()))
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for char in c {
        result = result.replacingOccurrences(of: String(char), with: "")
    }
    return (result, result == String(result.reversed()))
}
```

func oddCount(lst: [String]) -> [String] {
    var result = [String]()
    for string in lst {
        var count = 0
        for char in string {
            if char.isOdd {
                count += 1
            }
        }
        result.append("the number of odd elements \(count)n the str\(count)ng \(count) of the \(count)nput.")
    }
    return result
}

extension Character {
    var isOdd: Bool {
        return self.isNumber && self.isOddNumber
    }
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    var result = [String]()
    for string in lst {
        var count = 0
        for char in string {
            if char.isOdd {
                count += 1
            }
        }
        result.append("the number of odd elements \(count)n the str\(count)ng \(count) of the \(count)nput.")
    }
    return result
}

extension Character {
    var isOdd: Bool {
        return self.isNumber && self.isOddNumber
    }
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool {
        return self.isNumber
    }
    var isOddNumber: Bool {
        return self.isOddNumber
    }
}

extension Character {
    var isNumber: Bool
var isNumber: Bool { // invalid redeclaration of 'isNumber'
var isOddNumber: Bool { // invalid redeclaration of 'isOddNumber'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let count = $0.filter { $0.isOddNumber }.count
        return "the number of odd elements \(count)n the str\(count)ng \(count) of the \(count)nput."
    }
}

func isOddNumber(_ char: Character) -> Bool {
    return char.isNumber && (char.wholeNumberValue! % 2 == 1)
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let count = $0.filter { $0.isOddNumber }.count
        return "the number of odd elements \(count)n the str\(count)ng \(count) of the \(count)nput."
    }
}

func isOddNumber(_ char: Character) -> Bool {
    return char.isNumber && (char.wholeNumberValue! % 2 == 1)
}
```
let count = $0.filter { $0.isOddNumber }.count // value of type 'String.Element' (aka 'Character') has no member 'isOddNumber'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.filter { $0.isOdd }.count
        return "the number of odd elements \(oddCount) in the string \(oddCount) of the input."
    }
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.filter { $0.isOdd }.count
        return "the number of odd elements \(oddCount) in the string \(oddCount) of the input."
    }
}
```
let oddCount = $0.filter { $0.isOdd }.count // value of type 'String.Element' (aka 'Character') has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let odds = $0.filter { $0.isOdd }
        return "the number of odd elements \(odds.count) in the string \(odds.count) of the input."
    }
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let odds = $0.filter { $0.isOdd }
        return "the number of odd elements \(odds.count) in the string \(odds.count) of the input."
    }
}
```
let odds = $0.filter { $0.isOdd } // value of type 'String.Element' (aka 'Character') has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.filter { $0.isOdd }.count
        return "the number of odd elements \(oddCount) in the string \(oddCount) of the input."
    }
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.filter { $0.isOdd }.count
        return "the number of odd elements \(oddCount) in the string \(oddCount) of the input."
    }
}
```
let oddCount = $0.filter { $0.isOdd }.count // value of type 'String.Element' (aka 'Character') has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    var result = [String]()
    for string in lst {
        var oddCount = 0
        for char in string {
            if Int(String(char))! % 2 != 0 {
                oddCount += 1
            }
        }
        result.append("the number of odd elements \(oddCount) in the string \(string) of the input.")
    }
    return result
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    var result = [String]()
    for string in lst {
        var oddCount = 0
        for char in string {
            if Int(String(char))! % 2 != 0 {
                oddCount += 1
            }
        }
        result.append("the number of odd elements \(oddCount) in the string \(string) of the input.")
    }
    return result
}
```
 // XCTAssertTrue failed

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.count(where: { $0 % 2 == 1 })
        return "the number of odd elements \(oddCount)n the str\(oddCount)ng \(oddCount) of the \(oddCount)nput."
    }
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.count(where: { $0 % 2 == 1 })
        return "the number of odd elements \(oddCount)n the str\(oddCount)ng \(oddCount) of the \(oddCount)nput."
    }
}
```
let oddCount = $0.count(where: { $0 % 2 == 1 }) // cannot call value of non-function type 'Int'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.count(where: { $0.isOdd })
        return "the number of odd elements \(oddCount)n the str\(oddCount)ng \(oddCount) of the \(oddCount)nput."
    }
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.count(where: { $0.isOdd })
        return "the number of odd elements \(oddCount)n the str\(oddCount)ng \(oddCount) of the \(oddCount)nput."
    }
}
```
let oddCount = $0.count(where: { $0.isOdd }) // cannot call value of non-function type 'Int'

func oddCount(lst: [String]) -> [String] {
    return lst.map { String(countOddDigits($0)) }
}

func countOddDigits(_ str: String) -> Int {
    return str.reduce(0) { $0 + ($1.isOdd ? 1 : 0) }
}

func isOdd(_ digit: Character) -> Bool {
    return digit.isNumber && (digit.wholeNumberValue! % 2 != 0)
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map { String(countOddDigits($0)) }
}

func countOddDigits(_ str: String) -> Int {
    return str.reduce(0) { $0 + ($1.isOdd ? 1 : 0) }
}

func isOdd(_ digit: Character) -> Bool {
    return digit.isNumber && (digit.wholeNumberValue! % 2 != 0)
}
```
return str.reduce(0) { $0 + ($1.isOdd ? 1 : 0) } // value of type 'String.Element' (aka 'Character') has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    var result = [String]()
    for string in lst {
        var count = 0
        for char in string {
            if Int(String(char))! % 2 != 0 {
                count += 1
            }
        }
        result.append("the number of odd elements \(count)n the str\(count)ng \(count) of the \(count)nput.")
    }
    return result
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    var result = [String]()
    for string in lst {
        var count = 0
        for char in string {
            if Int(String(char))! % 2 != 0 {
                count += 1
            }
        }
        result.append("the number of odd elements \(count)n the str\(count)ng \(count) of the \(count)nput.")
    }
    return result
}
```

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for i in 0..<nums.count {
        sum += nums[i]
        minSum = min(minSum, sum)
        if sum < 0 {
            sum = 0
        }
    }
    return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for i in 0..<nums.count {
        sum += nums[i]
        minSum = min(minSum, sum)
        if sum < 0 {
            sum = 0
        }
    }
    return minSum
}
```
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for i in 0..<nums.count {
        sum += nums[i]
        minSum = min(minSum, sum)
        if sum < 0 {
            sum = 0
        }
    }
    return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for i in 0..<nums.count {
        sum += nums[i]
        minSum = min(minSum, sum)
        if sum < 0 {
            sum = 0
        }
    }
    return minSum
}
```
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var currentSum = 0
    for i in 0..<nums.count {
        currentSum += nums[i]
        minSum = min(minSum, currentSum)
        if currentSum < 0 {
            currentSum = 0
        }
    }
    return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var currentSum = 0
    for i in 0..<nums.count {
        currentSum += nums[i]
        minSum = min(minSum, currentSum)
        if currentSum < 0 {
            currentSum = 0
        }
    }
    return minSum
}
```
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var currentSum = 0
    for num in nums {
        currentSum += num
        minSum = min(minSum, currentSum)
        if currentSum < 0 {
            currentSum = 0
        }
    }
    return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var currentSum = 0
    for num in nums {
        currentSum += num
        minSum = min(minSum, currentSum)
        if currentSum < 0 {
            currentSum = 0
        }
    }
    return minSum
}
```
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    guard nums.count > 0 else { return 0 }
    
    var minSum = Int.max
    var currentSum = 0
    
    for num in nums {
        currentSum += num
        minSum = min(minSum, currentSum)
        if currentSum < 0 {
            currentSum = 0
        }
    }
    
    return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
    guard nums.count > 0 else { return 0 }
    
    var minSum = Int.max
    var currentSum = 0
    
    for num in nums {
        currentSum += num
        minSum = min(minSum, currentSum)
        if currentSum < 0 {
            currentSum = 0
        }
    }
    
    return minSum
}
```
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for i in 0..<nums.count {
        sum += nums[i]
        if sum < minSum {
            minSum = sum
        }
        if sum < 0 {
            sum = 0
        }
    }
    return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for i in 0..<nums.count {
        sum += nums[i]
        if sum < minSum {
            minSum = sum
        }
        if sum < 0 {
            sum = 0
        }
    }
    return minSum
}
```
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for i in 0..<nums.count {
        sum += nums[i]
        minSum = min(minSum, sum)
        if sum < 0 {
            sum = 0
        }
    }
    return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for i in 0..<nums.count {
        sum += nums[i]
        minSum = min(minSum, sum)
        if sum < 0 {
            sum = 0
        }
    }
    return minSum
}
```
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
  guard nums.count > 0 else { return 0 }
  var minSum = Int.max
  var sum = 0
  for i in 0..<nums.count {
    sum += nums[i]
    minSum = min(minSum, sum)
    if sum < 0 {
      sum = 0
    }
  }
  return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
  guard nums.count > 0 else { return 0 }
  var minSum = Int.max
  var sum = 0
  for i in 0..<nums.count {
    sum += nums[i]
    minSum = min(minSum, sum)
    if sum < 0 {
      sum = 0
    }
  }
  return minSum
}
```
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var currentSum = 0
    for num in nums {
        currentSum += num
        minSum = min(currentSum, minSum)
        if currentSum < 0 {
            currentSum = 0
        }
    }
    return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var currentSum = 0
    for num in nums {
        currentSum += num
        minSum = min(currentSum, minSum)
        if currentSum < 0 {
            currentSum = 0
        }
    }
    return minSum
}
```
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var currentSum = 0
    for num in nums {
        currentSum += num
        minSum = min(minSum, currentSum)
        if currentSum < 0 {
            currentSum = 0
        }
    }
    return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var currentSum = 0
    for num in nums {
        currentSum += num
        minSum = min(minSum, currentSum)
        if currentSum < 0 {
            currentSum = 0
        }
    }
    return minSum
}
```
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    let rows = grid.count
    let cols = grid[0].count
    var buckets = 0
    var filled = 0
    var result = 0
    
    for i in 0..<rows {
        for j in 0..<cols {
            if grid[i][j] == 1 {
                filled += 1
            }
        }
    }
    
    while filled > 0 {
        buckets += 1
        var filledThisRound = 0
        for i in 0..<rows {
            for j in 0..<cols {
                if grid[i][j] == 1 {
                    filledThisRound += 1
                }
            }
        }
        filled -= filledThisRound
        if filledThisRound > capacity {
            result += filledThisRound / capacity
            filledThisRound %= capacity
        }
        for i in 0..<rows {
            for j in 0..<cols {
                if grid[i][j] == 1 {
                    grid[i][j] = 0
                }
            }
        }
        for i in 0..<rows {
            for j in 0..<cols {
                if grid[i][j] == 0 {
                    grid[i][j] = 1
                }
            }
        }
    }
    
    return result
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    let rows = grid.count
    let cols = grid[0].count
    var buckets = 0
    var filled = 0
    var result = 0
    
    for i in 0..<rows {
        for j in 0..<cols {
            if grid[i][j] == 1 {
                filled += 1
            }
        }
    }
    
    while filled > 0 {
        buckets += 1
        var filledThisRound = 0
        for i in 0..<rows {
            for j in 0..<cols {
                if grid[i][j] == 1 {
                    filledThisRound += 1
                }
            }
        }
        filled -= filledThisRound
        if filledThisRound > capacity {
            result += filledThisRound / capacity
            filledThisRound %= capacity
        }
        for i in 0..<rows {
            for j in 0..<cols {
                if grid[i][j] == 1 {
                    grid[i][j] = 0
                }
            }
        }
        for i in 0..<rows {
            for j in 0..<cols {
                if grid[i][j] == 0 {
                    grid[i][j] = 1
                }
            }
        }
    }
    
    return result
}
```
grid[i][j] = 0 // cannot assign through subscript: 'grid' is a 'let' constant
grid[i][j] = 1 // cannot assign through subscript: 'grid' is a 'let' constant

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var count = 0
    var max = 0
    var sum = 0
    var row = 0
    var col = 0
    while row < grid.count {
        while col < grid[row].count {
            if grid[row][col] == 1 {
                sum += 1
            }
            col += 1
        }
        if sum > max {
            max = sum
        }
        if sum > capacity {
            count += 1
            sum -= capacity
        } else {
            sum = 0
        }
        col = 0
        row += 1
    }
    return count
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var count = 0
    var max = 0
    var sum = 0
    var row = 0
    var col = 0
    while row < grid.count {
        while col < grid[row].count {
            if grid[row][col] == 1 {
                sum += 1
            }
            col += 1
        }
        if sum > max {
            max = sum
        }
        if sum > capacity {
            count += 1
            sum -= capacity
        } else {
            sum = 0
        }
        col = 0
        row += 1
    }
    return count
}
```
var grid = grid // variable 'grid' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var result = 0
    var buckets = capacity
    var row = 0
    var col = 0
    while row < grid.count {
        if grid[row][col] == 1 {
            buckets -= 1
            if buckets == 0 {
                result += 1
                buckets = capacity
            }
        }
        col += 1
        if col == grid[row].count {
            col = 0
            row += 1
        }
    }
    return result
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var result = 0
    var buckets = capacity
    var row = 0
    var col = 0
    while row < grid.count {
        if grid[row][col] == 1 {
            buckets -= 1
            if buckets == 0 {
                result += 1
                buckets = capacity
            }
        }
        col += 1
        if col == grid[row].count {
            col = 0
            row += 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    guard !grid.isEmpty else { return 0 }
    guard !grid[0].isEmpty else { return 0 }
    guard capacity > 0 else { return 0 }
    guard grid.count > 0 else { return 0 }
    guard grid[0].count > 0 else { return 0 }
    guard grid.count == grid[0].count else { return 0 }
    
    var result = 0
    var currentCapacity = capacity
    var currentRow = 0
    var currentColumn = 0
    
    while currentCapacity > 0 {
        if grid[currentRow][currentColumn] == 1 {
            currentCapacity -= 1
        }
        currentColumn += 1
        if currentColumn == grid[0].count {
            currentColumn = 0
            currentRow += 1
        }
        if currentRow == grid.count {
            break
        }
        result += 1
    }
    return result
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    guard !grid.isEmpty else { return 0 }
    guard !grid[0].isEmpty else { return 0 }
    guard capacity > 0 else { return 0 }
    guard grid.count > 0 else { return 0 }
    guard grid[0].count > 0 else { return 0 }
    guard grid.count == grid[0].count else { return 0 }
    
    var result = 0
    var currentCapacity = capacity
    var currentRow = 0
    var currentColumn = 0
    
    while currentCapacity > 0 {
        if grid[currentRow][currentColumn] == 1 {
            currentCapacity -= 1
        }
        currentColumn += 1
        if currentColumn == grid[0].count {
            currentColumn = 0
            currentRow += 1
        }
        if currentRow == grid.count {
            break
        }
        result += 1
    }
    return result
}
```
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var buckets = [Int]()
    var result = 0
    
    for row in grid {
        for column in row {
            if column == 1 {
                buckets.append(column)
            }
        }
    }
    
    while buckets.count > 0 {
        var bucket = buckets.removeLast()
        var row = 0
        var column = 0
        
        while bucket > 0 {
            if grid[row][column] == 1 {
                bucket -= 1
            }
            
            column += 1
            if column == grid[0].count {
                column = 0
                row += 1
            }
        }
        
        result += 1
    }
    
    return result
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var buckets = [Int]()
    var result = 0
    
    for row in grid {
        for column in row {
            if column == 1 {
                buckets.append(column)
            }
        }
    }
    
    while buckets.count > 0 {
        var bucket = buckets.removeLast()
        var row = 0
        var column = 0
        
        while bucket > 0 {
            if grid[row][column] == 1 {
                bucket -= 1
            }
            
            column += 1
            if column == grid[0].count {
                column = 0
                row += 1
            }
        }
        
        result += 1
    }
    
    return result
}
```
var grid = grid // variable 'grid' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    let rows = grid.count
    let columns = grid[0].count
    var result = 0
    var buckets = 0
    var current = 0
    var filled = 0
    var empty = 0
    var water = 0
    var filledRow = 0
    var emptyRow = 0
    var waterRow = 0
    var filledColumn = 0
    var emptyColumn = 0
    var waterColumn = 0
    var filledBucket = 0
    var emptyBucket = 0
    var waterBucket = 0
    var filledWater = 0
    var emptyWater = 0
    var waterWater = 0
    for row in 0..<rows {
        for column in 0..<columns {
            if grid[row][column] == 1 {
                filled += 1
            } else {
                empty += 1
            }
        }
    }
    while filled > 0 {
        for row in 0..<rows {
            for column in 0..<columns {
                if grid[row][column] == 1 {
                    filledRow += 1
                } else {
                    emptyRow += 1
                }
            }
            if filledRow > 0 {
                filledBucket += 1
                filledWater += filledRow
                filledRow = 0
            }
            if emptyRow > 0 {
                emptyBucket += 1
                emptyWater += emptyRow
                emptyRow = 0
            }
        }
        for column in 0..<columns {
            for row in 0..<rows {
                if grid[row][column] == 1 {
                    filledColumn += 1
                } else {
                    emptyColumn += 1
                }
            }
            if filledColumn > 0 {
                filledBucket += 1
                filledWater += filledColumn
                filledColumn = 0
            }
            if emptyColumn > 0 {
                emptyBucket += 1
                emptyWater += emptyColumn
                emptyColumn = 0
            }
        }
        for column in 0..<columns {
            for row in 0..<rows {
                if grid[row][column] == 1 {
                    waterRow += 1
                } else {
                    waterColumn += 1
                }
            }
            if waterRow > 0 {
                waterBucket += 1
                waterWater += waterRow
                waterRow = 0
            }
            if waterColumn > 0 {
                waterBucket += 1
                waterWater += waterColumn
                waterColumn = 0
            }
        }
        if filledBucket > 0 {
            buckets += filledBucket
            filled -= filledWater
            filledWater = 0
            filledBucket = 0
        }
        if emptyBucket > 0 {
            buckets += emptyBucket
            empty -= emptyWater
            emptyWater = 0
            emptyBucket = 0
        }
        if waterBucket > 0 {
            buckets += waterBucket
            water -= waterWater
            waterWater = 0
            waterBucket = 0
        }
        if buckets > capacity {
            result += 1
            buckets = 0
        }
    }
    return result
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    let rows = grid.count
    let columns = grid[0].count
    var result = 0
    var buckets = 0
    var current = 0
    var filled = 0
    var empty = 0
    var water = 0
    var filledRow = 0
    var emptyRow = 0
    var waterRow = 0
    var filledColumn = 0
    var emptyColumn = 0
    var waterColumn = 0
    var filledBucket = 0
    var emptyBucket = 0
    var waterBucket = 0
    var filledWater = 0
    var emptyWater = 0
    var waterWater = 0
    for row in 0..<rows {
        for column in 0..<columns {
            if grid[row][column] == 1 {
                filled += 1
            } else {
                empty += 1
            }
        }
    }
    while filled > 0 {
        for row in 0..<rows {
            for column in 0..<columns {
                if grid[row][column] == 1 {
                    filledRow += 1
                } else {
                    emptyRow += 1
                }
            }
            if filledRow > 0 {
                filledBucket += 1
                filledWater += filledRow
                filledRow = 0
            }
            if emptyRow > 0 {
                emptyBucket += 1
                emptyWater += emptyRow
                emptyRow = 0
            }
        }
        for column in 0..<columns {
            for row in 0..<rows {
                if grid[row][column] == 1 {
                    filledColumn += 1
                } else {
                    emptyColumn += 1
                }
            }
            if filledColumn > 0 {
                filledBucket += 1
                filledWater += filledColumn
                filledColumn = 0
            }
            if emptyColumn > 0 {
                emptyBucket += 1
                emptyWater += emptyColumn
                emptyColumn = 0
            }
        }
        for column in 0..<columns {
            for row in 0..<rows {
                if grid[row][column] == 1 {
                    waterRow += 1
                } else {
                    waterColumn += 1
                }
            }
            if waterRow > 0 {
                waterBucket += 1
                waterWater += waterRow
                waterRow = 0
            }
            if waterColumn > 0 {
                waterBucket += 1
                waterWater += waterColumn
                waterColumn = 0
            }
        }
        if filledBucket > 0 {
            buckets += filledBucket
            filled -= filledWater
            filledWater = 0
            filledBucket = 0
        }
        if emptyBucket > 0 {
            buckets += emptyBucket
            empty -= emptyWater
            emptyWater = 0
            emptyBucket = 0
        }
        if waterBucket > 0 {
            buckets += waterBucket
            water -= waterWater
            waterWater = 0
            waterBucket = 0
        }
        if buckets > capacity {
            result += 1
            buckets = 0
        }
    }
    return result
}
```
var current = 0 // initialization of variable 'current' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var result = 0
    var bucket = capacity
    var row = 0
    while row < grid.count {
        var column = 0
        while column < grid[row].count {
            if grid[row][column] == 1 {
                grid[row][column] = 0
                bucket -= 1
            }
            if bucket == 0 {
                result += 1
                bucket = capacity
            }
            column += 1
        }
        row += 1
    }
    return result
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var result = 0
    var bucket = capacity
    var row = 0
    while row < grid.count {
        var column = 0
        while column < grid[row].count {
            if grid[row][column] == 1 {
                grid[row][column] = 0
                bucket -= 1
            }
            if bucket == 0 {
                result += 1
                bucket = capacity
            }
            column += 1
        }
        row += 1
    }
    return result
}
```
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var buckets = [Int]()
    var count = 0
    var maxCount = 0
    
    for row in grid {
        for column in row {
            if column == 1 {
                count += 1
            }
        }
        buckets.append(count)
        count = 0
    }
    
    for column in buckets {
        if column > capacity {
            maxCount += column / capacity
            if column % capacity != 0 {
                maxCount += 1
            }
        }
    }
    
    return maxCount
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var buckets = [Int]()
    var count = 0
    var maxCount = 0
    
    for row in grid {
        for column in row {
            if column == 1 {
                count += 1
            }
        }
        buckets.append(count)
        count = 0
    }
    
    for column in buckets {
        if column > capacity {
            maxCount += column / capacity
            if column % capacity != 0 {
                maxCount += 1
            }
        }
    }
    
    return maxCount
}
```
var grid = grid // variable 'grid' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    let rows = grid.count
    let columns = grid[0].count
    var buckets = 0
    var filled = 0
    var empty = 0
    var result = 0
    for row in 0..<rows {
        for column in 0..<columns {
            if grid[row][column] == 1 {
                filled += 1
            } else {
                empty += 1
            }
        }
    }
    while filled > 0 {
        if filled - empty > capacity {
            buckets += 1
            filled -= capacity
        } else {
            buckets += 1
            filled = 0
            empty = 0
        }
    }
    return buckets
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    let rows = grid.count
    let columns = grid[0].count
    var buckets = 0
    var filled = 0
    var empty = 0
    var result = 0
    for row in 0..<rows {
        for column in 0..<columns {
            if grid[row][column] == 1 {
                filled += 1
            } else {
                empty += 1
            }
        }
    }
    while filled > 0 {
        if filled - empty > capacity {
            buckets += 1
            filled -= capacity
        } else {
            buckets += 1
            filled = 0
            empty = 0
        }
    }
    return buckets
}
```
var result = 0 // initialization of variable 'result' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var result = 0
    var buckets = 0
    var water = 0
    
    while water < grid.count {
        for row in grid {
            if row[water] == 1 {
                buckets += 1
            }
        }
        if buckets > capacity {
            result += 1
            buckets = 0
            water += 1
        } else {
            buckets = 0
        }
    }
    
    return result
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var result = 0
    var buckets = 0
    var water = 0
    
    while water < grid.count {
        for row in grid {
            if row[water] == 1 {
                buckets += 1
            }
        }
        if buckets > capacity {
            result += 1
            buckets = 0
            water += 1
        } else {
            buckets = 0
        }
    }
    
    return result
}
```
var grid = grid // variable 'grid' was never mutated; consider changing to 'let' constant

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { a, b in
        let aOnes = a.binaryCount
        let bOnes = b.binaryCount
        if aOnes == bOnes {
            return a < b
        }
        return aOnes < bOnes
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { a, b in
        let aOnes = a.binaryCount
        let bOnes = b.binaryCount
        if aOnes == bOnes {
            return a < b
        }
        return aOnes < bOnes
    }
}
```
let aOnes = a.binaryCount // value of type 'Int' has no member 'binaryCount'

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        (a, b) -> Bool in
        let aOnes = a.binaryCount
        let bOnes = b.binaryCount
        return aOnes < bOnes || (aOnes == bOnes && a < b)
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        (a, b) -> Bool in
        let aOnes = a.binaryCount
        let bOnes = b.binaryCount
        return aOnes < bOnes || (aOnes == bOnes && a < b)
    }
}
```
let aOnes = a.binaryCount // value of type 'Int' has no member 'binaryCount'

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { a, b in
        let aOnes = a.binaryCount
        let bOnes = b.binaryCount
        if aOnes == bOnes {
            return a < b
        }
        return aOnes < bOnes
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { a, b in
        let aOnes = a.binaryCount
        let bOnes = b.binaryCount
        if aOnes == bOnes {
            return a < b
        }
        return aOnes < bOnes
    }
}
```
let aOnes = a.binaryCount // value of type 'Int' has no member 'binaryCount'

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        (a, b) -> Bool in
        let aOnes = a.binaryCount
        let bOnes = b.binaryCount
        if aOnes == bOnes {
            return a < b
        }
        return aOnes < bOnes
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        (a, b) -> Bool in
        let aOnes = a.binaryCount
        let bOnes = b.binaryCount
        if aOnes == bOnes {
            return a < b
        }
        return aOnes < bOnes
    }
}
```
let aOnes = a.binaryCount // value of type 'Int' has no member 'binaryCount'

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String(arr[$0])
        let b = String(arr[$1])
        let aOnes = a.reduce(0) { $0 + ($1 == "1" ? 1 : 0) }
        let bOnes = b.reduce(0) { $0 + ($1 == "1" ? 1 : 0) }
        if aOnes == bOnes {
            return a < b
        } else {
            return aOnes < bOnes
        }
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String(arr[$0])
        let b = String(arr[$1])
        let aOnes = a.reduce(0) { $0 + ($1 == "1" ? 1 : 0) }
        let bOnes = b.reduce(0) { $0 + ($1 == "1" ? 1 : 0) }
        if aOnes == bOnes {
            return a < b
        } else {
            return aOnes < bOnes
        }
    }
}
```
 // Fatal error: Index out of range

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String(arr[$0])
        let b = String(arr[$1])
        if a.count != b.count {
            return a.count < b.count
        }
        return a < b
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String(arr[$0])
        let b = String(arr[$1])
        if a.count != b.count {
            return a.count < b.count
        }
        return a < b
    }
}
```
 // Fatal error: Index out of range

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String(arr[$0])
        let b = String(arr[$1])
        if a.count != b.count {
            return a.count < b.count
        }
        return a < b
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String(arr[$0])
        let b = String(arr[$1])
        if a.count != b.count {
            return a.count < b.count
        }
        return a < b
    }
}
```
 // Fatal error: Index out of range

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let aOnes = a.binaryOnes
        let bOnes = b.binaryOnes
        if aOnes == bOnes {
            return a < b
        }
        return aOnes < bOnes
    }
}

private extension Int {
    var binaryOnes: Int {
        return String(self, radix: 2).filter { $0 == "1" }.count
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted { (a, b) -> Bool in
        let aOnes = a.binaryOnes
        let bOnes = b.binaryOnes
        if aOnes == bOnes {
            return a < b
        }
        return aOnes < bOnes
    }
}

private extension Int {
    var binaryOnes: Int {
        return String(self, radix: 2).filter { $0 == "1" }.count
    }
}
```

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String(arr[$0])
        let b = String(arr[$1])
        if a.count != b.count {
            return a.count < b.count
        } else {
            return a < b
        }
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String(arr[$0])
        let b = String(arr[$1])
        if a.count != b.count {
            return a.count < b.count
        } else {
            return a < b
        }
    }
}
```
 // Fatal error: Index out of range

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String(arr[$0])
        let b = String(arr[$1])
        if a.count != b.count {
            return a.count < b.count
        }
        return a < b
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String(arr[$0])
        let b = String(arr[$1])
        if a.count != b.count {
            return a.count < b.count
        }
        return a < b
    }
}
```
 // Fatal error: Index out of range

func selectWords(s: String, n: Int) -> [String] {
    guard !s.isEmpty else { return [] }
    var result = [String]()
    var words = s.components(separatedBy: .whitespaces)
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    guard !s.isEmpty else { return [] }
    var result = [String]()
    var words = s.components(separatedBy: .whitespaces)
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```
var words = s.components(separatedBy: .whitespaces) // variable 'words' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    guard !s.isEmpty else { return [] }
    let words = s.components(separatedBy: .whitespaces)
    var result = [String]()
    for word in words {
        if word.count == n && isConsonant(word) {
            result.append(word)
        }
    }
    return result
}

func isConsonant(_ word: String) -> Bool {
    let consonants = "bcdfghjklmnpqrstvwxyz"
    for letter in word {
        if consonants.contains(letter) {
            return true
        }
    }
    return false
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    guard !s.isEmpty else { return [] }
    let words = s.components(separatedBy: .whitespaces)
    var result = [String]()
    for word in words {
        if word.count == n && isConsonant(word) {
            result.append(word)
        }
    }
    return result
}

func isConsonant(_ word: String) -> Bool {
    let consonants = "bcdfghjklmnpqrstvwxyz"
    for letter in word {
        if consonants.contains(letter) {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    guard !s.isEmpty else { return [] }
    let words = s.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    guard !s.isEmpty else { return [] }
    let words = s.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    var words = s.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    var words = s.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```
var words = s.components(separatedBy: " ") // variable 'words' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    var result = [String]()
    var words = s.components(separatedBy: " ")
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    var result = [String]()
    var words = s.components(separatedBy: " ")
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```
var words = s.components(separatedBy: " ") // variable 'words' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    var result = [String]()
    var words = s.components(separatedBy: " ")
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    var result = [String]()
    var words = s.components(separatedBy: " ")
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```
var words = s.components(separatedBy: " ") // variable 'words' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    guard !s.isEmpty else { return [] }
    var words = s.components(separatedBy: .whitespaces)
    var result = [String]()
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    guard !s.isEmpty else { return [] }
    var words = s.components(separatedBy: .whitespaces)
    var result = [String]()
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```
var words = s.components(separatedBy: .whitespaces) // variable 'words' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    var result = [String]()
    var words = s.components(separatedBy: .whitespaces)
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    var result = [String]()
    var words = s.components(separatedBy: .whitespaces)
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```
var words = s.components(separatedBy: .whitespaces) // variable 'words' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    var words = s.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    var words = s.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        if word.count == n {
            result.append(word)
        }
    }
    return result
}
```
var words = s.components(separatedBy: " ") // variable 'words' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    var result = [String]()
    var words = s.components(separatedBy: .whitespaces)
    for word in words {
        if word.count == n && word.isAllConsonants() {
            result.append(word)
        }
    }
    return result
}

extension String {
    func isAllConsonants() -> Bool {
        let consonants = "bcdfghjklmnpqrstvwxyz"
        for letter in self {
            if consonants.contains(letter) {
                continue
            } else {
                return false
            }
        }
        return true
    }
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    var result = [String]()
    var words = s.components(separatedBy: .whitespaces)
    for word in words {
        if word.count == n && word.isAllConsonants() {
            result.append(word)
        }
    }
    return result
}

extension String {
    func isAllConsonants() -> Bool {
        let consonants = "bcdfghjklmnpqrstvwxyz"
        for letter in self {
            if consonants.contains(letter) {
                continue
            } else {
                return false
            }
        }
        return true
    }
}
```
var words = s.components(separatedBy: .whitespaces) // variable 'words' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    // your code here
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    // your code here
}
```
} // missing return in global function expected to return 'String'

func getClosestVowel(word: String) -> String {
    // your code here
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    // your code here
}
```
} // missing return in global function expected to return 'String'

func getClosestVowel(word: String) -> String {
    // Your code goes here
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    // Your code goes here
}
```
} // missing return in global function expected to return 'String'

func getClosestVowel(word: String) -> String {
    // Your code goes here
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    // Your code goes here
}
```
} // missing return in global function expected to return 'String'

func getClosestVowel(word: String) -> String {
    let vowels = "aeiou"
    let consonants = "bcdfghjklmnpqrstvwxyz"
    let word = word.lowercased()
    let wordArray = Array(word)
    var closestVowel = ""
    for i in stride(from: wordArray.count - 2, to: 0, by: -1) {
        if consonants.contains(wordArray[i]) {
            if vowels.contains(wordArray[i + 1]) {
                closestVowel = String(wordArray[i + 1])
                break
            }
        }
    }
    return closestVowel
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    let vowels = "aeiou"
    let consonants = "bcdfghjklmnpqrstvwxyz"
    let word = word.lowercased()
    let wordArray = Array(word)
    var closestVowel = ""
    for i in stride(from: wordArray.count - 2, to: 0, by: -1) {
        if consonants.contains(wordArray[i]) {
            if vowels.contains(wordArray[i + 1]) {
                closestVowel = String(wordArray[i + 1])
                break
            }
        }
    }
    return closestVowel
}
```
 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    let vowels = "aeiou"
    let consonants = "bcdfghjklmnpqrstvwxyz"
    let word = word.lowercased()
    let wordArray = Array(word)
    var closestVowel = ""
    var closestVowelIndex = word.count
    for i in stride(from: word.count - 1, through: 0, by: -1) {
        let char = wordArray[i]
        if consonants.contains(char) {
            for j in stride(from: i + 1, through: word.count - 1, by: 1) {
                let char2 = wordArray[j]
                if vowels.contains(char2) {
                    if j < closestVowelIndex {
                        closestVowel = String(char2)
                        closestVowelIndex = j
                    }
                }
            }
        }
    }
    return closestVowel
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    let vowels = "aeiou"
    let consonants = "bcdfghjklmnpqrstvwxyz"
    let word = word.lowercased()
    let wordArray = Array(word)
    var closestVowel = ""
    var closestVowelIndex = word.count
    for i in stride(from: word.count - 1, through: 0, by: -1) {
        let char = wordArray[i]
        if consonants.contains(char) {
            for j in stride(from: i + 1, through: word.count - 1, by: 1) {
                let char2 = wordArray[j]
                if vowels.contains(char2) {
                    if j < closestVowelIndex {
                        closestVowel = String(char2)
                        closestVowelIndex = j
                    }
                }
            }
        }
    }
    return closestVowel
}
```
 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    let vowels = "aeiou"
    let consonants = "bcdfghjklmnpqrstvwxyz"
    var word = word
    var closestVowel: String?
    var closestVowelIndex: Int?
    var index = word.count - 1
    while index >= 0 {
        if consonants.contains(word[word.index(word.startIndex, offsetBy: index)]) {
            if let vowelIndex = word.index(word.startIndex, offsetBy: index + 1) {
                if let vowel = vowels.firstIndex(of: word[vowelIndex]) {
                    if let closestVowelIndex = closestVowelIndex {
                        if vowel < closestVowelIndex {
                            closestVowel = String(word[vowelIndex])
                            closestVowelIndex = vowel
                        }
                    } else {
                        closestVowel = String(word[vowelIndex])
                        closestVowelIndex = vowel
                    }
                }
            }
        }
        index -= 1
    }
    return closestVowel ?? ""
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    let vowels = "aeiou"
    let consonants = "bcdfghjklmnpqrstvwxyz"
    var word = word
    var closestVowel: String?
    var closestVowelIndex: Int?
    var index = word.count - 1
    while index >= 0 {
        if consonants.contains(word[word.index(word.startIndex, offsetBy: index)]) {
            if let vowelIndex = word.index(word.startIndex, offsetBy: index + 1) {
                if let vowel = vowels.firstIndex(of: word[vowelIndex]) {
                    if let closestVowelIndex = closestVowelIndex {
                        if vowel < closestVowelIndex {
                            closestVowel = String(word[vowelIndex])
                            closestVowelIndex = vowel
                        }
                    } else {
                        closestVowel = String(word[vowelIndex])
                        closestVowelIndex = vowel
                    }
                }
            }
        }
        index -= 1
    }
    return closestVowel ?? ""
}
```
if let vowelIndex = word.index(word.startIndex, offsetBy: index + 1) { // initializer for conditional binding must have Optional type, not 'String.Index'
if vowel < closestVowelIndex { // referencing operator function '<' on 'BinaryInteger' requires that 'String.Index' conform to 'BinaryInteger'
closestVowelIndex = vowel // cannot assign value of type 'String.Index' to type 'Int'
closestVowelIndex = vowel // cannot assign to value: 'closestVowelIndex' is a 'let' constant
closestVowelIndex = vowel // cannot assign value of type 'String.Index' to type 'Int?'

func getClosestVowel(word: String) -> String {
    // Your code goes here
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    // Your code goes here
}
```
} // missing return in global function expected to return 'String'

func getClosestVowel(word: String) -> String {
    var word = word
    var vowels = ["a", "e", "i", "o", "u"]
    var index = 0
    var closestVowel = ""
    var isFound = false
    while index < word.count {
        if word[word.index(word.startIndex, offsetBy: index)].lowercased() == "a" ||
            word[word.index(word.startIndex, offsetBy: index)].lowercased() == "e" ||
            word[word.index(word.startIndex, offsetBy: index)].lowercased() == "i" ||
            word[word.index(word.startIndex, offsetBy: index)].lowercased() == "o" ||
            word[word.index(word.startIndex, offsetBy: index)].lowercased() == "u" {
            isFound = true
            closestVowel = word[word.index(word.startIndex, offsetBy: index)]
            break
        } else {
            index += 1
        }
    }
    if isFound {
        return closestVowel
    } else {
        return ""
    }
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    var word = word
    var vowels = ["a", "e", "i", "o", "u"]
    var index = 0
    var closestVowel = ""
    var isFound = false
    while index < word.count {
        if word[word.index(word.startIndex, offsetBy: index)].lowercased() == "a" ||
            word[word.index(word.startIndex, offsetBy: index)].lowercased() == "e" ||
            word[word.index(word.startIndex, offsetBy: index)].lowercased() == "i" ||
            word[word.index(word.startIndex, offsetBy: index)].lowercased() == "o" ||
            word[word.index(word.startIndex, offsetBy: index)].lowercased() == "u" {
            isFound = true
            closestVowel = word[word.index(word.startIndex, offsetBy: index)]
            break
        } else {
            index += 1
        }
    }
    if isFound {
        return closestVowel
    } else {
        return ""
    }
}
```
closestVowel = word[word.index(word.startIndex, offsetBy: index)] // cannot assign value of type 'Character' to type 'String'

func getClosestVowel(word: String) -> String {
    let vowels = "aeiou"
    let consonants = "bcdfghjklmnpqrstvwxyz"
    let word = word.lowercased()
    let wordArray = Array(word)
    var index = wordArray.count - 1
    while index >= 0 {
        if consonants.contains(wordArray[index]) {
            if index + 1 < wordArray.count && vowels.contains(wordArray[index + 1]) {
                return String(wordArray[index + 1])
            }
            break
        }
        index -= 1
    }
    return ""
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    let vowels = "aeiou"
    let consonants = "bcdfghjklmnpqrstvwxyz"
    let word = word.lowercased()
    let wordArray = Array(word)
    var index = wordArray.count - 1
    while index >= 0 {
        if consonants.contains(wordArray[index]) {
            if index + 1 < wordArray.count && vowels.contains(wordArray[index + 1]) {
                return String(wordArray[index + 1])
            }
            break
        }
        index -= 1
    }
    return ""
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    var stack = [Character]()
    for str in lst {
        for char in str {
            if char == "(" {
                stack.append(char)
            } else if char == ")" {
                if stack.isEmpty {
                    return "No"
                } else {
                    stack.removeLast()
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    var stack = [Character]()
    for str in lst {
        for char in str {
            if char == "(" {
                stack.append(char)
            } else if char == ")" {
                if stack.isEmpty {
                    return "No"
                } else {
                    stack.removeLast()
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    // Write your code here
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    // Write your code here
}
```
} // missing return in global function expected to return 'String'

func matchParens(lst: [String]) -> String {
    let open = Character("(")
    let close = Character(")")
    var stack = [Character]()
    for str in lst {
        for char in str {
            if char == open {
                stack.append(char)
            } else if char == close {
                if stack.isEmpty {
                    return "No"
                } else if stack.removeLast() != open {
                    return "No"
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    let open = Character("(")
    let close = Character(")")
    var stack = [Character]()
    for str in lst {
        for char in str {
            if char == open {
                stack.append(char)
            } else if char == close {
                if stack.isEmpty {
                    return "No"
                } else if stack.removeLast() != open {
                    return "No"
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    var stack = [Character]()
    for str in lst {
        for char in str {
            if char == "(" {
                stack.append(char)
            } else if char == ")" {
                if stack.isEmpty {
                    return "No"
                } else {
                    stack.removeLast()
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    var stack = [Character]()
    for str in lst {
        for char in str {
            if char == "(" {
                stack.append(char)
            } else if char == ")" {
                if stack.isEmpty {
                    return "No"
                } else {
                    stack.removeLast()
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    // Write your code here
    var stack = [Character]()
    for string in lst {
        for char in string {
            if char == "(" {
                stack.append(char)
            } else if char == ")" {
                if stack.isEmpty {
                    return "No"
                } else {
                    stack.removeLast()
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    // Write your code here
    var stack = [Character]()
    for string in lst {
        for char in string {
            if char == "(" {
                stack.append(char)
            } else if char == ")" {
                if stack.isEmpty {
                    return "No"
                } else {
                    stack.removeLast()
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    return "Yes"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    return "Yes"
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    // Write your code here
    return "Yes"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    // Write your code here
    return "Yes"
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    var stack = [Character]()
    for str in lst {
        for char in str {
            if char == "(" {
                stack.append(char)
            } else if char == ")" {
                if stack.isEmpty {
                    return "No"
                } else {
                    stack.removeLast()
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    var stack = [Character]()
    for str in lst {
        for char in str {
            if char == "(" {
                stack.append(char)
            } else if char == ")" {
                if stack.isEmpty {
                    return "No"
                } else {
                    stack.removeLast()
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    var stack = [Character]()
    for str in lst {
        for char in str {
            if char == "(" {
                stack.append(char)
            } else if char == ")" {
                if stack.isEmpty {
                    return "No"
                } else {
                    stack.removeLast()
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    var stack = [Character]()
    for str in lst {
        for char in str {
            if char == "(" {
                stack.append(char)
            } else if char == ")" {
                if stack.isEmpty {
                    return "No"
                } else {
                    stack.removeLast()
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    var stack = [Character]()
    for str in lst {
        for char in str {
            if char == "(" {
                stack.append(char)
            } else if char == ")" {
                if stack.isEmpty {
                    return "No"
                } else {
                    stack.removeLast()
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    var stack = [Character]()
    for str in lst {
        for char in str {
            if char == "(" {
                stack.append(char)
            } else if char == ")" {
                if stack.isEmpty {
                    return "No"
                } else {
                    stack.removeLast()
                }
            }
        }
    }
    return stack.isEmpty ? "Yes" : "No"
}
```
 // XCTAssertTrue failed

func maximum(arr: [Int], k: Int) -> [Int] {
    var arr = arr
    var maxHeap = Heap<Int>(sort: >)
    for i in 0..<k {
        maxHeap.insert(arr[i])
    }
    for i in k..<arr.count {
        if arr[i] > maxHeap.peek {
            maxHeap.remove()
            maxHeap.insert(arr[i])
        }
    }
    return maxHeap.sorted()
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    var arr = arr
    var maxHeap = Heap<Int>(sort: >)
    for i in 0..<k {
        maxHeap.insert(arr[i])
    }
    for i in k..<arr.count {
        if arr[i] > maxHeap.peek {
            maxHeap.remove()
            maxHeap.insert(arr[i])
        }
    }
    return maxHeap.sorted()
}
```
var maxHeap = Heap<Int>(sort: >) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    guard k > 0 else { return [] }
    guard k <= arr.count else { return arr }
    var maxHeap = MaxHeap(capacity: k)
    for i in 0..<k {
        maxHeap.insert(arr[i])
    }
    for i in k..<arr.count {
        if arr[i] > maxHeap.peek {
            maxHeap.extract()
            maxHeap.insert(arr[i])
        }
    }
    return maxHeap.array
}

class MaxHeap {
    private var array: [Int]
    private var count: Int
    private let capacity: Int
    
    init(capacity: Int) {
        self.capacity = capacity
        self.count = 0
        self.array = [Int](repeating: 0, count: capacity + 1)
    }
    
    func insert(_ item: Int) {
        if count >= capacity {
            return
        }
        count += 1
        array[count] = item
        swim(count)
    }
    
    func extract() -> Int {
        guard count > 0 else { return 0 }
        count -= 1
        let item = array[1]
        array[1] = array[count + 1]
        sink(1)
        return item
    }
    
    func peek() -> Int {
        return array[1]
    }
    
    func swim(_ k: Int) {
        var k = k
        while k > 1 && array[k / 2] < array[k] {
            array.swapAt(k / 2, k)
            k /= 2
        }
    }
    
    func sink(_ k: Int) {
        var k = k
        while 2 * k <= count {
            let j = 2 * k
            if j < count && array[j] < array[j + 1] {
                j += 1
            }
            if array[k] >= array[j] {
                break
            }
            array.swapAt(k, j)
            k = j
        }
    }
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    guard k > 0 else { return [] }
    guard k <= arr.count else { return arr }
    var maxHeap = MaxHeap(capacity: k)
    for i in 0..<k {
        maxHeap.insert(arr[i])
    }
    for i in k..<arr.count {
        if arr[i] > maxHeap.peek {
            maxHeap.extract()
            maxHeap.insert(arr[i])
        }
    }
    return maxHeap.array
}

class MaxHeap {
    private var array: [Int]
    private var count: Int
    private let capacity: Int
    
    init(capacity: Int) {
        self.capacity = capacity
        self.count = 0
        self.array = [Int](repeating: 0, count: capacity + 1)
    }
    
    func insert(_ item: Int) {
        if count >= capacity {
            return
        }
        count += 1
        array[count] = item
        swim(count)
    }
    
    func extract() -> Int {
        guard count > 0 else { return 0 }
        count -= 1
        let item = array[1]
        array[1] = array[count + 1]
        sink(1)
        return item
    }
    
    func peek() -> Int {
        return array[1]
    }
    
    func swim(_ k: Int) {
        var k = k
        while k > 1 && array[k / 2] < array[k] {
            array.swapAt(k / 2, k)
            k /= 2
        }
    }
    
    func sink(_ k: Int) {
        var k = k
        while 2 * k <= count {
            let j = 2 * k
            if j < count && array[j] < array[j + 1] {
                j += 1
            }
            if array[k] >= array[j] {
                break
            }
            array.swapAt(k, j)
            k = j
        }
    }
}
```
if arr[i] > maxHeap.peek { // binary operator '>' cannot be applied to operands of type 'Int' and '() -> Int'
maxHeap.extract() // result of call to 'extract()' is unused
return maxHeap.array // 'array' is inaccessible due to 'private' protection level
j += 1 // left side of mutating operator isn't mutable: 'j' is a 'let' constant

func maximum(arr: [Int], k: Int) -> [Int] {
    guard k > 0 else { return [] }
    guard k <= arr.count else { return arr }
    var maxHeap = arr.prefix(k)
    maxHeap.heapify()
    for i in k..<arr.count {
        if maxHeap.top > arr[i] {
            maxHeap.pop()
            maxHeap.push(arr[i])
        }
    }
    return maxHeap.sorted()
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    guard k > 0 else { return [] }
    guard k <= arr.count else { return arr }
    var maxHeap = arr.prefix(k)
    maxHeap.heapify()
    for i in k..<arr.count {
        if maxHeap.top > arr[i] {
            maxHeap.pop()
            maxHeap.push(arr[i])
        }
    }
    return maxHeap.sorted()
}
```
maxHeap.heapify() // value of type 'Array<Int>.SubSequence' (aka 'ArraySlice<Int>') has no member 'heapify'
if maxHeap.top > arr[i] { // value of type 'Array<Int>.SubSequence' (aka 'ArraySlice<Int>') has no member 'top'
maxHeap.pop() // value of type 'Array<Int>.SubSequence' (aka 'ArraySlice<Int>') has no member 'pop'
maxHeap.push(arr[i]) // value of type 'Array<Int>.SubSequence' (aka 'ArraySlice<Int>') has no member 'push'

func maximum(arr: [Int], k: Int) -> [Int] {
    guard k > 0 else { return [] }
    guard arr.count > 0 else { return [] }
    guard arr.count >= k else { return arr }
    
    var maxHeap = MaxHeap(arr)
    var result = [Int]()
    
    for _ in 0..<k {
        result.append(maxHeap.pop())
    }
    
    return result
}

class MaxHeap {
    private var heap = [Int]()
    private let parentIndex = { (index: Int) -> Int in
        return (index - 1) / 2
    }
    private let leftChildIndex = { (index: Int) -> Int in
        return index * 2 + 1
    }
    private let rightChildIndex = { (index: Int) -> Int in
        return index * 2 + 2
    }
    
    init(_ array: [Int]) {
        heap = array
        buildHeap()
    }
    
    func buildHeap() {
        var i = heap.count / 2
        while i >= 0 {
            heapify(i)
            i -= 1
        }
    }
    
    func heapify(_ index: Int) {
        var largest = index
        let left = leftChildIndex(index)
        let right = rightChildIndex(index)
        
        if left < heap.count, heap[left] > heap[largest] {
            largest = left
        }
        
        if right < heap.count, heap[right] > heap[largest] {
            largest = right
        }
        
        if largest != index {
            heap.swapAt(index, largest)
            heapify(largest)
        }
    }
    
    func pop() -> Int {
        guard heap.count > 0 else { return Int.min }
        
        let root = heap[0]
        heap.remove(at: 0)
        if heap.count > 0 {
            heap.insert(heap.removeLast(), at: 0)
            heapify(0)
        }
        
        return root
    }
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    guard k > 0 else { return [] }
    guard arr.count > 0 else { return [] }
    guard arr.count >= k else { return arr }
    
    var maxHeap = MaxHeap(arr)
    var result = [Int]()
    
    for _ in 0..<k {
        result.append(maxHeap.pop())
    }
    
    return result
}

class MaxHeap {
    private var heap = [Int]()
    private let parentIndex = { (index: Int) -> Int in
        return (index - 1) / 2
    }
    private let leftChildIndex = { (index: Int) -> Int in
        return index * 2 + 1
    }
    private let rightChildIndex = { (index: Int) -> Int in
        return index * 2 + 2
    }
    
    init(_ array: [Int]) {
        heap = array
        buildHeap()
    }
    
    func buildHeap() {
        var i = heap.count / 2
        while i >= 0 {
            heapify(i)
            i -= 1
        }
    }
    
    func heapify(_ index: Int) {
        var largest = index
        let left = leftChildIndex(index)
        let right = rightChildIndex(index)
        
        if left < heap.count, heap[left] > heap[largest] {
            largest = left
        }
        
        if right < heap.count, heap[right] > heap[largest] {
            largest = right
        }
        
        if largest != index {
            heap.swapAt(index, largest)
            heapify(largest)
        }
    }
    
    func pop() -> Int {
        guard heap.count > 0 else { return Int.min }
        
        let root = heap[0]
        heap.remove(at: 0)
        if heap.count > 0 {
            heap.insert(heap.removeLast(), at: 0)
            heapify(0)
        }
        
        return root
    }
}
```
var maxHeap = MaxHeap(arr) // variable 'maxHeap' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func maximum(arr: [Int], k: Int) -> [Int] {
    guard k > 0 else { return [] }
    guard k <= arr.count else { return arr }
    var maxHeap = arr.sorted(by: >).prefix(k)
    var i = k
    while i < arr.count {
        if arr[i] > maxHeap.first! {
            maxHeap.removeFirst()
            maxHeap.insert(arr[i], at: 0)
        }
        i += 1
    }
    return maxHeap
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    guard k > 0 else { return [] }
    guard k <= arr.count else { return arr }
    var maxHeap = arr.sorted(by: >).prefix(k)
    var i = k
    while i < arr.count {
        if arr[i] > maxHeap.first! {
            maxHeap.removeFirst()
            maxHeap.insert(arr[i], at: 0)
        }
        i += 1
    }
    return maxHeap
}
```
return maxHeap // cannot convert return expression of type 'Array<Int>.SubSequence' (aka 'ArraySlice<Int>') to return type '[Int]'

func maximum(arr: [Int], k: Int) -> [Int] {
    guard k > 0 else { return [] }
    guard arr.count > 0 else { return [] }
    guard k <= arr.count else { return arr }
    var maxHeap = Heap(arr, { $0 > $1 })
    var result = [Int]()
    for _ in 0..<k {
        result.append(maxHeap.pop())
    }
    return result
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    guard k > 0 else { return [] }
    guard arr.count > 0 else { return [] }
    guard k <= arr.count else { return arr }
    var maxHeap = Heap(arr, { $0 > $1 })
    var result = [Int]()
    for _ in 0..<k {
        result.append(maxHeap.pop())
    }
    return result
}
```
var maxHeap = Heap(arr, { $0 > $1 }) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    guard arr.count > 0, k > 0 else { return [] }
    var heap = Heap(arr, { $0 > $1 })
    var result = [Int]()
    for _ in 0..<k {
        result.append(heap.pop()!)
    }
    return result
}

class Heap {
    var arr: [Int]
    var heapSize: Int
    var comparator: (Int, Int) -> Bool
    
    init(_ arr: [Int], _ comparator: @escaping (Int, Int) -> Bool) {
        self.arr = arr
        self.heapSize = arr.count
        self.comparator = comparator
    }
    
    func pop() -> Int? {
        guard heapSize > 0 else { return nil }
        heapSize -= 1
        let result = arr[0]
        arr[0] = arr[heapSize]
        heapifyDown()
        return result
    }
    
    func heapifyDown() {
        var index = 0
        while true {
            let left = index * 2 + 1
            let right = index * 2 + 2
            var largest = index
            if left < heapSize, comparator(arr[left], arr[largest]) {
                largest = left
            }
            if right < heapSize, comparator(arr[right], arr[largest]) {
                largest = right
            }
            if largest == index {
                break
            }
            swap(index, largest)
            index = largest
        }
    }
    
    func swap(_ i: Int, _ j: Int) {
        let temp = arr[i]
        arr[i] = arr[j]
        arr[j] = temp
    }
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    guard arr.count > 0, k > 0 else { return [] }
    var heap = Heap(arr, { $0 > $1 })
    var result = [Int]()
    for _ in 0..<k {
        result.append(heap.pop()!)
    }
    return result
}

class Heap {
    var arr: [Int]
    var heapSize: Int
    var comparator: (Int, Int) -> Bool
    
    init(_ arr: [Int], _ comparator: @escaping (Int, Int) -> Bool) {
        self.arr = arr
        self.heapSize = arr.count
        self.comparator = comparator
    }
    
    func pop() -> Int? {
        guard heapSize > 0 else { return nil }
        heapSize -= 1
        let result = arr[0]
        arr[0] = arr[heapSize]
        heapifyDown()
        return result
    }
    
    func heapifyDown() {
        var index = 0
        while true {
            let left = index * 2 + 1
            let right = index * 2 + 2
            var largest = index
            if left < heapSize, comparator(arr[left], arr[largest]) {
                largest = left
            }
            if right < heapSize, comparator(arr[right], arr[largest]) {
                largest = right
            }
            if largest == index {
                break
            }
            swap(index, largest)
            index = largest
        }
    }
    
    func swap(_ i: Int, _ j: Int) {
        let temp = arr[i]
        arr[i] = arr[j]
        arr[j] = temp
    }
}
```
var heap = Heap(arr, { $0 > $1 }) // variable 'heap' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func maximum(arr: [Int], k: Int) -> [Int] {
    var arr = arr
    arr.sort()
    var result = [Int]()
    for i in 0..<k {
        result.append(arr[i])
    }
    return result
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    var arr = arr
    arr.sort()
    var result = [Int]()
    for i in 0..<k {
        result.append(arr[i])
    }
    return result
}
```
 // XCTAssertTrue failed

func maximum(arr: [Int], k: Int) -> [Int] {
    var arr = arr
    var maxHeap = arr.prefix(k)
    maxHeap.heapify()
    for i in k..<arr.count {
        if maxHeap.top! < arr[i] {
            maxHeap.pop()
            maxHeap.push(arr[i])
        }
    }
    return maxHeap.sorted()
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    var arr = arr
    var maxHeap = arr.prefix(k)
    maxHeap.heapify()
    for i in k..<arr.count {
        if maxHeap.top! < arr[i] {
            maxHeap.pop()
            maxHeap.push(arr[i])
        }
    }
    return maxHeap.sorted()
}
```
maxHeap.heapify() // value of type 'Array<Int>.SubSequence' (aka 'ArraySlice<Int>') has no member 'heapify'
if maxHeap.top! < arr[i] { // value of type 'Array<Int>.SubSequence' (aka 'ArraySlice<Int>') has no member 'top'
maxHeap.pop() // value of type 'Array<Int>.SubSequence' (aka 'ArraySlice<Int>') has no member 'pop'
maxHeap.push(arr[i]) // value of type 'Array<Int>.SubSequence' (aka 'ArraySlice<Int>') has no member 'push'

func maximum(arr: [Int], k: Int) -> [Int] {
    guard k > 0 && k <= arr.count else { return [] }
    var maxHeap = Heap(arr: arr, k: k, isMaxHeap: true)
    return maxHeap.elements
}

class Heap {
    var elements: [Int]
    var k: Int
    var isMaxHeap: Bool
    
    init(arr: [Int], k: Int, isMaxHeap: Bool) {
        self.elements = arr
        self.k = k
        self.isMaxHeap = isMaxHeap
        buildHeap()
    }
    
    func buildHeap() {
        for i in stride(from: elements.count / 2 - 1, through: 0, by: -1) {
            heapify(i: i)
        }
    }
    
    func heapify(i: Int) {
        var i = i
        var largest = i
        let left = 2 * i + 1
        let right = 2 * i + 2
        
        if left < elements.count && (isMaxHeap ? elements[left] > elements[i] : elements[left] < elements[i]) {
            largest = left
        }
        
        if right < elements.count && (isMaxHeap ? elements[right] > elements[largest] : elements[right] < elements[largest]) {
            largest = right
        }
        
        if largest != i {
            swap(&elements[i], &elements[largest])
            heapify(i: largest)
        }
    }
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    guard k > 0 && k <= arr.count else { return [] }
    var maxHeap = Heap(arr: arr, k: k, isMaxHeap: true)
    return maxHeap.elements
}

class Heap {
    var elements: [Int]
    var k: Int
    var isMaxHeap: Bool
    
    init(arr: [Int], k: Int, isMaxHeap: Bool) {
        self.elements = arr
        self.k = k
        self.isMaxHeap = isMaxHeap
        buildHeap()
    }
    
    func buildHeap() {
        for i in stride(from: elements.count / 2 - 1, through: 0, by: -1) {
            heapify(i: i)
        }
    }
    
    func heapify(i: Int) {
        var i = i
        var largest = i
        let left = 2 * i + 1
        let right = 2 * i + 2
        
        if left < elements.count && (isMaxHeap ? elements[left] > elements[i] : elements[left] < elements[i]) {
            largest = left
        }
        
        if right < elements.count && (isMaxHeap ? elements[right] > elements[largest] : elements[right] < elements[largest]) {
            largest = right
        }
        
        if largest != i {
            swap(&elements[i], &elements[largest])
            heapify(i: largest)
        }
    }
}
```
var maxHeap = Heap(arr: arr, k: k, isMaxHeap: true) // variable 'maxHeap' was never mutated; consider changing to 'let' constant
var i = i // variable 'i' was never mutated; consider changing to 'let' constant

func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```

func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 && lst[i] % 2 != 0 {
            sum += lst[i]
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 && lst[i] % 2 != 0 {
            sum += lst[i]
        }
    }
    return sum
}
```

func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 && lst[i] % 2 != 0 {
            sum += lst[i]
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 && lst[i] % 2 != 0 {
            sum += lst[i]
        }
    }
    return sum
}
```

func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 && lst[i] % 2 != 0 {
            sum += lst[i]
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 && lst[i] % 2 != 0 {
            sum += lst[i]
        }
    }
    return sum
}
```

func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```

func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 && lst[i] % 2 != 0 {
            sum += lst[i]
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 && lst[i] % 2 != 0 {
            sum += lst[i]
        }
    }
    return sum
}
```

func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```

func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 0 && element % 2 != 0 {
            sum += element
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, element) in lst.enumerated() {
        if index % 2 == 0 && element % 2 != 0 {
            sum += element
        }
    }
    return sum
}
```

func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 && lst[i] % 2 != 0 {
            sum += lst[i]
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 && lst[i] % 2 != 0 {
            sum += lst[i]
        }
    }
    return sum
}
```

func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2 != 0 {
            sum += value
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    while i < k {
        if arr[i] < 10 {
            sum += arr[i]
        } else {
            sum += arr[i] % 10
        }
        i += 1
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    while i < k {
        if arr[i] < 10 {
            sum += arr[i]
        } else {
            sum += arr[i] % 10
        }
        i += 1
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<k {
        let number = arr[i]
        let digits = number.description.count
        if digits <= 2 {
            sum += number
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<k {
        let number = arr[i]
        let digits = number.description.count
        if digits <= 2 {
            sum += number
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    var j = k
    while j < arr.count {
        sum += arr[i] + arr[j]
        i += 1
        j += 1
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    var j = k
    while j < arr.count {
        sum += arr[i] + arr[j]
        i += 1
        j += 1
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    while i < k {
        let num = arr[i]
        if num < 10 {
            sum += num
        } else {
            let tens = num / 10
            let ones = num % 10
            sum += tens + ones
        }
        i += 1
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    while i < k {
        let num = arr[i]
        if num < 10 {
            sum += num
        } else {
            let tens = num / 10
            let ones = num % 10
            sum += tens + ones
        }
        i += 1
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    var i = 0
    while count < k && i < arr.count {
        let num = arr[i]
        if num < 100 {
            sum += num
            count += 1
        }
        i += 1
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    var i = 0
    while count < k && i < arr.count {
        let num = arr[i]
        if num < 100 {
            sum += num
            count += 1
        }
        i += 1
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    var j = k
    while i < j {
        sum += arr[i]
        i += 1
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    var j = k
    while i < j {
        sum += arr[i]
        i += 1
    }
    return sum
}
```
var j = k // variable 'j' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    var j = k
    while i < k {
        if arr[i] < 100 {
            sum += arr[i]
            i += 1
        } else {
            sum += arr[i]
            i += 1
            while j < arr.count && arr[j] >= 100 {
                j += 1
            }
            if j < arr.count {
                sum += arr[j]
                j += 1
            }
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    var j = k
    while i < k {
        if arr[i] < 100 {
            sum += arr[i]
            i += 1
        } else {
            sum += arr[i]
            i += 1
            while j < arr.count && arr[j] >= 100 {
                j += 1
            }
            if j < arr.count {
                sum += arr[j]
                j += 1
            }
        }
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<k {
        let number = arr[i]
        let digits = number.description.count
        if digits <= 2 {
            sum += number
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<k {
        let number = arr[i]
        let digits = number.description.count
        if digits <= 2 {
            sum += number
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<k {
        let digitCount = digitCount(num: arr[i])
        if digitCount <= 2 {
            sum += arr[i]
        }
    }
    return sum
}

func digitCount(num: Int) -> Int {
    var count = 0
    var num = num
    while num > 0 {
        count += 1
        num /= 10
    }
    return count
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<k {
        let digitCount = digitCount(num: arr[i])
        if digitCount <= 2 {
            sum += arr[i]
        }
    }
    return sum
}

func digitCount(num: Int) -> Int {
    var count = 0
    var num = num
    while num > 0 {
        count += 1
        num /= 10
    }
    return count
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var result = 0
    var i = 0
    var j = 0
    while i < k {
        if arr[i] < 10 {
            result += arr[i]
            i += 1
        } else if arr[i] < 100 {
            result += arr[i]
            i += 1
        } else {
            result += arr[i] / 10 + arr[i] % 10
            i += 1
        }
    }
    while j < arr.count - k {
        if arr[j] < 10 {
            result += arr[j]
            j += 1
        } else if arr[j] < 100 {
            result += arr[j]
            j += 1
        } else {
            result += arr[j] / 10 + arr[j] % 10
            j += 1
        }
    }
    return result
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var result = 0
    var i = 0
    var j = 0
    while i < k {
        if arr[i] < 10 {
            result += arr[i]
            i += 1
        } else if arr[i] < 100 {
            result += arr[i]
            i += 1
        } else {
            result += arr[i] / 10 + arr[i] % 10
            i += 1
        }
    }
    while j < arr.count - k {
        if arr[j] < 10 {
            result += arr[j]
            j += 1
        } else if arr[j] < 100 {
            result += arr[j]
            j += 1
        } else {
            result += arr[j] / 10 + arr[j] % 10
            j += 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2 != 0 {
            result.append(current)
        }
    }
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2 != 0 {
            result.append(current)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var num = n
    while num != 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = 3 * num + 1
        }
        if num % 2 == 1 {
            result.append(num)
        }
    }
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var num = n
    while num != 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = 3 * num + 1
        }
        if num % 2 == 1 {
            result.append(num)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        if current % 2 != 0 {
            result.append(current)
        }
    }
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        if current % 2 != 0 {
            result.append(current)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var num = n
    while num != 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = num * 3 + 1
        }
        if num % 2 == 1 {
            result.append(num)
        }
    }
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var num = n
    while num != 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = num * 3 + 1
        }
        if num % 2 == 1 {
            result.append(num)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var result: [Int] = []
    var num = n
    while num != 1 {
        if num % 2 == 0 {
            num = num / 2
        } else {
            num = num * 3 + 1
        }
        if num % 2 != 0 {
            result.append(num)
        }
    }
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result: [Int] = []
    var num = n
    while num != 1 {
        if num % 2 == 0 {
            num = num / 2
        } else {
            num = num * 3 + 1
        }
        if num % 2 != 0 {
            result.append(num)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        current = current % 2 == 0 ? current / 2 : 3 * current + 1
    }
    result.append(1)
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        current = current % 2 == 0 ? current / 2 : 3 * current + 1
    }
    result.append(1)
    return result
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
    }
    result.append(1)
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
    }
    result.append(1)
    return result
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var num = n
    while num != 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = num * 3 + 1
        }
        result.append(num)
    }
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var num = n
    while num != 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = num * 3 + 1
        }
        result.append(num)
    }
    return result
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        current = current % 2 == 0 ? current / 2 : 3 * current + 1
    }
    result.append(1)
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 1 {
            result.append(current)
        }
        current = current % 2 == 0 ? current / 2 : 3 * current + 1
    }
    result.append(1)
    return result
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var oddCollatz = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2 != 0 {
            oddCollatz.append(current)
        }
    }
    return oddCollatz
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var oddCollatz = [Int]()
    var current = n
    while current != 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2 != 0 {
            oddCollatz.append(current)
        }
    }
    return oddCollatz
}
```
 // XCTAssertTrue failed

func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month > 0 && month <= 12 else { return false }
    guard day > 0 && day <= 31 else { return false }
    guard year > 0 else { return false }
    guard day <= 31 else { return false }
    guard day <= 30 else { return false }
    guard day <= 29 else { return false }
    return true
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month > 0 && month <= 12 else { return false }
    guard day > 0 && day <= 31 else { return false }
    guard year > 0 else { return false }
    guard day <= 31 else { return false }
    guard day <= 30 else { return false }
    guard day <= 29 else { return false }
    return true
}
```

func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month > 0 && month <= 12 else { return false }
    guard day > 0 && day <= 31 else { return false }
    guard year > 0 else { return false }
    guard day <= 31 else { return false }
    guard day <= 30 else { return false }
    guard day <= 29 else { return false }
    return true
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month > 0 && month <= 12 else { return false }
    guard day > 0 && day <= 31 else { return false }
    guard year > 0 else { return false }
    guard day <= 31 else { return false }
    guard day <= 30 else { return false }
    guard day <= 29 else { return false }
    return true
}
```

func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month > 0 && month < 13 else { return false }
    guard day > 0 && day < 32 else { return false }
    guard year > 0 else { return false }
    guard day <= getDaysInMonth(month: month, year: year) else { return false }
    return true
}

func getDaysInMonth(month: Int, year: Int) -> Int {
    switch month {
    case 1, 3, 5, 7, 8, 10, 12:
        return 31
    case 4, 6, 9, 11:
        return 30
    case 2:
        return isLeapYear(year: year) ? 29 : 28
    default:
        return 0
    }
}

func isLeapYear(year: Int) -> Bool {
    return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month > 0 && month < 13 else { return false }
    guard day > 0 && day < 32 else { return false }
    guard year > 0 else { return false }
    guard day <= getDaysInMonth(month: month, year: year) else { return false }
    return true
}

func getDaysInMonth(month: Int, year: Int) -> Int {
    switch month {
    case 1, 3, 5, 7, 8, 10, 12:
        return 31
    case 4, 6, 9, 11:
        return 30
    case 2:
        return isLeapYear(year: year) ? 29 : 28
    default:
        return 0
    }
}

func isLeapYear(year: Int) -> Bool {
    return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0
}
```

func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month > 0 && month <= 12 else { return false }
    guard day > 0 && day <= 31 else { return false }
    guard year > 0 else { return false }
    guard day <= 31 else { return false }
    guard day <= 30 else { return false }
    guard day <= 29 else { return false }
    return true
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month > 0 && month <= 12 else { return false }
    guard day > 0 && day <= 31 else { return false }
    guard year > 0 else { return false }
    guard day <= 31 else { return false }
    guard day <= 30 else { return false }
    guard day <= 29 else { return false }
    return true
}
```

func validDate(date: String) -> Bool {
    // Write your code here
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    // Write your code here
}
```
} // missing return in global function expected to return 'Bool'

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    guard let date = dateFormatter.date(from: date) else { return false }
    let calendar = Calendar.current
    let components = calendar.dateComponents([.year, .month, .day], from: date)
    guard components.year != nil, components.month != nil, components.day != nil else { return false }
    let month = components.month!
    let day = components.day!
    if month < 1 || month > 12 { return false }
    if day < 1 || day > 31 { return false }
    if month == 2 {
        if day < 1 || day > 29 { return false }
    } else if month == 4 || month == 6 || month == 9 || month == 11 {
        if day < 1 || day > 30 { return false }
    }
    return true
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    guard let date = dateFormatter.date(from: date) else { return false }
    let calendar = Calendar.current
    let components = calendar.dateComponents([.year, .month, .day], from: date)
    guard components.year != nil, components.month != nil, components.day != nil else { return false }
    let month = components.month!
    let day = components.day!
    if month < 1 || month > 12 { return false }
    if day < 1 || day > 31 { return false }
    if month == 2 {
        if day < 1 || day > 29 { return false }
    } else if month == 4 || month == 6 || month == 9 || month == 11 {
        if day < 1 || day > 30 { return false }
    }
    return true
}
```

func validDate(date: String) -> Bool {
    guard !date.isEmpty else { return false }
    let components = date.components(separatedBy: "-")
    guard components.count == 3 else { return false }
    guard let month = Int(components[0]), let day = Int(components[1]), let year = Int(components[2]) else { return false }
    guard month >= 1 && month <= 12 else { return false }
    guard day >= 1 && day <= 31 else { return false }
    guard year >= 1 && year <= 9999 else { return false }
    guard day <= 31 else { return false }
    guard day <= 30 else { return false }
    guard day <= 29 else { return false }
    return true
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    guard !date.isEmpty else { return false }
    let components = date.components(separatedBy: "-")
    guard components.count == 3 else { return false }
    guard let month = Int(components[0]), let day = Int(components[1]), let year = Int(components[2]) else { return false }
    guard month >= 1 && month <= 12 else { return false }
    guard day >= 1 && day <= 31 else { return false }
    guard year >= 1 && year <= 9999 else { return false }
    guard day <= 31 else { return false }
    guard day <= 30 else { return false }
    guard day <= 29 else { return false }
    return true
}
```

func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month >= 1 && month <= 12 else { return false }
    guard day >= 1 && day <= 31 else { return false }
    guard year >= 1 && year <= 9999 else { return false }
    guard day <= 31 else { return false }
    guard day <= 30 else { return false }
    guard day <= 29 else { return false }
    return true
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month >= 1 && month <= 12 else { return false }
    guard day >= 1 && day <= 31 else { return false }
    guard year >= 1 && year <= 9999 else { return false }
    guard day <= 31 else { return false }
    guard day <= 30 else { return false }
    guard day <= 29 else { return false }
    return true
}
```

func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month >= 1 && month <= 12 else { return false }
    guard day >= 1 && day <= 31 else { return false }
    guard year >= 1 && year <= 9999 else { return false }
    guard day <= daysInMonth(month: month, year: year) else { return false }
    return true
}

func daysInMonth(month: Int, year: Int) -> Int {
    let isLeapYear = year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)
    switch month {
    case 2:
        return isLeapYear ? 29 : 28
    case 4, 6, 9, 11:
        return 30
    default:
        return 31
    }
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month >= 1 && month <= 12 else { return false }
    guard day >= 1 && day <= 31 else { return false }
    guard year >= 1 && year <= 9999 else { return false }
    guard day <= daysInMonth(month: month, year: year) else { return false }
    return true
}

func daysInMonth(month: Int, year: Int) -> Int {
    let isLeapYear = year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)
    switch month {
    case 2:
        return isLeapYear ? 29 : 28
    case 4, 6, 9, 11:
        return 30
    default:
        return 31
    }
}
```

func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month > 0 && month < 13 else { return false }
    guard day > 0 && day < 32 else { return false }
    guard year > 0 else { return false }
    guard day < 31 || (day < 30 && month != 2) || (day < 29 && month == 2) else { return false }
    return true
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    guard dateComponents.count == 3 else { return false }
    guard let month = Int(dateComponents[0]), let day = Int(dateComponents[1]), let year = Int(dateComponents[2]) else { return false }
    guard month > 0 && month < 13 else { return false }
    guard day > 0 && day < 32 else { return false }
    guard year > 0 else { return false }
    guard day < 31 || (day < 30 && month != 2) || (day < 29 && month == 2) else { return false }
    return true
}
```

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    guard words.count > 0 else {
        let count = txt.count
        let lowerCount = count - count.countOfLowercaseLetters
        return .failure(lowerCount)
    }
    return .success(Array(words))
}

func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    guard words.count > 0 else {
        let count = txt.count
        let lowerCount = count - count.countOfLowercaseLetters
        return .failure(lowerCount)
    }
    return .success(Array(words))
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    guard words.count > 0 else {
        let count = txt.count
        let lowerCount = count - count.countOfLowercaseLetters
        return .failure(lowerCount)
    }
    return .success(Array(words))
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    guard words.count > 0 else {
        let count = txt.count
        let lowerCount = count - count.countOfLowercaseLetters
        return .failure(lowerCount)
    }
    return .success(Array(words))
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    guard words.count > 0 else {
        let count = txt.count
        let lowerCount = count - count.countOfLowercaseLetters
        return .failure(lowerCount)
    }
    return .success(Array(words))
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    guard words.count > 0 else {
        let count = txt.count
        let lowerCount = count - count.countOfLowercaseLetters
        return .failure(lowerCount)
    }
    return .success(Array(words))
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    guard words.count > 0 else
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let lowerCount = count - count.countOfLowercaseLetters // value of type 'Int' has no member 'countOfLowercaseLetters'
return .success(Array(words)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'
func splitWords(txt: String) -> Result<[String], Int> { // invalid redeclaration of 'splitWords(txt:)'
let lowerCount = count - count.countOfLowercaseLetters // value of type 'Int' has no member 'countOfLowercaseLetters'
return .success(Array(words)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }
    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }
    let letters = txt.map { ord($0) }
    let oddLetters = letters.filter { $0 % 2 == 1 }
    return .failure(oddLetters.count)
}

func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }
    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }
    let letters = txt.map { ord($0) }
    let oddLetters = letters.filter { $0 % 2 == 1 }
    return .failure(oddLetters.count)
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }
    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }
    let letters = txt.map { ord($0) }
    let oddLetters = letters.filter { $0 % 2 == 1 }
    return .failure(oddLetters.count)
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }
    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }
    let letters = txt.map { ord($0) }
    let oddLetters = letters.filter { $0 % 2 == 1 }
    return .failure(oddLetters.count)
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }
    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }
    let letters = txt.map { ord($0) }
    let oddLetters = letters.filter { $0 % 2 == 1 }
    return .failure(oddLetters.count)
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }
    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }
    let letters = txt.map { ord($0) }
    let oddLetters = letters.filter { $0 % 2 == 1 }
    return .failure(
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return .success(Array(words)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'
return .success(Array(commas)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'
let letters = txt.map { ord($0) } // cannot find 'ord' in scope
func splitWords(txt: String) -> Result<[String], Int> { // invalid redeclaration of 'splitWords(txt:)'
return .success(Array(words)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'
return .success(Array(commas)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'
let letters = txt.map { ord($0) } // cannot find 'ord' in scope

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }
    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }
    let letters = Array(txt)
    let oddLetters = letters.filter { $0.isLowercase }.filter { $0.asciiValue! % 2 == 1 }
    return .failure(oddLetters.count)
}

func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }
    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }
    let letters = Array(txt)
    let oddLetters = letters.filter { $0.isLowercase }.filter { $0.asciiValue! % 2 == 1 }
    return .failure(oddLetters.count)
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }
    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }
    let letters = Array(txt)
    let oddLetters = letters.filter { $0.isLowercase }.filter { $0.asciiValue! % 2 == 1 }
    return .failure(oddLetters.count)
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }
    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }
    let letters = Array(txt)
    let oddLetters = letters.filter { $0.isLowercase }.filter { $0.asciiValue! % 2 == 1 }
    return .failure(oddLetters.count)
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }
    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }
    let letters = Array(txt)
    let oddLetters = letters.filter { $0.isLowercase }.filter { $0.asciiValue! % 2 == 1 }
    return .failure(oddLetters.count)
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }
    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }
    let letters = Array(txt)
   
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return .success(Array(words)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'
return .success(Array(commas)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'
func splitWords(txt: String) -> Result<[String], Int> { // invalid redeclaration of 'splitWords(txt:)'
return .success(Array(words)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'
return .success(Array(commas)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    // TODO: Implement your solution here
    return .success(["Hello", "world!"])
}

func splitWords(txt: String) -> Result<[String], Int> {
    // TODO: Implement your solution here
    return .success(["Hello", "world!"])
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    // TODO: Implement your solution here
    return .success(["Hello", "world!"])
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    // TODO: Implement your solution here
    return .success(["Hello", "world!"])
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    // TODO: Implement your solution here
    return .success(["Hello", "world!"])
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    // TODO: Implement your solution here
    return .success(["Hello", "world!"])
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    // TODO: Implement your solution here
    return .success(["Hello", "world!"])
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    // TODO: Implement your solution here
    return .success(["Hello",
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
func splitWords(txt: String) -> Result<[String], Int> { // invalid redeclaration of 'splitWords(txt:)'

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count == 0 {
        return .failure(txt.count)
    }
    return .success(Array(words))
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count == 0 {
        return .failure(txt.count)
    }
    return .success(Array(words))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return .success(Array(words)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }

    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }

    let lowercaseLetters = txt.lowercased().filter { "a"..."z" ~= $0 }
    let oddOrderedLetters = lowercaseLetters.filter { $0.asciiValue! % 2 == 1 }
    return .failure(oddOrderedLetters.count)
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    }

    let commas = txt.split(separator: ",")
    if commas.count > 0 {
        return .success(Array(commas))
    }

    let lowercaseLetters = txt.lowercased().filter { "a"..."z" ~= $0 }
    let oddOrderedLetters = lowercaseLetters.filter { $0.asciiValue! % 2 == 1 }
    return .failure(oddOrderedLetters.count)
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return .success(Array(words)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'
return .success(Array(commas)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.components(separatedBy: .whitespaces)
    if words.count > 0 {
        return .success(words)
    } else {
        let letters = txt.lowercased().map { ord($0) }
        let oddLetters = letters.filter { $0 % 2 == 1 }
        return .failure(oddLetters.count)
    }
}

func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.components(separatedBy: .whitespaces)
    if words.count > 0 {
        return .success(words)
    } else {
        let letters = txt.lowercased().map { ord($0) }
        let oddLetters = letters.filter { $0 % 2 == 1 }
        return .failure(oddLetters.count)
    }
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.components(separatedBy: .whitespaces)
    if words.count > 0 {
        return .success(words)
    } else {
        let letters = txt.lowercased().map { ord($0) }
        let oddLetters = letters.filter { $0 % 2 == 1 }
        return .failure(oddLetters.count)
    }
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.components(separatedBy: .whitespaces)
    if words.count > 0 {
        return .success(words)
    } else {
        let letters = txt.lowercased().map { ord($0) }
        let oddLetters = letters.filter { $0 % 2 == 1 }
        return .failure(oddLetters.count)
    }
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.components(separatedBy: .whitespaces)
    if words.count > 0 {
        return .success(words)
    } else {
        let letters = txt.lowercased().map { ord($0) }
        let oddLetters = letters.filter { $0 % 2 == 1 }
        return .failure(oddLetters.count)
    }
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.components(separatedBy: .whitespaces)
    if words.count > 0 {
        return .success(words)
    } else {
        let letters = txt.lowercased().map { ord($0) }
        let oddLetters = letters.filter { $0 % 2 == 1 }
        return .failure(oddLetters.count)
    }
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let letters = txt.lowercased().map { ord($0) } // cannot find 'ord' in scope
func splitWords(txt: String) -> Result<[String], Int> { // invalid redeclaration of 'splitWords(txt:)'
let letters = txt.lowercased().map { ord($0) } // cannot find 'ord' in scope

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count == 0 {
        return .failure(txt.count)
    }
    return .success(Array(words))
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count == 0 {
        return .failure(txt.count)
    }
    return .success(Array(words))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return .success(Array(words)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    } else {
        let commas = txt.split(separator: ",")
        if commas.count > 0 {
            return .success(Array(commas))
        } else {
            let oddLetters = txt.count - txt.filter { $0.isLowercase }.count
            return .failure(oddLetters)
        }
    }
}

func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    } else {
        let commas = txt.split(separator: ",")
        if commas.count > 0 {
            return .success(Array(commas))
        } else {
            let oddLetters = txt.count - txt.filter { $0.isLowercase }.count
            return .failure(oddLetters)
        }
    }
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    } else {
        let commas = txt.split(separator: ",")
        if commas.count > 0 {
            return .success(Array(commas))
        } else {
            let oddLetters = txt.count - txt.filter { $0.isLowercase }.count
            return .failure(oddLetters)
        }
    }
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    } else {
        let commas = txt.split(separator: ",")
        if commas.count > 0 {
            return .success(Array(commas))
        } else {
            let oddLetters = txt.count - txt.filter { $0.isLowercase }.count
            return .failure(oddLetters)
        }
    }
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    } else {
        let commas = txt.split(separator: ",")
        if commas.count > 0 {
            return .success(Array(commas))
        } else {
            let oddLetters = txt.count - txt.filter { $0.isLowercase }.count
            return .failure(oddLetters)
        }
    }
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 0 {
        return .success(Array(words))
    } else {
        let commas = txt.split(separator: ",")
        if commas.count > 0 {
            return .success(Array(commas))
        } else {
            let oddLetters = txt.count - txt.filter { $0.isLowercase }.count
            return .failure(oddLetters)
        }
    }
}
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return .success(Array(words)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'
return .success(Array(commas)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'
func splitWords(txt: String) -> Result<[String], Int> { // invalid redeclaration of 'splitWords(txt:)'
return .success(Array(words)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'
return .success(Array(commas)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count == 0 {
        return .failure(txt.count)
    }
    return .success(Array(words))
}

func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count == 0 {
        return .failure(txt.count)
    }
    return .success(Array(words))
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count == 0 {
        return .failure(txt.count)
    }
    return .success(Array(words))
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count == 0 {
        return .failure(txt.count)
    }
    return .success(Array(words))
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count == 0 {
        return .failure(txt.count)
    }
    return .success(Array(words))
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count == 0 {
        return .failure(txt.count)
    }
    return .success(Array(words))
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") == .success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") == .success(["Hello", "world!"])
// splitWords(txt: "abcdef") == .failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count == 0 {
        return .failure(txt.count)
    }
    return .success(Array(words))
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return .success(Array(words)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'
func splitWords(txt: String) -> Result<[String], Int> { // invalid redeclaration of 'splitWords(txt:)'
return .success(Array(words)) // cannot convert value of type 'Array<String.SubSequence>' (aka 'Array<Substring>') to expected argument type '[String]'

func isSorted(lst: [Int]) -> Bool {
    guard lst.count > 1 else { return true }
    var prev = lst[0]
    for i in 1..<lst.count {
        if lst[i] < prev {
            return false
        }
        prev = lst[i]
    }
    return true
}
```swift
// Given an array of numbers, return whether or not they are sorted
// in ascending order. If array has more than 1 duplicate of the same
// number, return false. Assume no negative numbers and only integers.
// Examples
// isSorted(lst: [5]) == true
// isSorted(lst: [1, 2, 3, 4, 5]) == true
// isSorted(lst: [1, 3, 2, 4, 5]) == false
// isSorted(lst: [1, 2, 3, 4, 5, 6]) == true
// isSorted(lst: [1, 2, 3, 4, 5, 6, 7]) == true
// isSorted(lst: [1, 3, 2, 4, 5, 6, 7]) == false
// isSorted(lst: [1, 2, 2, 3, 3, 4]) == true
// isSorted(lst: [1, 2, 2, 2, 3, 4]) == false
func isSorted(lst: [Int]) -> Bool {
    guard lst.count > 1 else { return true }
    var prev = lst[0]
    for i in 1..<lst.count {
        if lst[i] < prev {
            return false
        }
        prev = lst[i]
    }
    return true
}
```
 // XCTAssertTrue failed

func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 0..<lst.count - 1 {
        if lst[i] > lst[i + 1] {
            sorted = false
            break
        }
    }
    return sorted
}
```swift
// Given an array of numbers, return whether or not they are sorted
// in ascending order. If array has more than 1 duplicate of the same
// number, return false. Assume no negative numbers and only integers.
// Examples
// isSorted(lst: [5]) == true
// isSorted(lst: [1, 2, 3, 4, 5]) == true
// isSorted(lst: [1, 3, 2, 4, 5]) == false
// isSorted(lst: [1, 2, 3, 4, 5, 6]) == true
// isSorted(lst: [1, 2, 3, 4, 5, 6, 7]) == true
// isSorted(lst: [1, 3, 2, 4, 5, 6, 7]) == false
// isSorted(lst: [1, 2, 2, 3, 3, 4]) == true
// isSorted(lst: [1, 2, 2, 2, 3, 4]) == false
func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 0..<lst.count - 1 {
        if lst[i] > lst[i + 1] {
            sorted = false
            break
        }
    }
    return sorted
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 1..<lst.count {
        if lst[i] < lst[i - 1] {
            sorted = false
            break
        }
    }
    return sorted
}
```swift
// Given an array of numbers, return whether or not they are sorted
// in ascending order. If array has more than 1 duplicate of the same
// number, return false. Assume no negative numbers and only integers.
// Examples
// isSorted(lst: [5]) == true
// isSorted(lst: [1, 2, 3, 4, 5]) == true
// isSorted(lst: [1, 3, 2, 4, 5]) == false
// isSorted(lst: [1, 2, 3, 4, 5, 6]) == true
// isSorted(lst: [1, 2, 3, 4, 5, 6, 7]) == true
// isSorted(lst: [1, 3, 2, 4, 5, 6, 7]) == false
// isSorted(lst: [1, 2, 2, 3, 3, 4]) == true
// isSorted(lst: [1, 2, 2, 2, 3, 4]) == false
func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 1..<lst.count {
        if lst[i] < lst[i - 1] {
            sorted = false
            break
        }
    }
    return sorted
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func isSorted(lst: [Int]) -> Bool {
    guard lst.count > 1 else { return true }
    var sorted = true
    for i in 1..<lst.count {
        if lst[i] < lst[i-1] {
            sorted = false
            break
        }
    }
    return sorted
}
```swift
// Given an array of numbers, return whether or not they are sorted
// in ascending order. If array has more than 1 duplicate of the same
// number, return false. Assume no negative numbers and only integers.
// Examples
// isSorted(lst: [5]) == true
// isSorted(lst: [1, 2, 3, 4, 5]) == true
// isSorted(lst: [1, 3, 2, 4, 5]) == false
// isSorted(lst: [1, 2, 3, 4, 5, 6]) == true
// isSorted(lst: [1, 2, 3, 4, 5, 6, 7]) == true
// isSorted(lst: [1, 3, 2, 4, 5, 6, 7]) == false
// isSorted(lst: [1, 2, 2, 3, 3, 4]) == true
// isSorted(lst: [1, 2, 2, 2, 3, 4]) == false
func isSorted(lst: [Int]) -> Bool {
    guard lst.count > 1 else { return true }
    var sorted = true
    for i in 1..<lst.count {
        if lst[i] < lst[i-1] {
            sorted = false
            break
        }
    }
    return sorted
}
```
 // XCTAssertTrue failed

func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 0..<lst.count-1 {
        if lst[i] > lst[i+1] {
            sorted = false
            break
        }
    }
    return sorted
}
```swift
// Given an array of numbers, return whether or not they are sorted
// in ascending order. If array has more than 1 duplicate of the same
// number, return false. Assume no negative numbers and only integers.
// Examples
// isSorted(lst: [5]) == true
// isSorted(lst: [1, 2, 3, 4, 5]) == true
// isSorted(lst: [1, 3, 2, 4, 5]) == false
// isSorted(lst: [1, 2, 3, 4, 5, 6]) == true
// isSorted(lst: [1, 2, 3, 4, 5, 6, 7]) == true
// isSorted(lst: [1, 3, 2, 4, 5, 6, 7]) == false
// isSorted(lst: [1, 2, 2, 3, 3, 4]) == true
// isSorted(lst: [1, 2, 2, 2, 3, 4]) == false
func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 0..<lst.count-1 {
        if lst[i] > lst[i+1] {
            sorted = false
            break
        }
    }
    return sorted
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func isSorted(lst: [Int]) -> Bool {
    guard lst.count > 1 else { return true }
    var sorted = true
    for i in 0..<lst.count-1 {
        if lst[i] > lst[i+1] {
            sorted = false
            break
        }
    }
    return sorted
}
```swift
// Given an array of numbers, return whether or not they are sorted
// in ascending order. If array has more than 1 duplicate of the same
// number, return false. Assume no negative numbers and only integers.
// Examples
// isSorted(lst: [5]) == true
// isSorted(lst: [1, 2, 3, 4, 5]) == true
// isSorted(lst: [1, 3, 2, 4, 5]) == false
// isSorted(lst: [1, 2, 3, 4, 5, 6]) == true
// isSorted(lst: [1, 2, 3, 4, 5, 6, 7]) == true
// isSorted(lst: [1, 3, 2, 4, 5, 6, 7]) == false
// isSorted(lst: [1, 2, 2, 3, 3, 4]) == true
// isSorted(lst: [1, 2, 2, 2, 3, 4]) == false
func isSorted(lst: [Int]) -> Bool {
    guard lst.count > 1 else { return true }
    var sorted = true
    for i in 0..<lst.count-1 {
        if lst[i] > lst[i+1] {
            sorted = false
            break
        }
    }
    return sorted
}
```
 // XCTAssertTrue failed

func isSorted(lst: [Int]) -> Bool {
    guard lst.count > 1 else { return true }
    var sorted = true
    for i in 1..<lst.count {
        if lst[i] < lst[i - 1] {
            sorted = false
            break
        }
    }
    return sorted
}
```swift
// Given an array of numbers, return whether or not they are sorted
// in ascending order. If array has more than 1 duplicate of the same
// number, return false. Assume no negative numbers and only integers.
// Examples
// isSorted(lst: [5]) == true
// isSorted(lst: [1, 2, 3, 4, 5]) == true
// isSorted(lst: [1, 3, 2, 4, 5]) == false
// isSorted(lst: [1, 2, 3, 4, 5, 6]) == true
// isSorted(lst: [1, 2, 3, 4, 5, 6, 7]) == true
// isSorted(lst: [1, 3, 2, 4, 5, 6, 7]) == false
// isSorted(lst: [1, 2, 2, 3, 3, 4]) == true
// isSorted(lst: [1, 2, 2, 2, 3, 4]) == false
func isSorted(lst: [Int]) -> Bool {
    guard lst.count > 1 else { return true }
    var sorted = true
    for i in 1..<lst.count {
        if lst[i] < lst[i - 1] {
            sorted = false
            break
        }
    }
    return sorted
}
```
 // XCTAssertTrue failed

func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    var previous = lst[0]
    for i in 1..<lst.count {
        if lst[i] < previous {
            sorted = false
            break
        }
        previous = lst[i]
    }
    return sorted
}
```swift
// Given an array of numbers, return whether or not they are sorted
// in ascending order. If array has more than 1 duplicate of the same
// number, return false. Assume no negative numbers and only integers.
// Examples
// isSorted(lst: [5]) == true
// isSorted(lst: [1, 2, 3, 4, 5]) == true
// isSorted(lst: [1, 3, 2, 4, 5]) == false
// isSorted(lst: [1, 2, 3, 4, 5, 6]) == true
// isSorted(lst: [1, 2, 3, 4, 5, 6, 7]) == true
// isSorted(lst: [1, 3, 2, 4, 5, 6, 7]) == false
// isSorted(lst: [1, 2, 2, 3, 3, 4]) == true
// isSorted(lst: [1, 2, 2, 2, 3, 4]) == false
func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    var previous = lst[0]
    for i in 1..<lst.count {
        if lst[i] < previous {
            sorted = false
            break
        }
        previous = lst[i]
    }
    return sorted
}
```
 // Fatal error: Index out of range

func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 0..<lst.count - 1 {
        if lst[i] > lst[i + 1] {
            sorted = false
            break
        }
    }
    return sorted
}
```swift
// Given an array of numbers, return whether or not they are sorted
// in ascending order. If array has more than 1 duplicate of the same
// number, return false. Assume no negative numbers and only integers.
// Examples
// isSorted(lst: [5]) == true
// isSorted(lst: [1, 2, 3, 4, 5]) == true
// isSorted(lst: [1, 3, 2, 4, 5]) == false
// isSorted(lst: [1, 2, 3, 4, 5, 6]) == true
// isSorted(lst: [1, 2, 3, 4, 5, 6, 7]) == true
// isSorted(lst: [1, 3, 2, 4, 5, 6, 7]) == false
// isSorted(lst: [1, 2, 2, 3, 3, 4]) == true
// isSorted(lst: [1, 2, 2, 2, 3, 4]) == false
func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 0..<lst.count - 1 {
        if lst[i] > lst[i + 1] {
            sorted = false
            break
        }
    }
    return sorted
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 0..<lst.count-1 {
        if lst[i] > lst[i+1] {
            sorted = false
            break
        }
    }
    return sorted
}
```swift
// Given an array of numbers, return whether or not they are sorted
// in ascending order. If array has more than 1 duplicate of the same
// number, return false. Assume no negative numbers and only integers.
// Examples
// isSorted(lst: [5]) == true
// isSorted(lst: [1, 2, 3, 4, 5]) == true
// isSorted(lst: [1, 3, 2, 4, 5]) == false
// isSorted(lst: [1, 2, 3, 4, 5, 6]) == true
// isSorted(lst: [1, 2, 3, 4, 5, 6, 7]) == true
// isSorted(lst: [1, 3, 2, 4, 5, 6, 7]) == false
// isSorted(lst: [1, 2, 2, 3, 3, 4]) == true
// isSorted(lst: [1, 2, 2, 2, 3, 4]) == false
func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 0..<lst.count-1 {
        if lst[i] > lst[i+1] {
            sorted = false
            break
        }
    }
    return sorted
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    guard interval1.0 <= interval2.1 && interval1.1 >= interval2.0 else {
        return "NO"
    }
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    let length = end - start + 1
    return length.isPrime ? "YES" : "NO"
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    guard interval1.0 <= interval2.1 && interval1.1 >= interval2.0 else {
        return "NO"
    }
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    let length = end - start + 1
    return length.isPrime ? "YES" : "NO"
}
```
return length.isPrime ? "YES" : "NO" // value of type 'Int' has no member 'isPrime'

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // Write your code here
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // Write your code here
}
```
} // missing return in global function expected to return 'String'

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // Write your code here
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // Write your code here
}
```
} // missing return in global function expected to return 'String'

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // Write your code here
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // Write your code here
}
```
} // missing return in global function expected to return 'String'

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    guard interval1.0 <= interval2.1 && interval2.0 <= interval1.1 else { return "NO" }
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    return isPrime(number: end - start + 1) ? "YES" : "NO"
}

func isPrime(_ number: Int) -> Bool {
    guard number > 1 else { return false }
    for i in 2...Int(sqrt(Double(number))) {
        if number % i == 0 { return false }
    }
    return true
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    guard interval1.0 <= interval2.1 && interval2.0 <= interval1.1 else { return "NO" }
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    return isPrime(number: end - start + 1) ? "YES" : "NO"
}

func isPrime(_ number: Int) -> Bool {
    guard number > 1 else { return false }
    for i in 2...Int(sqrt(Double(number))) {
        if number % i == 0 { return false }
    }
    return true
}
```
return isPrime(number: end - start + 1) ? "YES" : "NO" // extraneous argument label 'number:' in call

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    guard interval1.0 <= interval2.1 && interval1.1 >= interval2.0 else { return "NO" }
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    return isPrime(number: end - start + 1) ? "YES" : "NO"
}

func isPrime(number: Int) -> Bool {
    guard number > 1 else { return false }
    for i in 2...Int(sqrt(Double(number))) {
        if number % i == 0 { return false }
    }
    return true
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    guard interval1.0 <= interval2.1 && interval1.1 >= interval2.0 else { return "NO" }
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    return isPrime(number: end - start + 1) ? "YES" : "NO"
}

func isPrime(number: Int) -> Bool {
    guard number > 1 else { return false }
    for i in 2...Int(sqrt(Double(number))) {
        if number % i == 0 { return false }
    }
    return true
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    if start > end {
        return "NO"
    }
    let length = end - start + 1
    if length <= 1 {
        return "NO"
    }
    if length == 2 {
        return "YES"
    }
    let isPrime = length > 2 && length % 2 != 0 && length % 3 != 0
    return isPrime ? "YES" : "NO"
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    if start > end {
        return "NO"
    }
    let length = end - start + 1
    if length <= 1 {
        return "NO"
    }
    if length == 2 {
        return "YES"
    }
    let isPrime = length > 2 && length % 2 != 0 && length % 3 != 0
    return isPrime ? "YES" : "NO"
}
```
 // XCTAssertTrue failed

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // Write your code here
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    if start > end {
        return "NO"
    }
    let length = end - start + 1
    if length == 1 {
        return "NO"
    }
    if length > 1 && length % 2 == 0 {
        return "NO"
    }
    if length > 1 && length % 3 == 0 {
        return "NO"
    }
    if length > 1 && length % 5 == 0 {
        return "NO"
    }
    return "YES"
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // Write your code here
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    if start > end {
        return "NO"
    }
    let length = end - start + 1
    if length == 1 {
        return "NO"
    }
    if length > 1 && length % 2 == 0 {
        return "NO"
    }
    if length > 1 && length % 3 == 0 {
        return "NO"
    }
    if length > 1 && length % 5 == 0 {
        return "NO"
    }
    return "YES"
}
```
 // XCTAssertTrue failed

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    if start > end {
        return "NO"
    }
    let length = end - start + 1
    if length <= 1 {
        return "NO"
    }
    if length == 2 {
        return "YES"
    }
    var prime = true
    for i in 2...Int(sqrt(Double(length))) {
        if length % i == 0 {
            prime = false
            break
        }
    }
    return prime ? "YES" : "NO"
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    if start > end {
        return "NO"
    }
    let length = end - start + 1
    if length <= 1 {
        return "NO"
    }
    if length == 2 {
        return "YES"
    }
    var prime = true
    for i in 2...Int(sqrt(Double(length))) {
        if length % i == 0 {
            prime = false
            break
        }
    }
    return prime ? "YES" : "NO"
}
```
 // XCTAssertTrue failed

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    if interval1.0 > interval2.1 || interval2.0 > interval1.1 {
        return "NO"
    }
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    if start > end {
        return "NO"
    }
    return isPrime(number: end - start + 1) ? "YES" : "NO"
}

func isPrime(number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    if number == 2 {
        return true
    }
    if number % 2 == 0 {
        return false
    }
    var i = 3
    while i * i <= number {
        if number % i == 0 {
            return false
        }
        i += 2
    }
    return true
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    if interval1.0 > interval2.1 || interval2.0 > interval1.1 {
        return "NO"
    }
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    if start > end {
        return "NO"
    }
    return isPrime(number: end - start + 1) ? "YES" : "NO"
}

func isPrime(number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    if number == 2 {
        return true
    }
    if number % 2 == 0 {
        return false
    }
    var i = 3
    while i * i <= number {
        if number % i == 0 {
            return false
        }
        i += 2
    }
    return true
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        if num == 0 {
            result = 0
            break
        }
        result *= num > 0 ? 1 : -1
    }
    return result * arr.reduce(1, *)
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        if num == 0 {
            result = 0
            break
        }
        result *= num > 0 ? 1 : -1
    }
    return result * arr.reduce(1, *)
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for number in arr {
        result *= number > 0 ? 1 : -1
    }
    return result * arr.reduce(1, *)
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for number in arr {
        result *= number > 0 ? 1 : -1
    }
    return result * arr.reduce(1, *)
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        if num == 0 {
            result = 0
            break
        }
        result *= num > 0 ? 1 : -1
    }
    return result * arr.reduce(1, *)
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        if num == 0 {
            result = 0
            break
        }
        result *= num > 0 ? 1 : -1
    }
    return result * arr.reduce(1, *)
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for number in arr {
        result *= number > 0 ? 1 : -1
    }
    return arr.reduce(0, { $0 + abs($1 * result) })
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for number in arr {
        result *= number > 0 ? 1 : -1
    }
    return arr.reduce(0, { $0 + abs($1 * result) })
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        if num == 0 {
            result = 0
            break
        }
        result *= num > 0 ? 1 : -1
    }
    return result
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        if num == 0 {
            result = 0
            break
        }
        result *= num > 0 ? 1 : -1
    }
    return result
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num > 0 ? 1 : -1
    }
    return result * arr.reduce(1, *)
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num > 0 ? 1 : -1
    }
    return result * arr.reduce(1, *)
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var sum = 0
    for num in arr {
        if num == 0 {
            sum += 0
        } else if num > 0 {
            sum += 1
        } else {
            sum += -1
        }
    }
    return sum
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var sum = 0
    for num in arr {
        if num == 0 {
            sum += 0
        } else if num > 0 {
            sum += 1
        } else {
            sum += -1
        }
    }
    return sum
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var sum = 0
    for num in arr {
        if num == 0 {
            sum += 0
        } else if num > 0 {
            sum += 1
        } else {
            sum -= 1
        }
    }
    return sum
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var sum = 0
    for num in arr {
        if num == 0 {
            sum += 0
        } else if num > 0 {
            sum += 1
        } else {
            sum -= 1
        }
    }
    return sum
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        if num == 0 {
            result = 0
            break
        }
        result *= num > 0 ? 1 : -1
    }
    return result
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        if num == 0 {
            result = 0
            break
        }
        result *= num > 0 ? 1 : -1
    }
    return result
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for number in arr {
        if number == 0 {
            result = 0
            break
        }
        result *= number > 0 ? 1 : -1
    }
    return result
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard !arr.isEmpty else { return nil }
    var result = 1
    for number in arr {
        if number == 0 {
            result = 0
            break
        }
        result *= number > 0 ? 1 : -1
    }
    return result
}
```
 // XCTAssertTrue failed

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    let m = grid[0].count
    var dp = Array(repeating: Array(repeating: 0, count: k + 1), count: n)
    var ans = Array(repeating: 0, count: k)
    for i in 0..<n {
        for j in 0..<m {
            dp[i][0] = grid[i][j]
        }
    }
    for i in 0..<n {
        for j in 0..<m {
            for k in 1..<dp[i][0] {
                dp[i][k] = min(dp[i][k], dp[i][k - 1] + grid[i][j])
            }
            for k in 1..<dp[0][j] {
                dp[0][k] = min(dp[0][k], dp[0][k - 1] + grid[i][j])
            }
        }
    }
    var min = dp[n - 1][k - 1]
    for i in 0..<n {
        for j in 0..<m {
            if dp[i][k - 1] + dp[0][j] == min {
                ans[0] = grid[i][j]
                min = dp[i][k - 1]
                break
            }
        }
    }
    for i in 0..<n {
        for j in 0..<m {
            if dp[i][k - 1] + dp[0][j] < min {
                ans[0] = grid[i][j]
                min = dp[i][k - 1] + dp[0][j]
            }
        }
    }
    for i in 1..<k {
        for j in 0..<m {
            for k in 1..<dp[n - 1][j] {
                dp[n - 1][k] = min(dp[n - 1][k], dp[n - 1][k - 1] + grid[n - 1][j])
            }
            for k in 1..<dp[i][j] {
                dp[i][k] = min(dp[i][k], dp[i][k - 1] + grid[i][j])
            }
        }
    }
    for i in 1..<k {
        for j in 0..<m {
            if dp[n - 1][k - 1] + dp[i][j] < min {
                ans[i] = grid[n - 1][j]
                min = dp[n - 1][k - 1] + dp[i][j]
            }
        }
    }
    return ans
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    let m = grid[0].count
    var dp = Array(repeating: Array(repeating: 0, count: k + 1), count: n)
    var ans = Array(repeating: 0, count: k)
    for i in 0..<n {
        for j in 0..<m {
            dp[i][0] = grid[i][j]
        }
    }
    for i in 0..<n {
        for j in 0..<m {
            for k in 1..<dp[i][0] {
                dp[i][k] = min(dp[i][k], dp[i][k - 1] + grid[i][j])
            }
            for k in 1..<dp[0][j] {
                dp[0][k] = min(dp[0][k], dp[0][k - 1] + grid[i][j])
            }
        }
    }
    var min = dp[n - 1][k - 1]
    for i in 0..<n {
        for j in 0..<m {
            if dp[i][k - 1] + dp[0][j] == min {
                ans[0] = grid[i][j]
                min = dp[i][k - 1]
                break
            }
        }
    }
    for i in 0..<n {
        for j in 0..<m {
            if dp[i][k - 1] + dp[0][j] < min {
                ans[0] = grid[i][j]
                min = dp[i][k - 1] + dp[0][j]
            }
        }
    }
    for i in 1..<k {
        for j in 0..<m {
            for k in 1..<dp[n - 1][j] {
                dp[n - 1][k] = min(dp[n - 1][k], dp[n - 1][k - 1] + grid[n - 1][j])
            }
            for k in 1..<dp[i][j] {
                dp[i][k] = min(dp[i][k], dp[i][k - 1] + grid[i][j])
            }
        }
    }
    for i in 1..<k {
        for j in 0..<m {
            if dp[n - 1][k - 1] + dp[i][j] < min {
                ans[i] = grid[n - 1][j]
                min = dp[n - 1][k - 1] + dp[i][j]
            }
        }
    }
    return ans
}
```
dp[n - 1][k] = min(dp[n - 1][k], dp[n - 1][k - 1] + grid[n - 1][j]) // cannot call value of non-function type 'Int'
dp[i][k] = min(dp[i][k], dp[i][k - 1] + grid[i][j]) // cannot call value of non-function type 'Int'

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    let m = grid[0].count
    var dp = Array(repeating: Array(repeating: 0, count: k + 1), count: n)
    for i in 0..<n {
        for j in 0..<m {
            dp[i][0] = grid[i][j]
        }
    }
    for i in 1...k {
        for j in 0..<n {
            for k in 0..<m {
                dp[j][i] = grid[j][k] + min(dp[j][i - 1], dp[j - 1][i - 1], dp[j + 1][i - 1], dp[j - 1][i], dp[j + 1][i])
            }
        }
    }
    return dp[0][k]
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    let m = grid[0].count
    var dp = Array(repeating: Array(repeating: 0, count: k + 1), count: n)
    for i in 0..<n {
        for j in 0..<m {
            dp[i][0] = grid[i][j]
        }
    }
    for i in 1...k {
        for j in 0..<n {
            for k in 0..<m {
                dp[j][i] = grid[j][k] + min(dp[j][i - 1], dp[j - 1][i - 1], dp[j + 1][i - 1], dp[j - 1][i], dp[j + 1][i])
            }
        }
    }
    return dp[0][k]
}
```
return dp[0][k] // cannot convert return expression of type 'Int' to return type '[Int]'

func minPath(grid: [[Int]], k: Int) -> [Int] {
    var grid = grid
    var path = [Int]()
    var visited = Set<Int>()
    var current = 1
    var count = 0
    
    while count < k {
        path.append(current)
        visited.insert(current)
        count += 1
        if count == k {
            return path
        }
        current = next(grid: grid, current: current, visited: visited)
    }
    
    return path
}

func next(grid: [[Int]], current: Int, visited: Set<Int>) -> Int {
    var next = 0
    var min = Int.max
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            if grid[i][j] == current && !visited.contains(grid[i][j]) {
                if grid[i][j] < min {
                    min = grid[i][j]
                    next = grid[i][j]
                }
            }
        }
    }
    return next
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    var grid = grid
    var path = [Int]()
    var visited = Set<Int>()
    var current = 1
    var count = 0
    
    while count < k {
        path.append(current)
        visited.insert(current)
        count += 1
        if count == k {
            return path
        }
        current = next(grid: grid, current: current, visited: visited)
    }
    
    return path
}

func next(grid: [[Int]], current: Int, visited: Set<Int>) -> Int {
    var next = 0
    var min = Int.max
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            if grid[i][j] == current && !visited.contains(grid[i][j]) {
                if grid[i][j] < min {
                    min = grid[i][j]
                    next = grid[i][j]
                }
            }
        }
    }
    return next
}
```
var grid = grid // variable 'grid' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var dp = Array(repeating: Array(repeating: 0, count: k + 1), count: n)
    for i in 0..<n {
        for j in 0..<n {
            dp[i][j] = grid[i][j]
        }
    }
    for i in 1..<n {
        for j in 0..<n {
            for k in 1..<n {
                dp[i][j] = min(dp[i][j], dp[i - 1][j] + grid[i][j])
            }
        }
    }
    for i in 0..<n {
        for j in 0..<n {
            for k in 1..<n {
                dp[i][j] = min(dp[i][j], dp[i][j - 1] + grid[i][j])
            }
        }
    }
    var ans = [Int]()
    var i = n - 1, j = n - 1
    for _ in 0..<k {
        ans.append(dp[i][j])
        if i == 0 {
            j -= 1
        } else if j == 0 {
            i -= 1
        } else {
            i -= 1
            j -= 1
        }
    }
    return ans
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var dp = Array(repeating: Array(repeating: 0, count: k + 1), count: n)
    for i in 0..<n {
        for j in 0..<n {
            dp[i][j] = grid[i][j]
        }
    }
    for i in 1..<n {
        for j in 0..<n {
            for k in 1..<n {
                dp[i][j] = min(dp[i][j], dp[i - 1][j] + grid[i][j])
            }
        }
    }
    for i in 0..<n {
        for j in 0..<n {
            for k in 1..<n {
                dp[i][j] = min(dp[i][j], dp[i][j - 1] + grid[i][j])
            }
        }
    }
    var ans = [Int]()
    var i = n - 1, j = n - 1
    for _ in 0..<k {
        ans.append(dp[i][j])
        if i == 0 {
            j -= 1
        } else if j == 0 {
            i -= 1
        } else {
            i -= 1
            j -= 1
        }
    }
    return ans
}
```
for k in 1..<n { // immutable value 'k' was never used; consider replacing with '_' or removing it
for k in 1..<n { // immutable value 'k' was never used; consider replacing with '_' or removing it
 // Fatal error: Index out of range

func minPath(grid: [[Int]], k: Int) -> [Int] {
    guard grid.count > 1 else { return [] }
    guard grid[0].count > 1 else { return [] }
    guard k > 0 else { return [] }
    guard k <= grid.count * grid[0].count else { return [] }
    
    let n = grid.count
    let m = grid[0].count
    
    var minPath = [Int]()
    var visited = Array(repeating: Array(repeating: false, count: n), count: n)
    var queue = [(Int, Int, Int)]()
    
    queue.append((0, 0, 0))
    visited[0][0] = true
    
    while !queue.isEmpty {
        let (i, j, k) = queue.removeFirst()
        
        if k == k {
            minPath.append(grid[i][j])
            continue
        }
        
        if i + 1 < n && !visited[i + 1][j] {
            visited[i + 1][j] = true
            queue.append((i + 1, j, k + 1))
        }
        
        if j + 1 < m && !visited[i][j + 1] {
            visited[i][j + 1] = true
            queue.append((i, j + 1, k + 1))
        }
        
        if i - 1 >= 0 && !visited[i - 1][j] {
            visited[i - 1][j] = true
            queue.append((i - 1, j, k + 1))
        }
        
        if j - 1 >= 0 && !visited[i][j - 1] {
            visited[i][j - 1] = true
            queue.append((i, j - 1, k + 1))
        }
    }
    
    return minPath
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    guard grid.count > 1 else { return [] }
    guard grid[0].count > 1 else { return [] }
    guard k > 0 else { return [] }
    guard k <= grid.count * grid[0].count else { return [] }
    
    let n = grid.count
    let m = grid[0].count
    
    var minPath = [Int]()
    var visited = Array(repeating: Array(repeating: false, count: n), count: n)
    var queue = [(Int, Int, Int)]()
    
    queue.append((0, 0, 0))
    visited[0][0] = true
    
    while !queue.isEmpty {
        let (i, j, k) = queue.removeFirst()
        
        if k == k {
            minPath.append(grid[i][j])
            continue
        }
        
        if i + 1 < n && !visited[i + 1][j] {
            visited[i + 1][j] = true
            queue.append((i + 1, j, k + 1))
        }
        
        if j + 1 < m && !visited[i][j + 1] {
            visited[i][j + 1] = true
            queue.append((i, j + 1, k + 1))
        }
        
        if i - 1 >= 0 && !visited[i - 1][j] {
            visited[i - 1][j] = true
            queue.append((i - 1, j, k + 1))
        }
        
        if j - 1 >= 0 && !visited[i][j - 1] {
            visited[i][j - 1] = true
            queue.append((i, j - 1, k + 1))
        }
    }
    
    return minPath
}
```
 // XCTAssertTrue failed

func minPath(grid: [[Int]], k: Int) -> [Int] {
    var grid = grid
    var minPath = [Int]()
    var min = 0
    var max = 0
    for _ in 0..<k {
        min = Int.max
        max = Int.min
        for i in 0..<grid.count {
            for j in 0..<grid[i].count {
                if i == 0 && j == 0 {
                    min = grid[i][j]
                } else if i == 0 {
                    min = min < grid[i][j] ? min : grid[i][j]
                } else if j == 0 {
                    min = min < grid[i][j] ? min : grid[i][j]
                } else {
                    min = min < grid[i][j] ? min : grid[i][j]
                    max = max > grid[i][j] ? max : grid[i][j]
                }
            }
        }
        minPath.append(min)
        if minPath.count == k {
            break
        }
        for i in 0..<grid.count {
            for j in 0..<grid[i].count {
                if i == 0 && j == 0 {
                    grid[i][j] = min
                } else if i == 0 {
                    grid[i][j] = min < grid[i][j] ? min : grid[i][j]
                } else if j == 0 {
                    grid[i][j] = min < grid[i][j] ? min : grid[i][j]
                } else {
                    grid[i][j] = min < grid[i][j] ? min : grid[i][j]
                    grid[i][j] = max > grid[i][j] ? max : grid[i][j]
                }
            }
        }
    }
    return minPath
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    var grid = grid
    var minPath = [Int]()
    var min = 0
    var max = 0
    for _ in 0..<k {
        min = Int.max
        max = Int.min
        for i in 0..<grid.count {
            for j in 0..<grid[i].count {
                if i == 0 && j == 0 {
                    min = grid[i][j]
                } else if i == 0 {
                    min = min < grid[i][j] ? min : grid[i][j]
                } else if j == 0 {
                    min = min < grid[i][j] ? min : grid[i][j]
                } else {
                    min = min < grid[i][j] ? min : grid[i][j]
                    max = max > grid[i][j] ? max : grid[i][j]
                }
            }
        }
        minPath.append(min)
        if minPath.count == k {
            break
        }
        for i in 0..<grid.count {
            for j in 0..<grid[i].count {
                if i == 0 && j == 0 {
                    grid[i][j] = min
                } else if i == 0 {
                    grid[i][j] = min < grid[i][j] ? min : grid[i][j]
                } else if j == 0 {
                    grid[i][j] = min < grid[i][j] ? min : grid[i][j]
                } else {
                    grid[i][j] = min < grid[i][j] ? min : grid[i][j]
                    grid[i][j] = max > grid[i][j] ? max : grid[i][j]
                }
            }
        }
    }
    return minPath
}
```
 // XCTAssertTrue failed

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var dp = [[Int]]()
    for _ in 0..<k {
        dp.append([Int](repeating: 0, count: n))
    }
    for i in 0..<n {
        for j in 0..<n {
            dp[0][i] = grid[i][j]
        }
    }
    for step in 1..<k {
        for i in 0..<n {
            for j in 0..<n {
                var min = Int.max
                if i > 0 {
                    min = min < dp[step - 1][i - 1] ? min : dp[step - 1][i - 1]
                }
                if j > 0 {
                    min = min < dp[step - 1][j - 1] ? min : dp[step - 1][j - 1]
                }
                if i < n - 1 {
                    min = min < dp[step - 1][i + 1] ? min : dp[step - 1][i + 1]
                }
                if j < n - 1 {
                    min = min < dp[step - 1][j + 1] ? min : dp[step - 1][j + 1]
                }
                dp[step][i] = grid[i][j] + min
            }
        }
    }
    return dp[k - 1]
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var dp = [[Int]]()
    for _ in 0..<k {
        dp.append([Int](repeating: 0, count: n))
    }
    for i in 0..<n {
        for j in 0..<n {
            dp[0][i] = grid[i][j]
        }
    }
    for step in 1..<k {
        for i in 0..<n {
            for j in 0..<n {
                var min = Int.max
                if i > 0 {
                    min = min < dp[step - 1][i - 1] ? min : dp[step - 1][i - 1]
                }
                if j > 0 {
                    min = min < dp[step - 1][j - 1] ? min : dp[step - 1][j - 1]
                }
                if i < n - 1 {
                    min = min < dp[step - 1][i + 1] ? min : dp[step - 1][i + 1]
                }
                if j < n - 1 {
                    min = min < dp[step - 1][j + 1] ? min : dp[step - 1][j + 1]
                }
                dp[step][i] = grid[i][j] + min
            }
        }
    }
    return dp[k - 1]
}
```
 // XCTAssertTrue failed

func minPath(grid: [[Int]], k: Int) -> [Int] {
    guard grid.count > 1, grid[0].count > 1, k > 0 else { return [] }
    let n = grid.count
    let m = grid[0].count
    var dp = Array(repeating: Array(repeating: 0, count: k + 1), count: n)
    var path = Array(repeating: 0, count: k)
    for i in 0..<n {
        for j in 0..<m {
            dp[i][0] = grid[i][j]
        }
    }
    for i in 1..<k {
        for j in 0..<n {
            for k in 0..<m {
                dp[j][i] = grid[j][k] + min(dp[j][i - 1], dp[j - 1][i - 1], dp[j + 1][i - 1], dp[j][i - 1])
            }
        }
    }
    var min = dp[0][k - 1]
    for i in 0..<n {
        for j in 0..<m {
            if dp[i][k - 1] < min {
                min = dp[i][k - 1]
                path = [grid[i][j]]
            } else if dp[i][k - 1] == min {
                path.append(grid[i][j])
            }
        }
    }
    return path
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    guard grid.count > 1, grid[0].count > 1, k > 0 else { return [] }
    let n = grid.count
    let m = grid[0].count
    var dp = Array(repeating: Array(repeating: 0, count: k + 1), count: n)
    var path = Array(repeating: 0, count: k)
    for i in 0..<n {
        for j in 0..<m {
            dp[i][0] = grid[i][j]
        }
    }
    for i in 1..<k {
        for j in 0..<n {
            for k in 0..<m {
                dp[j][i] = grid[j][k] + min(dp[j][i - 1], dp[j - 1][i - 1], dp[j + 1][i - 1], dp[j][i - 1])
            }
        }
    }
    var min = dp[0][k - 1]
    for i in 0..<n {
        for j in 0..<m {
            if dp[i][k - 1] < min {
                min = dp[i][k - 1]
                path = [grid[i][j]]
            } else if dp[i][k - 1] == min {
                path.append(grid[i][j])
            }
        }
    }
    return path
}
```
 // Fatal error: Index out of range

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    let m = grid[0].count
    var dp = Array(repeating: Array(repeating: 0, count: k + 1), count: n)
    var dp2 = Array(repeating: Array(repeating: 0, count: k + 1), count: n)
    for i in 0..<n {
        for j in 0..<m {
            dp[i][0] = grid[i][j]
            dp2[i][0] = grid[i][j]
        }
    }
    for i in 1..<k {
        for j in 0..<n {
            dp[j][i] = dp[j][i - 1] + grid[j][j]
            dp2[j][i] = dp2[j][i - 1] + grid[j][n - 1 - j]
        }
    }
    var ans = [Int]()
    var min = Int.max
    for i in 0..<n {
        for j in 0..<k {
            let cur = dp[i][j] + dp2[n - 1 - i][k - 1 - j]
            if cur < min {
                min = cur
                ans = [grid[i][i], grid[i][n - 1 - i], grid[n - 1 - i][i]]
            }
        }
    }
    return ans
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    let m = grid[0].count
    var dp = Array(repeating: Array(repeating: 0, count: k + 1), count: n)
    var dp2 = Array(repeating: Array(repeating: 0, count: k + 1), count: n)
    for i in 0..<n {
        for j in 0..<m {
            dp[i][0] = grid[i][j]
            dp2[i][0] = grid[i][j]
        }
    }
    for i in 1..<k {
        for j in 0..<n {
            dp[j][i] = dp[j][i - 1] + grid[j][j]
            dp2[j][i] = dp2[j][i - 1] + grid[j][n - 1 - j]
        }
    }
    var ans = [Int]()
    var min = Int.max
    for i in 0..<n {
        for j in 0..<k {
            let cur = dp[i][j] + dp2[n - 1 - i][k - 1 - j]
            if cur < min {
                min = cur
                ans = [grid[i][i], grid[i][n - 1 - i], grid[n - 1 - i][i]]
            }
        }
    }
    return ans
}
```
 // XCTAssertTrue failed

```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    var grid = grid
    var minPath = [Int]()
    var minPathIndex = 0
    var minPathValue = 0
    var minPathCount = 0
    var minPathCountIndex = 0
    var minPathCountValue = 0
    var minPathCountCount = 0
    var minPathCountCountIndex = 0
    var minPathCountCountValue = 0
    var minPathCountCountCount = 0
    var minPathCountCountCountIndex = 0
    var minPathCountCountCountValue = 0
    var minPathCountCountCountCount = 0
    var minPathCountCountCountCountIndex = 0
    var minPathCountCountCountCountValue = 0
    var minPathCountCountCountCountCount = 0
    var minPathCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountValue = 0
    var minPathCountCountCountCountCountCount = 0
    var minPathCountCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountCountValue = 0
    var minPathCountCountCountCountCountCountCount = 0
    var minPathCountCountCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountCountCountValue = 0
    var minPathCountCountCountCountCountCountCountCount = 0
    var minPathCountCountCountCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountCountCountCountValue = 0
    var minPathCountCountCountCountCountCountCountCountCount = 0
    var minPathCountCountCountCountCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountCountCountCountCountValue = 0
    var minPathCountCountCountCountCountCountCountCountCountCount = 0
    var minPathCountCountCountCountCountCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountCountCountCountCountCountValue = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCount = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountValue = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountValue = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountValue = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountValue = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountValue = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountValue = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountValue = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCount = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountIndex = 0
    var minPathCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountCountValue = 0
    var minPathCountCountCountCount

func tri(n: Int) -> [Int] {
    var result = [1, 3, 2]
    for _ in 3...n {
        result.append(result.last! + result[result.count - 2] + result[result.count - 3])
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    var result = [1, 3, 2]
    for _ in 3...n {
        result.append(result.last! + result[result.count - 2] + result[result.count - 3])
    }
    return result
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    guard n > 0 else { return [1] }
    guard n > 1 else { return [1, 3] }
    guard n > 2 else { return [1, 3, 2] }
    var result = [1, 3, 2]
    for i in 3..<n {
        result.append(result[i - 1] + result[i - 2] + result[i - 3])
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    guard n > 0 else { return [1] }
    guard n > 1 else { return [1, 3] }
    guard n > 2 else { return [1, 3, 2] }
    var result = [1, 3, 2]
    for i in 3..<n {
        result.append(result[i - 1] + result[i - 2] + result[i - 3])
    }
    return result
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    guard n > 0 else { return [1] }
    guard n > 1 else { return [1, 3] }
    guard n > 2 else { return [1, 3, 2] }
    
    var result = [1, 3, 2]
    var i = 3
    while i <= n {
        result.append(result[i - 1] + result[i - 2] + result[i - 3])
        i += 1
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    guard n > 0 else { return [1] }
    guard n > 1 else { return [1, 3] }
    guard n > 2 else { return [1, 3, 2] }
    
    var result = [1, 3, 2]
    var i = 3
    while i <= n {
        result.append(result[i - 1] + result[i - 2] + result[i - 3])
        i += 1
    }
    return result
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    var result = [1, 3, 2]
    for _ in 3..<n {
        result.append(result[result.count - 1] + result[result.count - 2] + result[result.count - 3])
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    var result = [1, 3, 2]
    for _ in 3..<n {
        result.append(result[result.count - 1] + result[result.count - 2] + result[result.count - 3])
    }
    return result
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    var result = [1, 3, 2]
    var i = 3
    while i <= n {
        result.append(result[i - 1] + result[i - 2] + result[i - 3])
        i += 1
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    var result = [1, 3, 2]
    var i = 3
    while i <= n {
        result.append(result[i - 1] + result[i - 2] + result[i - 3])
        i += 1
    }
    return result
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    var result = [1, 3]
    for i in 2...n {
        result.append(result[i - 1] + result[i - 2] + result[i - 3])
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    var result = [1, 3]
    for i in 2...n {
        result.append(result[i - 1] + result[i - 2] + result[i - 3])
    }
    return result
}
```
 // Fatal error: Index out of range

func tri(n: Int) -> [Int] {
    guard n > 0 else { return [1] }
    var result = [1, 3]
    for _ in 2..<n {
        result.append(result[result.count - 1] + result[result.count - 2] + result[result.count - 3])
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    guard n > 0 else { return [1] }
    var result = [1, 3]
    for _ in 2..<n {
        result.append(result[result.count - 1] + result[result.count - 2] + result[result.count - 3])
    }
    return result
}
```
 // Fatal error: Index out of range

func tri(n: Int) -> [Int] {
    guard n > 0 else { return [1] }
    var result = [1, 3]
    for _ in 2..<n {
        result.append(result[result.count - 1] + result[result.count - 2] + result[result.count - 3])
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    guard n > 0 else { return [1] }
    var result = [1, 3]
    for _ in 2..<n {
        result.append(result[result.count - 1] + result[result.count - 2] + result[result.count - 3])
    }
    return result
}
```
 // Fatal error: Index out of range

func tri(n: Int) -> [Int] {
    var result = [1, 3]
    var i = 2
    while i <= n {
        result.append(result[i - 1] + result[i - 2] + result[i - 3])
        i += 1
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    var result = [1, 3]
    var i = 2
    while i <= n {
        result.append(result[i - 1] + result[i - 2] + result[i - 3])
        i += 1
    }
    return result
}
```
 // Fatal error: Index out of range

func tri(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    guard n > 1 else { return [1, 3] }
    guard n > 2 else { return [1, 3, 2] }
    var result = [1, 3, 2]
    for _ in 3...n {
        let last = result.last!
        result.append(result[result.count - 2] + result[result.count - 1] + last)
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    guard n > 0 else { return [] }
    guard n > 1 else { return [1, 3] }
    guard n > 2 else { return [1, 3, 2] }
    var result = [1, 3, 2]
    for _ in 3...n {
        let last = result.last!
        result.append(result[result.count - 2] + result[result.count - 1] + last)
    }
    return result
}
```
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var result = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            result *= digit
        }
        number /= 10
    }
    return result
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var result = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            result *= digit
        }
        number /= 10
    }
    return result
}
```
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var result = 1
    var n = n
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 1 {
            result *= digit
        }
        n /= 10
    }
    return result
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var result = 1
    var n = n
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 1 {
            result *= digit
        }
        n /= 10
    }
    return result
}
```
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var result = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            result *= digit
        }
        number /= 10
    }
    return result
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var result = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            result *= digit
        }
        number /= 10
    }
    return result
}
```
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var result = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            result *= digit
        }
        number /= 10
    }
    return result
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var result = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            result *= digit
        }
        number /= 10
    }
    return result
}
```
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var result = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            result *= digit
        }
        number /= 10
    }
    return result
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var result = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            result *= digit
        }
        number /= 10
    }
    return result
}
```
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var result = 1
    var n = n
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 1 {
            result *= digit
        }
        n /= 10
    }
    return result
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var result = 1
    var n = n
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 1 {
            result *= digit
        }
        n /= 10
    }
    return result
}
```
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var result = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            result *= digit
        }
        number /= 10
    }
    return result
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var result = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            result *= digit
        }
        number /= 10
    }
    return result
}
```
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var product = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            product *= digit
        }
        number /= 10
    }
    return product
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var product = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            product *= digit
        }
        number /= 10
    }
    return product
}
```
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var product = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            product *= digit
        }
        number /= 10
    }
    return product
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var product = 1
    var number = n
    while number > 0 {
        let digit = number % 10
        if digit % 2 == 1 {
            product *= digit
        }
        number /= 10
    }
    return product
}
```
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var product = 1
    var n = n
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 1 {
            product *= digit
        }
        n /= 10
    }
    return product
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var product = 1
    var n = n
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 1 {
            product *= digit
        }
        n /= 10
    }
    return product
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    // Write your code here
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    // Write your code here
}
```
} // missing return in global function expected to return 'Bool'

func isNested(string: String) -> Bool {
    // Write your code here
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    // Write your code here
}
```
} // missing return in global function expected to return 'Bool'

func isNested(string: String) -> Bool {
    // TODO: Write your code here
    return false
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    // TODO: Write your code here
    return false
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    // Your code goes here
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func isNested(string: String) -> Bool {
    // TODO: Write your code here
    return false
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    // TODO: Write your code here
    return false
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    // Write your code here
    return false
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    // Write your code here
    return false
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    var stack = [Character]()
    var result = false
    
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                result = false
                break
            } else {
                stack.removeLast()
            }
        }
    }
    
    if stack.isEmpty {
        result = true
    }
    
    return result
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    var stack = [Character]()
    var result = false
    
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                result = false
                break
            } else {
                stack.removeLast()
            }
        }
    }
    
    if stack.isEmpty {
        result = true
    }
    
    return result
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    // TODO: Write your code here
    return false
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    // TODO: Write your code here
    return false
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    var stack = [Character]()
    var isNested = false
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    var stack = [Character]()
    var isNested = false
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```
var isNested = false // initialization of variable 'isNested' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    var stack = [Character]()
    var isNested = false
    for character in string {
        if character == "[" {
            stack.append(character)
        } else if character == "]" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    var stack = [Character]()
    var isNested = false
    for character in string {
        if character == "[" {
            stack.append(character)
        } else if character == "]" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```
var isNested = false // initialization of variable 'isNested' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for i in lst {
        sum += Int(ceil(pow(i, 2)))
    }
    return sum
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for i in lst {
        sum += Int(ceil(pow(i, 2)))
    }
    return sum
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        sum += Int(ceil(pow(number, 2)))
    }
    return sum
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        sum += Int(ceil(pow(number, 2)))
    }
    return sum
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        sum += Int(ceil(pow(number, 2)))
    }
    return sum
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        sum += Int(ceil(pow(number, 2)))
    }
    return sum
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var result = 0
    for number in lst {
        let roundedNumber = Int(ceil(number))
        result += roundedNumber * roundedNumber
    }
    return result
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    var result = 0
    for number in lst {
        let roundedNumber = Int(ceil(number))
        result += roundedNumber * roundedNumber
    }
    return result
}
```

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil(pow($0, 2))) }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil(pow($0, 2))) }.reduce(0, +)
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for item in lst {
        sum += Int(ceil(pow(item, 2)))
    }
    return sum
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for item in lst {
        sum += Int(ceil(pow(item, 2)))
    }
    return sum
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil(pow($0, 2))) }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil(pow($0, 2))) }.reduce(0, +)
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil(pow($0, 2))) }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil(pow($0, 2))) }.reduce(0, +)
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    let rounded = lst.map { Int(ceil($0)) }
    return rounded.reduce(0, +) * rounded.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    let rounded = lst.map { Int(ceil($0)) }
    return rounded.reduce(0, +) * rounded.reduce(0, +)
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil(pow($0, 2))) }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil(pow($0, 2))) }.reduce(0, +)
}
```
 // XCTAssertTrue failed

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```swift
// Create a function that returns true if the last character
// of a given string is an alphabetical character and is not
// a part of a word, and false otherwise.
// Note: "word" is a group of characters separated by space.
// Examples:
// checkIfLastCharIsALetter(txt: "apple pie") == false
// checkIfLastCharIsALetter(txt: "apple pi e") == true
// checkIfLastCharIsALetter(txt: "apple pi e ") == false
// checkIfLastCharIsALetter(txt: "") == false
func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```swift
// Create a function that returns true if the last character
// of a given string is an alphabetical character and is not
// a part of a word, and false otherwise.
// Note: "word" is a group of characters separated by space.
// Examples:
// checkIfLastCharIsALetter(txt: "apple pie") == false
// checkIfLastCharIsALetter(txt: "apple pi e") == true
// checkIfLastCharIsALetter(txt: "apple pi e ") == false
// checkIfLastCharIsALetter(txt: "") == false
func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```swift
// Create a function that returns true if the last character
// of a given string is an alphabetical character and is not
// a part of a word, and false otherwise.
// Note: "word" is a group of characters separated by space.
// Examples:
// checkIfLastCharIsALetter(txt: "apple pie") == false
// checkIfLastCharIsALetter(txt: "apple pi e") == true
// checkIfLastCharIsALetter(txt: "apple pi e ") == false
// checkIfLastCharIsALetter(txt: "") == false
func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```swift
// Create a function that returns true if the last character
// of a given string is an alphabetical character and is not
// a part of a word, and false otherwise.
// Note: "word" is a group of characters separated by space.
// Examples:
// checkIfLastCharIsALetter(txt: "apple pie") == false
// checkIfLastCharIsALetter(txt: "apple pi e") == true
// checkIfLastCharIsALetter(txt: "apple pi e ") == false
// checkIfLastCharIsALetter(txt: "") == false
func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```swift
// Create a function that returns true if the last character
// of a given string is an alphabetical character and is not
// a part of a word, and false otherwise.
// Note: "word" is a group of characters separated by space.
// Examples:
// checkIfLastCharIsALetter(txt: "apple pie") == false
// checkIfLastCharIsALetter(txt: "apple pi e") == true
// checkIfLastCharIsALetter(txt: "apple pi e ") == false
// checkIfLastCharIsALetter(txt: "") == false
func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```swift
// Create a function that returns true if the last character
// of a given string is an alphabetical character and is not
// a part of a word, and false otherwise.
// Note: "word" is a group of characters separated by space.
// Examples:
// checkIfLastCharIsALetter(txt: "apple pie") == false
// checkIfLastCharIsALetter(txt: "apple pi e") == true
// checkIfLastCharIsALetter(txt: "apple pi e ") == false
// checkIfLastCharIsALetter(txt: "") == false
func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```swift
// Create a function that returns true if the last character
// of a given string is an alphabetical character and is not
// a part of a word, and false otherwise.
// Note: "word" is a group of characters separated by space.
// Examples:
// checkIfLastCharIsALetter(txt: "apple pie") == false
// checkIfLastCharIsALetter(txt: "apple pi e") == true
// checkIfLastCharIsALetter(txt: "apple pi e ") == false
// checkIfLastCharIsALetter(txt: "") == false
func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```swift
// Create a function that returns true if the last character
// of a given string is an alphabetical character and is not
// a part of a word, and false otherwise.
// Note: "word" is a group of characters separated by space.
// Examples:
// checkIfLastCharIsALetter(txt: "apple pie") == false
// checkIfLastCharIsALetter(txt: "apple pi e") == true
// checkIfLastCharIsALetter(txt: "apple pi e ") == false
// checkIfLastCharIsALetter(txt: "") == false
func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```swift
// Create a function that returns true if the last character
// of a given string is an alphabetical character and is not
// a part of a word, and false otherwise.
// Note: "word" is a group of characters separated by space.
// Examples:
// checkIfLastCharIsALetter(txt: "apple pie") == false
// checkIfLastCharIsALetter(txt: "apple pi e") == true
// checkIfLastCharIsALetter(txt: "apple pi e ") == false
// checkIfLastCharIsALetter(txt: "") == false
func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```swift
// Create a function that returns true if the last character
// of a given string is an alphabetical character and is not
// a part of a word, and false otherwise.
// Note: "word" is a group of characters separated by space.
// Examples:
// checkIfLastCharIsALetter(txt: "apple pie") == false
// checkIfLastCharIsALetter(txt: "apple pi e") == true
// checkIfLastCharIsALetter(txt: "apple pi e ") == false
// checkIfLastCharIsALetter(txt: "") == false
func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```swift
// Create a function which returns the largest index of an element which
// is not greater than or equal to the element immediately preceding it. If
// no such element exists then return -1. The given array will not contain
// duplicate values.
// Examples:
// canArrange(arr: [1, 2, 4, 3, 5]) == 3
// canArrange(arr: [1, 2, 3]) == -1
func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```swift
// Create a function which returns the largest index of an element which
// is not greater than or equal to the element immediately preceding it. If
// no such element exists then return -1. The given array will not contain
// duplicate values.
// Examples:
// canArrange(arr: [1, 2, 4, 3, 5]) == 3
// canArrange(arr: [1, 2, 3]) == -1
func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```swift
// Create a function which returns the largest index of an element which
// is not greater than or equal to the element immediately preceding it. If
// no such element exists then return -1. The given array will not contain
// duplicate values.
// Examples:
// canArrange(arr: [1, 2, 4, 3, 5]) == 3
// canArrange(arr: [1, 2, 3]) == -1
func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```swift
// Create a function which returns the largest index of an element which
// is not greater than or equal to the element immediately preceding it. If
// no such element exists then return -1. The given array will not contain
// duplicate values.
// Examples:
// canArrange(arr: [1, 2, 4, 3, 5]) == 3
// canArrange(arr: [1, 2, 3]) == -1
func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```swift
// Create a function which returns the largest index of an element which
// is not greater than or equal to the element immediately preceding it. If
// no such element exists then return -1. The given array will not contain
// duplicate values.
// Examples:
// canArrange(arr: [1, 2, 4, 3, 5]) == 3
// canArrange(arr: [1, 2, 3]) == -1
func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```swift
// Create a function which returns the largest index of an element which
// is not greater than or equal to the element immediately preceding it. If
// no such element exists then return -1. The given array will not contain
// duplicate values.
// Examples:
// canArrange(arr: [1, 2, 4, 3, 5]) == 3
// canArrange(arr: [1, 2, 3]) == -1
func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```swift
// Create a function which returns the largest index of an element which
// is not greater than or equal to the element immediately preceding it. If
// no such element exists then return -1. The given array will not contain
// duplicate values.
// Examples:
// canArrange(arr: [1, 2, 4, 3, 5]) == 3
// canArrange(arr: [1, 2, 3]) == -1
func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
    return -1
}
```swift
// Create a function which returns the largest index of an element which
// is not greater than or equal to the element immediately preceding it. If
// no such element exists then return -1. The given array will not contain
// duplicate values.
// Examples:
// canArrange(arr: [1, 2, 4, 3, 5]) == 3
// canArrange(arr: [1, 2, 3]) == -1
func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
    return -1
}
```
 // XCTAssertTrue failed

func canArrange(arr: [Int]) -> Int {
    var result = -1
    var index = 0
    var previous = arr[0]
    for i in 1..<arr.count {
        if arr[i] <= previous {
            result = i - 1
            previous = arr[i]
        }
    }
    return result
}
```swift
// Create a function which returns the largest index of an element which
// is not greater than or equal to the element immediately preceding it. If
// no such element exists then return -1. The given array will not contain
// duplicate values.
// Examples:
// canArrange(arr: [1, 2, 4, 3, 5]) == 3
// canArrange(arr: [1, 2, 3]) == -1
func canArrange(arr: [Int]) -> Int {
    var result = -1
    var index = 0
    var previous = arr[0]
    for i in 1..<arr.count {
        if arr[i] <= previous {
            result = i - 1
            previous = arr[i]
        }
    }
    return result
}
```
var index = 0 // initialization of variable 'index' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
    return -1
}
```swift
// Create a function which returns the largest index of an element which
// is not greater than or equal to the element immediately preceding it. If
// no such element exists then return -1. The given array will not contain
// duplicate values.
// Examples:
// canArrange(arr: [1, 2, 4, 3, 5]) == 3
// canArrange(arr: [1, 2, 3]) == -1
func canArrange(arr: [Int]) -> Int {
    // TODO: Write your code here
    return -1
}
```
 // XCTAssertTrue failed

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int?
    var smallest: Int?
    for i in lst {
        if i < 0 {
            if largest == nil || i > largest {
                largest = i
            }
        } else if i > 0 {
            if smallest == nil || i < smallest {
                smallest = i
            }
        }
    }
    return (largest, smallest)
}
```swift
// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int?
    var smallest: Int?
    for i in lst {
        if i < 0 {
            if largest == nil || i > largest {
                largest = i
            }
        } else if i > 0 {
            if smallest == nil || i < smallest {
                smallest = i
            }
        }
    }
    return (largest, smallest)
}
```
if largest == nil || i > largest { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if smallest == nil || i < smallest { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int? = nil
    var smallest: Int? = nil
    for i in lst {
        if i < 0 && (largest == nil || i > largest!) {
            largest = i
        }
        if i > 0 && (smallest == nil || i < smallest!) {
            smallest = i
        }
    }
    return (largest, smallest)
}
```swift
// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int? = nil
    var smallest: Int? = nil
    for i in lst {
        if i < 0 && (largest == nil || i > largest!) {
            largest = i
        }
        if i > 0 && (smallest == nil || i < smallest!) {
            smallest = i
        }
    }
    return (largest, smallest)
}
```

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest = nil
    var smallest = nil
    for number in lst {
        if largest == nil {
            largest = number
        } else if number > largest! {
            largest = number
        }
        if smallest == nil {
            smallest = number
        } else if number < smallest! {
            smallest = number
        }
    }
    return (largest, smallest)
}
```swift
// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest = nil
    var smallest = nil
    for number in lst {
        if largest == nil {
            largest = number
        } else if number > largest! {
            largest = number
        }
        if smallest == nil {
            smallest = number
        } else if number < smallest! {
            smallest = number
        }
    }
    return (largest, smallest)
}
```
var largest = nil // 'nil' requires a contextual type
var smallest = nil // 'nil' requires a contextual type

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int?
    var smallest: Int?
    for i in lst {
        if i < 0 && (largest == nil || i > largest!) {
            largest = i
        }
        if i > 0 && (smallest == nil || i < smallest!) {
            smallest = i
        }
    }
    return (largest, smallest)
}
```swift
// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int?
    var smallest: Int?
    for i in lst {
        if i < 0 && (largest == nil || i > largest!) {
            largest = i
        }
        if i > 0 && (smallest == nil || i < smallest!) {
            smallest = i
        }
    }
    return (largest, smallest)
}
```

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int? = nil
    var smallest: Int? = nil
    for number in lst {
        if number < 0 && (largest == nil || number > largest!) {
            largest = number
        }
        if number > 0 && (smallest == nil || number < smallest!) {
            smallest = number
        }
    }
    return (largest, smallest)
}
```swift
// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int? = nil
    var smallest: Int? = nil
    for number in lst {
        if number < 0 && (largest == nil || number > largest!) {
            largest = number
        }
        if number > 0 && (smallest == nil || number < smallest!) {
            smallest = number
        }
    }
    return (largest, smallest)
}
```

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int?
    var smallest: Int?
    for i in lst {
        if i < 0 {
            if largest == nil || i > largest! {
                largest = i
            }
        } else if i > 0 {
            if smallest == nil || i < smallest! {
                smallest = i
            }
        }
    }
    return (largest, smallest)
}
```swift
// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int?
    var smallest: Int?
    for i in lst {
        if i < 0 {
            if largest == nil || i > largest! {
                largest = i
            }
        } else if i > 0 {
            if smallest == nil || i < smallest! {
                smallest = i
            }
        }
    }
    return (largest, smallest)
}
```

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largestNegative: Int?
    var smallestPositive: Int?
    for number in lst {
        if number < 0 {
            if largestNegative == nil || number > largestNegative {
                largestNegative = number
            }
        } else if number > 0 {
            if smallestPositive == nil || number < smallestPositive {
                smallestPositive = number
            }
        }
    }
    return (largestNegative, smallestPositive)
}
```swift
// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largestNegative: Int?
    var smallestPositive: Int?
    for number in lst {
        if number < 0 {
            if largestNegative == nil || number > largestNegative {
                largestNegative = number
            }
        } else if number > 0 {
            if smallestPositive == nil || number < smallestPositive {
                smallestPositive = number
            }
        }
    }
    return (largestNegative, smallestPositive)
}

// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largestNegative: Int?
    var smallestPositive: Int?
    for number in lst {
        if number < 0 {
            if largestNegative == nil || number > largestNegative {
                largestNegative = number
            }
        } else if number > 0 {
            if smallestPositive == nil || number < smallestPositive {
                smallestPositive = number
            }
        }
    }
    return (largestNegative, smallestPositive)
}

// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largestNegative: Int?
    var smallestPositive: Int?
    for number in lst {
        if number < 0 {
            if largestNegative == nil || number > largestNegative {
                largestNegative = number
            }
        } else if number > 0 {
            if smallestPositive == nil || number < smallestPositive {
                smallestPositive = number
            }
        }
    }
    return (largestNegative, smallestPositive)
}

// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largestNegative: Int?
    var smallestPositive: Int?
    for number in lst {
        if number < 0 {
            if largestNegative == nil || number > largestNegative {
                largestNegative = number
            }
        } else if number > 0 {
            if smallestPositive == nil || number < smallestPositive {
                smallestPositive = number
            }
        }
    }
    return (largestNegative, smallestPositive)
}

// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
if largestNegative == nil || number > largestNegative { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if smallestPositive == nil || number < smallestPositive { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int? = nil
    var smallest: Int? = nil
    for i in lst {
        if i < 0 && (largest == nil || i > largest!) {
            largest = i
        } else if i > 0 && (smallest == nil || i < smallest!) {
            smallest = i
        }
    }
    return (largest, smallest)
}
```swift
// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int? = nil
    var smallest: Int? = nil
    for i in lst {
        if i < 0 && (largest == nil || i > largest!) {
            largest = i
        } else if i > 0 && (smallest == nil || i < smallest!) {
            smallest = i
        }
    }
    return (largest, smallest)
}
```

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest = Int.min
    var smallest = Int.max
    for i in lst {
        if i < 0 {
            largest = max(largest, i)
        } else {
            smallest = min(smallest, i)
        }
    }
    return (largest, smallest)
}
```swift
// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest = Int.min
    var smallest = Int.max
    for i in lst {
        if i < 0 {
            largest = max(largest, i)
        } else {
            smallest = min(smallest, i)
        }
    }
    return (largest, smallest)
}
```
 // XCTAssertTrue failed

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int?
    var smallest: Int?
    for num in lst {
        if num < 0 && (largest == nil || num > largest!) {
            largest = num
        } else if num > 0 && (smallest == nil || num < smallest!) {
            smallest = num
        }
    }
    return (largest, smallest)
}
```swift
// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int?
    var smallest: Int?
    for num in lst {
        if num < 0 && (largest == nil || num > largest!) {
            largest = num
        } else if num > 0 && (smallest == nil || num < smallest!) {
            smallest = num
        }
    }
    return (largest, smallest)
}
```

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```
} // missing return in global function expected to return 'Value?'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```
} // missing return in global function expected to return 'Value?'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}
```
} // missing return in global function expected to return 'Value?'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (a, b) where a == b:
        return nil
    case let (Value.intValue(a), Value.intValue(b)):
        return a > b ? a : b
    case let (Value.intValue(a), Value.doubleValue(b)):
        return a > b ? a : b
    case let (Value.intValue(a), Value.stringValue(b)):
        return a > b ? a : b
    case let (Value.doubleValue(a), Value.intValue(b)):
        return a > b ? a : b
    case let (Value.doubleValue(a), Value.doubleValue(b)):
        return a > b ? a : b
    case let (Value.doubleValue(a), Value.stringValue(b)):
        return a > b ? a : b
    case let (Value.stringValue(a), Value.intValue(b)):
        return a > b ? a : b
    case let (Value.stringValue(a), Value.doubleValue(b)):
        return a > b ? a : b
    case let (Value.stringValue(a), Value.stringValue(b)):
        return a > b ? a : b
    default:
        return nil
    }
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (a, b) where a == b:
        return nil
    case let (Value.intValue(a), Value.intValue(b)):
        return a > b ? a : b
    case let (Value.intValue(a), Value.doubleValue(b)):
        return a > b ? a : b
    case let (Value.intValue(a), Value.stringValue(b)):
        return a > b ? a : b
    case let (Value.doubleValue(a), Value.intValue(b)):
        return a > b ? a : b
    case let (Value.doubleValue(a), Value.doubleValue(b)):
        return a > b ? a : b
    case let (Value.doubleValue(a), Value.stringValue(b)):
        return a > b ? a : b
    case let (Value.stringValue(a), Value.intValue(b)):
        return a > b ? a : b
    case let (Value.stringValue(a), Value.doubleValue(b)):
        return a > b ? a : b
    case let (Value.stringValue(a), Value.stringValue(b)):
        return a > b ? a : b
    default:
        return nil
    }
}
```
return a > b ? a : b // cannot convert return expression of type 'Int' to return type 'Value?'
return a > b ? a : b // cannot convert value of type 'Double' to expected argument type 'Int'
return a > b ? a : b // cannot convert return expression of type 'Int' to return type 'Value?'
return a > b ? a : b // cannot convert return expression of type 'Int' to return type 'Value?'
return a > b ? a : b // cannot convert value of type 'String' to expected argument type 'Int'
return a > b ? a : b // cannot convert value of type 'Double' to expected argument type 'Int'
return a > b ? a : b // cannot convert return expression of type 'Double' to return type 'Value?'
return a > b ? a : b // cannot convert return expression of type 'Double' to return type 'Value?'
return a > b ? a : b // binary operator '>' cannot be applied to operands of type 'Double' and 'String'
return a > b ? a : b // cannot convert return expression of type 'Double' to return type 'Value?'
return a > b ? a : b // cannot convert value of type 'String' to expected argument type 'Int'
return a > b ? a : b // cannot convert return expression of type 'String' to return type 'Value?'
return a > b ? a : b // cannot convert return expression of type 'String' to return type 'Value?'
return a > b ? a : b // binary operator '>' cannot be applied to operands of type 'String' and 'Double'
return a > b ? a : b // cannot convert return expression of type 'String' to return type 'Value?'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a), .intValue(b)):
        return a == b ? nil : .intValue(max(a, b))
    case let (.doubleValue(a), .doubleValue(b)):
        return a == b ? nil : .doubleValue(max(a, b))
    case let (.stringValue(a), .stringValue(b)):
        return a == b ? nil : .stringValue(max(a, b))
    case let (.intValue(a), .doubleValue(b)):
        return .doubleValue(max(Double(a), b))
    case let (.intValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    case let (.doubleValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    default:
        return nil
    }
}

func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a), .intValue(b)):
        return a == b ? nil : .intValue(max(a, b))
    case let (.doubleValue(a), .doubleValue(b)):
        return a == b ? nil : .doubleValue(max(a, b))
    case let (.stringValue(a), .stringValue(b)):
        return a == b ? nil : .stringValue(max(a, b))
    case let (.intValue(a), .doubleValue(b)):
        return .doubleValue(max(Double(a), b))
    case let (.intValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    case let (.doubleValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    default:
        return nil
    }
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a), .intValue(b)):
        return a == b ? nil : .intValue(max(a, b))
    case let (.doubleValue(a), .doubleValue(b)):
        return a == b ? nil : .doubleValue(max(a, b))
    case let (.stringValue(a), .stringValue(b)):
        return a == b ? nil : .stringValue(max(a, b))
    case let (.intValue(a), .doubleValue(b)):
        return .doubleValue(max(Double(a), b))
    case let (.intValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    case let (.doubleValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    default:
        return nil
    }
}

// Create a function that takes two values, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareTwo(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareTwo(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareTwo(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareTwo(a: .stringValue("1"), b: .intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a), .intValue(b)):
        return a == b ? nil : .intValue(max(a, b))
    case let (.doubleValue(a), .doubleValue(b)):
        return a == b ? nil : .doubleValue(max(a, b))
    case let (.stringValue(a), .stringValue(b)):
        return a == b ? nil : .stringValue(max(a, b))
    case let (.intValue(a), .doubleValue(b)):
        return .doubleValue(max(Double(a), b))
    case let (.intValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    case let (.doubleValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    default:
        return nil
    }
}

// Create a function that takes three values, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareThree(a: .intValue(1), b: .doubleValue(2.5), c: .stringValue("3")) == .doubleValue(3)
// compareThree(a: .intValue(1), b: .stringValue("2,3"), c: .stringValue("6")) == .stringValue("6")
// compareThree(a: .stringValue("5,1"), b: .stringValue("6"), c: .stringValue("1")) == .stringValue("6")
// compareThree(a: .stringValue("1"), b: .intValue(1), c: .intValue(2)) == nil
func compareThree(a: Value, b: Value, c: Value) -> Value? {
    switch (a, b, c) {
    case let (.intValue(a), .intValue(b), .intValue(c)):
        return a == b && b == c ? nil : .intValue(max(a, b, c))
    case let (.doubleValue(a), .doubleValue(b), .doubleValue(c)):
        return a == b && b == c ? nil : .doubleValue(max(a, b, c))
    case let (.stringValue(a), .stringValue(b), .stringValue(c)):
        return a == b && b == c ? nil : .stringValue(max(a, b, c))
    case let (.intValue(a), .doubleValue(b), .doubleValue(c)):
       

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}

func compareTwo(a: Value, b: Value) -> Value? {
    // Your code here
}

func compareThree(a: Value, b: Value, c: Value) -> Value? {
    // Your code here
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    // Your code here
}

// Create a function that takes two values, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareTwo(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareTwo(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareTwo(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareTwo(a: .stringValue("1"), b: .intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    // Your code here
}

// Create a function that takes three values, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareThree(a: .intValue(1), b: .doubleValue(2.5), c: .stringValue("3,4")) == .doubleValue(2.5)
// compareThree(a: .intValue(1), b: .stringValue("2,3"), c: .stringValue("3,4")) == .stringValue("3,4")
// compareThree(a: .stringValue("5,1"), b: .stringValue("6"), c: .stringValue("6,7")) == .stringValue("6,7")
// compareThree(a: .stringValue("1"), b: .intValue(1), c: .doubleValue(2.5)) == nil
func compareThree(a: Value, b: Value, c: Value) -> Value? {
    // Your code here
}
```
} // missing return in global function expected to return 'Value?'
} // missing return in global function expected to return 'Value?'
} // missing return in global function expected to return 'Value?'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (a, b) where a == b:
        return nil
    case let (Value.intValue(a), Value.intValue(b)):
        return a > b ? .intValue(a) : .intValue(b)
    case let (Value.doubleValue(a), Value.doubleValue(b)):
        return a > b ? .doubleValue(a) : .doubleValue(b)
    case let (Value.stringValue(a), Value.stringValue(b)):
        return a > b ? .stringValue(a) : .stringValue(b)
    case let (Value.intValue(a), Value.doubleValue(b)):
        return a > b ? .doubleValue(Double(a)) : .doubleValue(b)
    case let (Value.intValue(a), Value.stringValue(b)):
        return a > b ? .stringValue(String(a)) : .stringValue(b)
    case let (Value.doubleValue(a), Value.intValue(b)):
        return a > b ? .doubleValue(a) : .doubleValue(Double(b))
    case let (Value.doubleValue(a), Value.stringValue(b)):
        return a > b ? .stringValue(String(a)) : .stringValue(b)
    case let (Value.stringValue(a), Value.intValue(b)):
        return a > b ? .stringValue(a) : .stringValue(String(b))
    case let (Value.stringValue(a), Value.doubleValue(b)):
        return a > b ? .stringValue(a) : .stringValue(String(b))
    default:
        return nil
    }
}

func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (a, b) where a == b:
        return nil
    case let (Value.intValue(a), Value.intValue(b)):
        return a > b ? .intValue(a) : .intValue(b)
    case let (Value.doubleValue(a), Value.doubleValue(b)):
        return a > b ? .doubleValue(a) : .doubleValue(b)
    case let (Value.stringValue(a), Value.stringValue(b)):
        return a > b ? .stringValue(a) : .stringValue(b)
    case let (Value.intValue(a), Value.doubleValue(b)):
        return a > b ? .doubleValue(Double(a)) : .doubleValue(b)
    case let (Value.intValue(a), Value.stringValue(b)):
        return a > b ? .stringValue(String(a)) : .stringValue(b)
    case let (Value.doubleValue(a), Value.intValue(b)):
        return a > b ? .doubleValue(a) : .doubleValue(Double(b))
    case let (Value.doubleValue(a), Value.stringValue(b)):
        return a > b ? .stringValue(String(a)) : .stringValue(b)
    case let (Value.stringValue(a), Value.intValue(b)):
        return a > b ? .stringValue(a) : .stringValue(String(b))
    case let (Value.stringValue(a), Value.doubleValue(b)):
        return a > b ? .stringValue(a) : .stringValue(String(b))
    default:
        return nil
    }
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (a, b) where a == b:
        return nil
    case let (Value.intValue(a), Value.intValue(b)):
        return a > b ? .intValue(a) : .intValue(b)
    case let (Value.doubleValue(a), Value.doubleValue(b)):
        return a > b ? .doubleValue(a) : .doubleValue(b)
    case let (Value.stringValue(a), Value.stringValue(b)):
        return a > b ? .stringValue(a) : .stringValue(b)
    case let (Value.intValue(a), Value.doubleValue(b)):
        return a > b ? .doubleValue(Double(a)) : .doubleValue(b)
    case let (Value.intValue(a), Value.stringValue(b)):
        return a > b ? .stringValue(String(a)) : .stringValue(b)
    case let (Value.doubleValue(a), Value.intValue(b)):
        return a > b ? .doubleValue(a) : .doubleValue(Double(b))
    case let (Value.doubleValue(a), Value.stringValue(b)):
        return a > b ? .stringValue(String(a)) : .stringValue(b)
    case let (Value.stringValue(a), Value.intValue(b)):
        return a > b ? .stringValue(a) : .stringValue(String(b))
    case let (Value.stringValue(a), Value.doubleValue(b)):
        return a > b ? .stringValue(a) : .stringValue(String(b))
    default:
        return nil
    }
}

// Create a function that takes two values, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareTwo(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareTwo(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareTwo(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareTwo(a: .stringValue("1"), b: .intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (a, b) where a == b:
        return nil
    case let (Value.intValue(a), Value.intValue(b)):
        return a > b ? .intValue(a) : .intValue(b)
    case let (Value.doubleValue(a), Value.doubleValue(b)):
        return a > b ? .doubleValue(a) : .doubleValue(b)
    case let (Value.stringValue(a), Value.stringValue(b)):
        return a > b ? .stringValue(a) : .stringValue(b)
    case let (Value.intValue(a), Value.doubleValue(b)):
        return a > b ? .doubleValue(Double(a)) : .doubleValue(b)
    case let (Value.intValue(a), Value.stringValue(b)):
        return a > b ? .stringValue(String(a)) : .stringValue(b)
    case let (Value.doubleValue(a), Value.intValue(b)):
        return a > b ? .doubleValue(a) : .doubleValue(Double(b))
    case let (Value.doubleValue(a), Value.stringValue(b)):
        return a > b ? .stringValue(String(a)) : .stringValue(b)
    case let (Value.stringValue(a), Value.intValue(b)):
        return a > b ? .stringValue(a) : .stringValue(String(b))
    case let (Value.stringValue(a), Value.doubleValue(b)):
        return a > b ? .stringValue(a) : .stringValue(String(b))
    default:
        return nil
    }
}

// Create a function that takes three values, and returns the larger variable in its given variable type.
// Return nil if the values are
return a > b ? .doubleValue(Double(a)) : .doubleValue(b) // cannot convert value of type 'Double' to expected argument type 'Int'
return a > b ? .stringValue(String(a)) : .stringValue(b) // cannot convert value of type 'String' to expected argument type 'Int'
return a > b ? .doubleValue(a) : .doubleValue(Double(b)) // cannot convert value of type 'Double' to expected argument type 'Int'
return a > b ? .stringValue(String(a)) : .stringValue(b) // binary operator '>' cannot be applied to operands of type 'Double' and 'String'
return a > b ? .stringValue(a) : .stringValue(String(b)) // cannot convert value of type 'String' to expected argument type 'Int'
return a > b ? .stringValue(a) : .stringValue(String(b)) // binary operator '>' cannot be applied to operands of type 'String' and 'Double'
return a > b ? .doubleValue(Double(a)) : .doubleValue(b) // cannot convert value of type 'Double' to expected argument type 'Int'
return a > b ? .stringValue(String(a)) : .stringValue(b) // cannot convert value of type 'String' to expected argument type 'Int'
return a > b ? .doubleValue(a) : .doubleValue(Double(b)) // cannot convert value of type 'Double' to expected argument type 'Int'
return a > b ? .stringValue(String(a)) : .stringValue(b) // binary operator '>' cannot be applied to operands of type 'Double' and 'String'
return a > b ? .stringValue(a) : .stringValue(String(b)) // cannot convert value of type 'String' to expected argument type 'Int'
return a > b ? .stringValue(a) : .stringValue(String(b)) // binary operator '>' cannot be applied to operands of type 'String' and 'Double'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a), .intValue(b)):
        return a == b ? nil : .intValue(max(a, b))
    case let (.doubleValue(a), .doubleValue(b)):
        return a == b ? nil : .doubleValue(max(a, b))
    case let (.stringValue(a), .stringValue(b)):
        return a == b ? nil : .stringValue(max(a, b))
    case let (.intValue(a), .doubleValue(b)):
        return .doubleValue(max(Double(a), b))
    case let (.intValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    case let (.doubleValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    default:
        return nil
    }
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a), .intValue(b)):
        return a == b ? nil : .intValue(max(a, b))
    case let (.doubleValue(a), .doubleValue(b)):
        return a == b ? nil : .doubleValue(max(a, b))
    case let (.stringValue(a), .stringValue(b)):
        return a == b ? nil : .stringValue(max(a, b))
    case let (.intValue(a), .doubleValue(b)):
        return .doubleValue(max(Double(a), b))
    case let (.intValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    case let (.doubleValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    default:
        return nil
    }
}
```

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (a, b) where a == b:
        return nil
    case let (a, b) where a.isGreaterThan(b):
        return a
    case let (a, b) where a.isLessThan(b):
        return b
    default:
        return nil
    }
}

extension Value {
    func isGreaterThan(_ other: Value) -> Bool {
        switch (self, other) {
        case let (a, b) where a.isIntValue && b.isIntValue:
            return a.intValue > b.intValue
        case let (a, b) where a.isDoubleValue && b.isDoubleValue:
            return a.doubleValue > b.doubleValue
        case let (a, b) where a.isStringValue && b.isStringValue:
            return a.stringValue > b.stringValue
        default:
            return false
        }
    }

    func isLessThan(_ other: Value) -> Bool {
        switch (self, other) {
        case let (a, b) where a.isIntValue && b.isIntValue:
            return a.intValue < b.intValue
        case let (a, b) where a.isDoubleValue && b.isDoubleValue:
            return a.doubleValue < b.doubleValue
        case let (a, b) where a.isStringValue && b.isStringValue:
            return a.stringValue < b.stringValue
        default:
            return false
        }
    }

    var isIntValue: Bool {
        switch self {
        case .intValue:
            return true
        default:
            return false
        }
    }

    var isDoubleValue: Bool {
        switch self {
        case .doubleValue:
            return true
        default:
            return false
        }
    }

    var isStringValue: Bool {
        switch self {
        case .stringValue:
            return true
        default:
            return false
        }
    }

    var intValue: Int {
        switch self {
        case let .intValue(value):
            return value
        default:
            fatalError("Not an int value")
        }
    }

    var doubleValue: Double {
        switch self {
        case let .doubleValue(value):
            return value
        default:
            fatalError("Not a double value")
        }
    }

    var stringValue: String {
        switch self {
        case let .stringValue(value):
            return value
        default:
            fatalError("Not a string value")
        }
    }
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (a, b) where a == b:
        return nil
    case let (a, b) where a.isGreaterThan(b):
        return a
    case let (a, b) where a.isLessThan(b):
        return b
    default:
        return nil
    }
}

extension Value {
    func isGreaterThan(_ other: Value) -> Bool {
        switch (self, other) {
        case let (a, b) where a.isIntValue && b.isIntValue:
            return a.intValue > b.intValue
        case let (a, b) where a.isDoubleValue && b.isDoubleValue:
            return a.doubleValue > b.doubleValue
        case let (a, b) where a.isStringValue && b.isStringValue:
            return a.stringValue > b.stringValue
        default:
            return false
        }
    }

    func isLessThan(_ other: Value) -> Bool {
        switch (self, other) {
        case let (a, b) where a.isIntValue && b.isIntValue:
            return a.intValue < b.intValue
        case let (a, b) where a.isDoubleValue && b.isDoubleValue:
            return a.doubleValue < b.doubleValue
        case let (a, b) where a.isStringValue && b.isStringValue:
            return a.stringValue < b.stringValue
        default:
            return false
        }
    }

    var isIntValue: Bool {
        switch self {
        case .intValue:
            return true
        default:
            return false
        }
    }

    var isDoubleValue: Bool {
        switch self {
        case .doubleValue:
            return true
        default:
            return false
        }
    }

    var isStringValue: Bool {
        switch self {
        case .stringValue:
            return true
        default:
            return false
        }
    }

    var intValue: Int {
        switch self {
        case let .intValue(value):
            return value
        default:
            fatalError("Not an int value")
        }
    }

    var doubleValue: Double {
        switch self {
        case let .doubleValue(value):
            return value
        default:
            fatalError("Not a double value")
        }
    }

    var stringValue: String {
        switch self {
        case let .stringValue(value):
            return value
        default:
            fatalError("Not a string value")
        }
    }
}
```
 // XCTAssertTrue failed

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a), .intValue(b)):
        return a == b ? nil : .intValue(max(a, b))
    case let (.doubleValue(a), .doubleValue(b)):
        return a == b ? nil : .doubleValue(max(a, b))
    case let (.stringValue(a), .stringValue(b)):
        return a == b ? nil : .stringValue(max(a, b))
    case let (.intValue(a), .doubleValue(b)):
        return .doubleValue(max(Double(a), b))
    case let (.intValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    case let (.doubleValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    default:
        return nil
    }
}

func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a), .intValue(b)):
        return a == b ? nil : .intValue(max(a, b))
    case let (.doubleValue(a), .doubleValue(b)):
        return a == b ? nil : .doubleValue(max(a, b))
    case let (.stringValue(a), .stringValue(b)):
        return a == b ? nil : .stringValue(max(a, b))
    case let (.intValue(a), .doubleValue(b)):
        return .doubleValue(max(Double(a), b))
    case let (.intValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    case let (.doubleValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    default:
        return nil
    }
}
```swift
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareOne(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareOne(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareOne(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareOne(a: .stringValue("1"), b: .intValue(1)) == nil
func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a), .intValue(b)):
        return a == b ? nil : .intValue(max(a, b))
    case let (.doubleValue(a), .doubleValue(b)):
        return a == b ? nil : .doubleValue(max(a, b))
    case let (.stringValue(a), .stringValue(b)):
        return a == b ? nil : .stringValue(max(a, b))
    case let (.intValue(a), .doubleValue(b)):
        return .doubleValue(max(Double(a), b))
    case let (.intValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    case let (.doubleValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareTwo(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareTwo(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareTwo(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareTwo(a: .stringValue("1"), b: .intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a), .intValue(b)):
        return a == b ? nil : .intValue(max(a, b))
    case let (.doubleValue(a), .doubleValue(b)):
        return a == b ? nil : .doubleValue(max(a, b))
    case let (.stringValue(a), .stringValue(b)):
        return a == b ? nil : .stringValue(max(a, b))
    case let (.intValue(a), .doubleValue(b)):
        return .doubleValue(max(Double(a), b))
    case let (.intValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    case let (.doubleValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be . or ,
// compareThree(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5)
// compareThree(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3")
// compareThree(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6")
// compareThree(a: .stringValue("1"), b: .intValue(1)) == nil
func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a), .intValue(b)):
        return a == b ? nil : .intValue(max(a, b))
    case let (.doubleValue(a), .doubleValue(b)):
        return a == b ? nil : .doubleValue(max(a, b))
    case let (.stringValue(a), .stringValue(b)):
        return a == b ? nil : .stringValue(max(a, b))
    case let (.intValue(a), .doubleValue(b)):
        return .doubleValue(max(Double(a), b))
    case let (.intValue(a), .stringValue(b)):
        return .stringValue(max(String(a), b))
    case let (.doubleValue(a), .string

func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    var count = 0
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 0 {
            sum += digit
            count += 1
        }
        n /= 10
    }
    return count == 4 && sum == n
}
```swift
// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
// Example
// isEqualToSumEven(n: 4) == false
// isEqualToSumEven(n: 6) == false
// isEqualToSumEven(n: 8) == true
func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    var count = 0
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 0 {
            sum += digit
            count += 1
        }
        n /= 10
    }
    return count == 4 && sum == n
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    while n > 0 {
        let remainder = n % 2
        if remainder == 0 {
            sum += remainder
            n /= 2
        } else {
            return false
        }
    }
    return sum == 4
}
```swift
// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
// Example
// isEqualToSumEven(n: 4) == false
// isEqualToSumEven(n: 6) == false
// isEqualToSumEven(n: 8) == true
func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    while n > 0 {
        let remainder = n % 2
        if remainder == 0 {
            sum += remainder
            n /= 2
        } else {
            return false
        }
    }
    return sum == 4
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    var count = 0
    while n > 0 {
        let remainder = n % 2
        if remainder == 0 {
            sum += remainder
            count += 1
        }
        n /= 2
    }
    return count == 4 && sum == n
}
```swift
// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
// Example
// isEqualToSumEven(n: 4) == false
// isEqualToSumEven(n: 6) == false
// isEqualToSumEven(n: 8) == true
func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    var count = 0
    while n > 0 {
        let remainder = n % 2
        if remainder == 0 {
            sum += remainder
            count += 1
        }
        n /= 2
    }
    return count == 4 && sum == n
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    let evenNumbers = [2, 4, 6, 8]
    let sum = evenNumbers.reduce(0, +)
    return n == sum
}
```swift
// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
// Example
// isEqualToSumEven(n: 4) == false
// isEqualToSumEven(n: 6) == false
// isEqualToSumEven(n: 8) == true
func isEqualToSumEven(n: Int) -> Bool {
    let evenNumbers = [2, 4, 6, 8]
    let sum = evenNumbers.reduce(0, +)
    return n == sum
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    var count = 0
    while n > 0 {
        let lastDigit = n % 10
        if lastDigit % 2 == 0 {
            sum += lastDigit
            count += 1
        }
        n /= 10
    }
    return count == 4 && sum == n
}
```swift
// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
// Example
// isEqualToSumEven(n: 4) == false
// isEqualToSumEven(n: 6) == false
// isEqualToSumEven(n: 8) == true
func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    var count = 0
    while n > 0 {
        let lastDigit = n % 10
        if lastDigit % 2 == 0 {
            sum += lastDigit
            count += 1
        }
        n /= 10
    }
    return count == 4 && sum == n
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    while n > 0 {
        let lastDigit = n % 10
        if lastDigit % 2 == 0 {
            sum += lastDigit
        }
        n /= 10
    }
    return sum == n
}
```swift
// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
// Example
// isEqualToSumEven(n: 4) == false
// isEqualToSumEven(n: 6) == false
// isEqualToSumEven(n: 8) == true
func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    while n > 0 {
        let lastDigit = n % 10
        if lastDigit % 2 == 0 {
            sum += lastDigit
        }
        n /= 10
    }
    return sum == n
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    var count = 0
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 0 {
            sum += digit
            count += 1
        }
        n /= 10
    }
    return count == 4 && sum == n
}
```swift
// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
// Example
// isEqualToSumEven(n: 4) == false
// isEqualToSumEven(n: 6) == false
// isEqualToSumEven(n: 8) == true
func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    var count = 0
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 0 {
            sum += digit
            count += 1
        }
        n /= 10
    }
    return count == 4 && sum == n
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var even = 0
    var odd = 0
    while n > 0 {
        if n % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
        n /= 2
    }
    return even == 4
}
```swift
// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
// Example
// isEqualToSumEven(n: 4) == false
// isEqualToSumEven(n: 6) == false
// isEqualToSumEven(n: 8) == true
func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var even = 0
    var odd = 0
    while n > 0 {
        if n % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
        n /= 2
    }
    return even == 4
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var sum = 0
    for i in 2...n {
        if i % 2 == 0 {
            sum += i
        }
    }
    return sum == n
}
```swift
// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
// Example
// isEqualToSumEven(n: 4) == false
// isEqualToSumEven(n: 6) == false
// isEqualToSumEven(n: 8) == true
func isEqualToSumEven(n: Int) -> Bool {
    var sum = 0
    for i in 2...n {
        if i % 2 == 0 {
            sum += i
        }
    }
    return sum == n
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    var count = 0
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 0 {
            sum += digit
            count += 1
        }
        n /= 10
    }
    return count == 4 && sum == n
}
```swift
// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
// Example
// isEqualToSumEven(n: 4) == false
// isEqualToSumEven(n: 6) == false
// isEqualToSumEven(n: 8) == true
func isEqualToSumEven(n: Int) -> Bool {
    var n = n
    var sum = 0
    var count = 0
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 0 {
            sum += digit
            count += 1
        }
        n /= 10
    }
    return count == 4 && sum == n
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 0 }
    return (1...n).reduce(1, *)
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 0 }
    return (1...n).reduce(1, *)
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 1 }
    return n * specialFactorial(n: n - 1)
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 1 }
    return n * specialFactorial(n: n - 1)
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 1 }
    return n * specialFactorial(n: n - 1)
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 1 }
    return n * specialFactorial(n: n - 1)
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 0 }
    return (1...n).reduce(1, *)
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 0 }
    return (1...n).reduce(1, *)
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 0 }
    guard n > 1 else { return 1 }
    return n * specialFactorial(n: n - 1)
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 0 }
    guard n > 1 else { return 1 }
    return n * specialFactorial(n: n - 1)
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 0 }
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 0 }
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 1 }
    return n * specialFactorial(n: n - 1)
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 1 }
    return n * specialFactorial(n: n - 1)
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 0 }
    return (1...n).reduce(1, *)
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 0 }
    return (1...n).reduce(1, *)
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 1 }
    return n * specialFactorial(n: n - 1)
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 1 }
    return n * specialFactorial(n: n - 1)
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 0 }
    return (1...n).reduce(1, *)
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    guard n > 0 else { return 0 }
    return (1...n).reduce(1, *)
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var lastChar = ""
    var consecutiveSpaces = 0
    for char in text {
        if char == " " {
            consecutiveSpaces += 1
            if consecutiveSpaces == 2 {
                result += "-"
            }
        } else {
            if consecutiveSpaces > 0 {
                result += "_"
            }
            consecutiveSpaces = 0
            result += String(char)
        }
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var lastChar = ""
    var consecutiveSpaces = 0
    for char in text {
        if char == " " {
            consecutiveSpaces += 1
            if consecutiveSpaces == 2 {
                result += "-"
            }
        } else {
            if consecutiveSpaces > 0 {
                result += "_"
            }
            consecutiveSpaces = 0
            result += String(char)
        }
    }
    return result
}
```
var lastChar = "" // initialization of variable 'lastChar' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var newText = ""
    var count = 0
    for character in text {
        if character == " " {
            count += 1
        } else {
            if count > 2 {
                newText += "-"
            } else if count > 0 {
                newText += "_"
            }
            count = 0
            newText += String(character)
        }
    }
    return newText
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var newText = ""
    var count = 0
    for character in text {
        if character == " " {
            count += 1
        } else {
            if count > 2 {
                newText += "-"
            } else if count > 0 {
                newText += "_"
            }
            count = 0
            newText += String(character)
        }
    }
    return newText
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var count = 0
    for char in text {
        if char == " " {
            count += 1
        } else {
            if count > 2 {
                result += "-"
            } else {
                result += count == 1 ? "_" : ""
            }
            count = 0
            result += String(char)
        }
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var count = 0
    for char in text {
        if char == " " {
            count += 1
        } else {
            if count > 2 {
                result += "-"
            } else {
                result += count == 1 ? "_" : ""
            }
            count = 0
            result += String(char)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var count = 0
    for char in text {
        if char == " " {
            count += 1
        } else {
            if count > 2 {
                result += "-"
            } else {
                result += count > 0 ? "_" : ""
            }
            count = 0
            result += String(char)
        }
    }
    if count > 2 {
        result += "-"
    } else {
        result += count > 0 ? "_" : ""
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var count = 0
    for char in text {
        if char == " " {
            count += 1
        } else {
            if count > 2 {
                result += "-"
            } else {
                result += count > 0 ? "_" : ""
            }
            count = 0
            result += String(char)
        }
    }
    if count > 2 {
        result += "-"
    } else {
        result += count > 0 ? "_" : ""
    }
    return result
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var spaces = 0
    for character in text {
        if character == " " {
            spaces += 1
        } else {
            if spaces > 2 {
                result += "-"
            } else if spaces > 0 {
                result += "_"
            }
            spaces = 0
            result += String(character)
        }
    }
    if spaces > 2 {
        result += "-"
    } else if spaces > 0 {
        result += "_"
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var spaces = 0
    for character in text {
        if character == " " {
            spaces += 1
        } else {
            if spaces > 2 {
                result += "-"
            } else if spaces > 0 {
                result += "_"
            }
            spaces = 0
            result += String(character)
        }
    }
    if spaces > 2 {
        result += "-"
    } else if spaces > 0 {
        result += "_"
    }
    return result
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var spaces = 0
    for character in text {
        if character == " " {
            spaces += 1
        } else {
            if spaces >= 2 {
                result += "-"
            } else {
                result += "_"
            }
            result += String(repeating: "_", count: spaces)
            spaces = 0
            result += String(character)
        }
    }
    if spaces >= 2 {
        result += "-"
    } else {
        result += "_"
    }
    result += String(repeating: "_", count: spaces)
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var spaces = 0
    for character in text {
        if character == " " {
            spaces += 1
        } else {
            if spaces >= 2 {
                result += "-"
            } else {
                result += "_"
            }
            result += String(repeating: "_", count: spaces)
            spaces = 0
            result += String(character)
        }
    }
    if spaces >= 2 {
        result += "-"
    } else {
        result += "_"
    }
    result += String(repeating: "_", count: spaces)
    return result
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var consecutiveSpaces = 0
    for character in text {
        if character == " " {
            consecutiveSpaces += 1
        } else {
            if consecutiveSpaces > 2 {
                result += "-"
            } else if consecutiveSpaces > 0 {
                result += "_"
            }
            consecutiveSpaces = 0
            result += String(character)
        }
    }
    if consecutiveSpaces > 2 {
        result += "-"
    } else if consecutiveSpaces > 0 {
        result += "_"
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var consecutiveSpaces = 0
    for character in text {
        if character == " " {
            consecutiveSpaces += 1
        } else {
            if consecutiveSpaces > 2 {
                result += "-"
            } else if consecutiveSpaces > 0 {
                result += "_"
            }
            consecutiveSpaces = 0
            result += String(character)
        }
    }
    if consecutiveSpaces > 2 {
        result += "-"
    } else if consecutiveSpaces > 0 {
        result += "_"
    }
    return result
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var consecutiveSpaces = 0
    for character in text {
        if character == " " {
            consecutiveSpaces += 1
        } else {
            if consecutiveSpaces > 2 {
                result += "-"
            } else if consecutiveSpaces > 0 {
                result += "_"
            }
            consecutiveSpaces = 0
            result += String(character)
        }
    }
    if consecutiveSpaces > 2 {
        result += "-"
    } else if consecutiveSpaces > 0 {
        result += "_"
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var consecutiveSpaces = 0
    for character in text {
        if character == " " {
            consecutiveSpaces += 1
        } else {
            if consecutiveSpaces > 2 {
                result += "-"
            } else if consecutiveSpaces > 0 {
                result += "_"
            }
            consecutiveSpaces = 0
            result += String(character)
        }
    }
    if consecutiveSpaces > 2 {
        result += "-"
    } else if consecutiveSpaces > 0 {
        result += "_"
    }
    return result
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var lastWasSpace = false
    for character in text {
        if character == " " {
            if lastWasSpace {
                result.append("-")
            } else {
                result.append("_")
            }
            lastWasSpace = true
        } else {
            result.append(character)
            lastWasSpace = false
        }
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var lastWasSpace = false
    for character in text {
        if character == " " {
            if lastWasSpace {
                result.append("-")
            } else {
                result.append("_")
            }
            lastWasSpace = true
        } else {
            result.append(character)
            lastWasSpace = false
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var consecutiveSpaces = 0
    for character in text {
        if character == " " {
            consecutiveSpaces += 1
        } else {
            if consecutiveSpaces > 2 {
                result += "-"
            } else if consecutiveSpaces > 0 {
                result += "_"
            }
            consecutiveSpaces = 0
            result += String(character)
        }
    }
    if consecutiveSpaces > 2 {
        result += "-"
    } else if consecutiveSpaces > 0 {
        result += "_"
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var consecutiveSpaces = 0
    for character in text {
        if character == " " {
            consecutiveSpaces += 1
        } else {
            if consecutiveSpaces > 2 {
                result += "-"
            } else if consecutiveSpaces > 0 {
                result += "_"
            }
            consecutiveSpaces = 0
            result += String(character)
        }
    }
    if consecutiveSpaces > 2 {
        result += "-"
    } else if consecutiveSpaces > 0 {
        result += "_"
    }
    return result
}
```
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    // Your code goes here
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    // Your code goes here
}
```
} // missing return in global function expected to return 'String'

func fileNameCheck(fileName: String) -> String {
    // Your code goes here
    return "No"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    // Your code goes here
    return "No"
}
```
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    let fileNameRegex = "^[a-zA-Z][a-zA-Z0-9]{0,2}\\.[txt|exe|dll]$"
    let fileNameTest = NSPredicate(format: "SELF MATCHES %@", fileNameRegex)
    return fileNameTest.evaluate(with: fileName) ? "Yes" : "No"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let fileNameRegex = "^[a-zA-Z][a-zA-Z0-9]{0,2}\\.[txt|exe|dll]$"
    let fileNameTest = NSPredicate(format: "SELF MATCHES %@", fileNameRegex)
    return fileNameTest.evaluate(with: fileName) ? "Yes" : "No"
}
```
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    let fileNameComponents = fileName.components(separatedBy: ".")
    guard fileNameComponents.count == 2,
        fileNameComponents[0].count > 0,
        fileNameComponents[0].range(of: "[0-9]", options: .regularExpression) == nil,
        fileNameComponents[0].range(of: "[a-zA-Z]") != nil,
        ["txt", "exe", "dll"].contains(fileNameComponents[1]) else {
            return "No"
    }
    return "Yes"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let fileNameComponents = fileName.components(separatedBy: ".")
    guard fileNameComponents.count == 2,
        fileNameComponents[0].count > 0,
        fileNameComponents[0].range(of: "[0-9]", options: .regularExpression) == nil,
        fileNameComponents[0].range(of: "[a-zA-Z]") != nil,
        ["txt", "exe", "dll"].contains(fileNameComponents[1]) else {
            return "No"
    }
    return "Yes"
}

fileNameCheck(fileName: "example.txt")
fileNameCheck(fileName: "1example.dll")
```
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    let fileNameArray = fileName.split(separator: ".")
    if fileNameArray.count != 2 {
        return "No"
    }
    let fileNameBeforeDot = String(fileNameArray[0])
    let fileNameAfterDot = String(fileNameArray[1])
    if fileNameBeforeDot.count == 0 {
        return "No"
    }
    if fileNameBeforeDot.count > 3 {
        return "No"
    }
    if fileNameAfterDot != "txt" && fileNameAfterDot != "exe" && fileNameAfterDot != "dll" {
        return "No"
    }
    return "Yes"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let fileNameArray = fileName.split(separator: ".")
    if fileNameArray.count != 2 {
        return "No"
    }
    let fileNameBeforeDot = String(fileNameArray[0])
    let fileNameAfterDot = String(fileNameArray[1])
    if fileNameBeforeDot.count == 0 {
        return "No"
    }
    if fileNameBeforeDot.count > 3 {
        return "No"
    }
    if fileNameAfterDot != "txt" && fileNameAfterDot != "exe" && fileNameAfterDot != "dll" {
        return "No"
    }
    return "Yes"
}
```
 // XCTAssertTrue failed

```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let fileName = fileName.lowercased()
    let fileNameArray = fileName.split(separator: ".")
    let fileNameArrayCount = fileNameArray.count
    if fileNameArrayCount != 2 {
        return "No"
    }
    let fileNameArrayFirst = String(fileNameArray[0])
    let fileNameArraySecond = String(fileNameArray[1])
    let fileNameArrayFirstCount = fileNameArrayFirst.count
    if fileNameArrayFirstCount == 0 {
        return "No"
    }
    let fileNameArrayFirstFirstCharacter = fileNameArrayFirst.first
    if fileNameArrayFirstFirstCharacter == nil {
        return "No"
    }
    let fileNameArrayFirstFirstCharacterUnicodeScalar = fileNameArrayFirstFirstCharacter!.unicodeScalars
    let fileNameArrayFirstFirstCharacterUnicodeScalarCount = fileNameArrayFirstFirstCharacterUnicodeScalar.count
    if fileNameArrayFirstFirstCharacterUnicodeScalarCount != 1 {
        return "No"
    }
    let fileNameArrayFirstFirstCharacterUnicodeScalarFirst = fileNameArrayFirstFirstCharacterUnicodeScalar.first
    if fileNameArrayFirstFirstCharacterUnicodeScalarFirst == nil {
        return "No"
    }
    let fileNameArrayFirstFirstCharacterUnicodeScalarFirstValue = fileNameArrayFirstFirstCharacterUnicodeScalarFirst!.value
    if fileNameArrayFirstFirstCharacterUnicodeScalarFirstValue < 97 || fileNameArrayFirstFirstCharacterUnicodeScalarFirstValue > 122 {
        return "No"
    }
    let fileNameArraySecondCount = fileNameArraySecond.count
    if fileNameArraySecondCount == 0 {
        return "No"
    }
    let fileNameArraySecondFirstCharacter = fileNameArraySecond.first
    if fileNameArraySecondFirstCharacter == nil {
        return "No"
    }
    let fileNameArraySecondFirstCharacterUnicodeScalar = fileNameArraySecondFirstCharacter!.unicodeScalars
    let fileNameArraySecondFirstCharacterUnicodeScalarCount = fileNameArraySecondFirstCharacterUnicodeScalar.count
    if fileNameArraySecondFirstCharacterUnicodeScalarCount != 1 {
        return "No"
    }
    let fileNameArraySecondFirstCharacterUnicodeScalarFirst = fileNameArraySecondFirstCharacterUnicodeScalar.first
    if fileNameArraySecondFirstCharacterUnicodeScalarFirst == nil {
        return "No"
    }
    let fileNameArraySecondFirstCharacterUnicodeScalarFirstValue = fileNameArraySecondFirstCharacterUnicodeScalarFirst!.value
    if fileNameArraySecondFirstCharacterUnicodeScalarFirstValue < 97 || fileNameArraySecondFirstCharacterUnicodeScalarFirstValue > 122 {
        return "No"
    }
    let fileNameArraySecondCountDigits = fileNameArraySecond.count
    if fileNameArraySecondCountDigits > 3 {
        return "No"
    }
    let fileNameArraySecondLastCharacter = fileNameArraySecond.last
    if fileNameArraySecondLastCharacter == nil {
        return "No"
    }
    let fileNameArraySecondLastCharacterUnicodeScalar = fileNameArraySecondLastCharacter!.unicodeScalars
    let fileNameArraySecondLastCharacterUnicodeScalarCount = fileNameArraySecondLastCharacterUnicodeScalar.count
    if fileNameArraySecondLastCharacterUnicodeScalarCount != 1 {
        return "No"
    }
    let fileNameArraySecondLastCharacterUnicodeScalarFirst = fileNameArraySecondLastCharacterUnicodeScalar.first
    if fileNameArraySecondLastCharacterUnicodeScalarFirst == nil {
        return "No"
    }
    let fileNameArraySecondLastCharacterUnicodeScalarFirstValue = fileNameArraySecondLastCharacterUnicodeScalarFirst!.value
    if fileNameArraySecondLastCharacterUnicodeScalarFirstValue < 97 || fileNameArraySecondLastCharacterUnicodeScalarFirstValue > 122 {
        return "No"
    }
    let fileNameArraySecondLastCharacterUnicodeScalarLast = fileNameArraySecondLastCharacterUnicodeScalar.last
    if fileNameArraySecondLastCharacterUnicodeScalarLast == nil {
        return "No"
    }
    let fileNameArraySecondLastCharacterUnicodeScalarLastValue = fileNameArraySecondLastCharacterUnicodeScalarLast!.value
    if fileNameArraySecondLastCharacterUnicodeScalarLastValue < 97 || fileNameArraySecondLastCharacterUnicodeScalarLastValue > 122 {
        return "No"
    }
    if fileNameArraySecond != "txt" && fileNameArraySecond != "exe" && fileNameArraySecond != "dll
XCTAssertTrue(fileNameCheck(fileName: "example.txt") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "1example.dll") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "s1sdf3.asd") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "K.dll") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "MY16FILE3.exe") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "His12FILE94.exe") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "_Y.txt") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "?aREYA.exe") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "/thisIsValid.dll") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "thisIsValid.wow") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "thisIsValid.txt") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "thisIsValid.txtexe") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "#this2I4s5valid.ten") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "@this1Is6Valid.exe") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "thisIs12valid.6exe4.txt") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "all.exe.txt") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "I563_No.exe") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "Is3youfault.txt") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "noOne#knows.dll") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "1I563_Yes3.exe") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "I563_Yes3.txtt") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "final..txt") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "final132") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "F4indsartal132.") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: ".txt") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "s.") == "No") // cannot find 'fileNameCheck' in scope

func fileNameCheck(fileName: String) -> String {
    let fileNameArray = fileName.components(separatedBy: ".")
    if fileNameArray.count != 2 {
        return "No"
    }
    let fileNameBeforeDot = fileNameArray[0]
    let fileNameAfterDot = fileNameArray[1]
    let fileNameBeforeDotArray = fileNameBeforeDot.components(separatedBy: ".")
    if fileNameBeforeDotArray.count != 1 {
        return "No"
    }
    let fileNameBeforeDotFirstCharacter = fileNameBeforeDotArray[0].first
    if fileNameBeforeDotFirstCharacter == nil {
        return "No"
    }
    let fileNameBeforeDotFirstCharacterAsciiValue = fileNameBeforeDotFirstCharacter!.asciiValue!
    if fileNameBeforeDotFirstCharacterAsciiValue < 97 || fileNameBeforeDotFirstCharacterAsciiValue > 122 {
        return "No"
    }
    if fileNameBeforeDot.count > 3 {
        return "No"
    }
    if fileNameAfterDot != "txt" && fileNameAfterDot != "exe" && fileNameAfterDot != "dll" {
        return "No"
    }
    return "Yes"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let fileNameArray = fileName.components(separatedBy: ".")
    if fileNameArray.count != 2 {
        return "No"
    }
    let fileNameBeforeDot = fileNameArray[0]
    let fileNameAfterDot = fileNameArray[1]
    let fileNameBeforeDotArray = fileNameBeforeDot.components(separatedBy: ".")
    if fileNameBeforeDotArray.count != 1 {
        return "No"
    }
    let fileNameBeforeDotFirstCharacter = fileNameBeforeDotArray[0].first
    if fileNameBeforeDotFirstCharacter == nil {
        return "No"
    }
    let fileNameBeforeDotFirstCharacterAsciiValue = fileNameBeforeDotFirstCharacter!.asciiValue!
    if fileNameBeforeDotFirstCharacterAsciiValue < 97 || fileNameBeforeDotFirstCharacterAsciiValue > 122 {
        return "No"
    }
    if fileNameBeforeDot.count > 3 {
        return "No"
    }
    if fileNameAfterDot != "txt" && fileNameAfterDot != "exe" && fileNameAfterDot != "dll" {
        return "No"
    }
    return "Yes"
}
```
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    let file = fileName.components(separatedBy: ".")
    if file.count != 2 {
        return "No"
    }
    let first = file[0]
    let second = file[1]
    if first.count == 0 || second.count == 0 {
        return "No"
    }
    if first.count > 3 || second.count > 3 {
        return "No"
    }
    if !first.hasPrefix("a") && !first.hasPrefix("A") && !first.hasPrefix("z") && !first.hasPrefix("Z") {
        return "No"
    }
    if !second.hasPrefix("txt") && !second.hasPrefix("exe") && !second.hasPrefix("dll") {
        return "No"
    }
    return "Yes"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let file = fileName.components(separatedBy: ".")
    if file.count != 2 {
        return "No"
    }
    let first = file[0]
    let second = file[1]
    if first.count == 0 || second.count == 0 {
        return "No"
    }
    if first.count > 3 || second.count > 3 {
        return "No"
    }
    if !first.hasPrefix("a") && !first.hasPrefix("A") && !first.hasPrefix("z") && !first.hasPrefix("Z") {
        return "No"
    }
    if !second.hasPrefix("txt") && !second.hasPrefix("exe") && !second.hasPrefix("dll") {
        return "No"
    }
    return "Yes"
}
```
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    let regex = try! NSRegularExpression(pattern: "^[a-zA-Z][a-zA-Z0-9]{0,2}\\.[txt|exe|dll]$", options: .caseInsensitive)
    let matches = regex.matches(in: fileName, options: [], range: NSRange(location: 0, length: fileName.count))
    return matches.count == 1 ? "Yes" : "No"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let regex = try! NSRegularExpression(pattern: "^[a-zA-Z][a-zA-Z0-9]{0,2}\\.[txt|exe|dll]$", options: .caseInsensitive)
    let matches = regex.matches(in: fileName, options: [], range: NSRange(location: 0, length: fileName.count))
    return matches.count == 1 ? "Yes" : "No"
}
```
 // XCTAssertTrue failed

```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA-Z])([a-zA-Z0-9]{0,2})\\.([a-zA-Z0-9]{0,3})"
    let fileNameRegex = "([a-zA
XCTAssertTrue(fileNameCheck(fileName: "example.txt") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "1example.dll") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "s1sdf3.asd") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "K.dll") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "MY16FILE3.exe") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "His12FILE94.exe") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "_Y.txt") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "?aREYA.exe") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "/thisIsValid.dll") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "thisIsValid.wow") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "thisIsValid.txt") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "thisIsValid.txtexe") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "#this2I4s5valid.ten") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "@this1Is6Valid.exe") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "thisIs12valid.6exe4.txt") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "all.exe.txt") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "I563_No.exe") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "Is3youfault.txt") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "noOne#knows.dll") == "Yes") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "1I563_Yes3.exe") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "I563_Yes3.txtt") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "final..txt") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "final132") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "F4indsartal132.") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: ".txt") == "No") // cannot find 'fileNameCheck' in scope
XCTAssertTrue(fileNameCheck(fileName: "s.") == "No") // cannot find 'fileNameCheck' in scope

func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primes = words.filter({ $0.count.isPrime })
    return primes.joined(separator: " ")
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primes = words.filter({ $0.count.isPrime })
    return primes.joined(separator: " ")
}
```
let primes = words.filter({ $0.count.isPrime }) // value of type 'Int' has no member 'isPrime'

func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result.append(word)
            result.append(" ")
        }
    }
    return result
}

func isPrime(_ number: Int) -> Bool {
    if number == 1 {
        return false
    }
    for i in 2...number/2 {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result.append(word)
            result.append(" ")
        }
    }
    return result
}

func isPrime(_ number: Int) -> Bool {
    if number == 1 {
        return false
    }
    for i in 2...number/2 {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
result.append(word) // no exact matches in call to instance method 'append'

func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primes = words.filter { $0.count.isPrime }
    return primes.joined(separator: " ")
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    let primes = words.filter { $0.count.isPrime }
    return primes.joined(separator: " ")
}
```
let primes = words.filter { $0.count.isPrime } // value of type 'Int' has no member 'isPrime'

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primes = words.filter { $0.count.isPrime }
    return primes.joined(separator: " ")
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primes = words.filter { $0.count.isPrime }
    return primes.joined(separator: " ")
}
```
let primes = words.filter { $0.count.isPrime } // value of type 'Int' has no member 'isPrime'

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result.append(word + " ")
        }
    }
    return result
}

func isPrime(_ number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2...number / 2 {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result.append(word + " ")
        }
    }
    return result
}

func isPrime(_ number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    for i in 2...number / 2 {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primes = words.filter { $0.count.isPrime }
    return primes.joined(separator: " ")
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primes = words.filter { $0.count.isPrime }
    return primes.joined(separator: " ")
}
```
let primes = words.filter { $0.count.isPrime } // value of type 'Int' has no member 'isPrime'

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
    let filteredWords = words.filter { word in
        let wordLength = word.count
        return primes.contains(where: { $0 == wordLength })
    }
    return filteredWords.joined(separator: " ")
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
    let filteredWords = words.filter { word in
        let wordLength = word.count
        return primes.contains(where: { $0 == wordLength })
    }
    return filteredWords.joined(separator: " ")
}
```

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primeNumbers = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
    var result = ""
    for word in words {
        if primeNumbers.contains(word.count) {
            result += word + " "
        }
    }
    return result
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primeNumbers = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
    var result = ""
    for word in words {
        if primeNumbers.contains(word.count) {
            result += word + " "
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primes = words.filter { $0.count.isPrime }
    return primes.joined(separator: " ")
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primes = words.filter { $0.count.isPrime }
    return primes.joined(separator: " ")
}
```
let primes = words.filter { $0.count.isPrime } // value of type 'Int' has no member 'isPrime'

func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result += " \(word)"
        }
    }
    return result
}

func isPrime(_ number: Int) -> Bool {
    if number < 2 {
        return false
    }
    for i in 2...number/2 {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result += " \(word)"
        }
    }
    return result
}

func isPrime(_ number: Int) -> Bool {
    if number < 2 {
        return false
    }
    for i in 2...number/2 {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/").first!)!
    let xDenominator = Int(x.components(separatedBy: "/").last!)!
    let nNumerator = Int(n.components(separatedBy: "/").first!)!
    let nDenominator = Int(n.components(separatedBy: "/").last!)!
    return (xNumerator * nDenominator) % nNumerator == 0 && (xDenominator * nNumerator) % nDenominator == 0
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/").first!)!
    let xDenominator = Int(x.components(separatedBy: "/").last!)!
    let nNumerator = Int(n.components(separatedBy: "/").first!)!
    let nDenominator = Int(n.components(separatedBy: "/").last!)!
    return (xNumerator * nDenominator) % nNumerator == 0 && (xDenominator * nNumerator) % nDenominator == 0
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let x = x.components(separatedBy: "/").map { Int($0)! }
    let n = n.components(separatedBy: "/").map { Int($0)! }
    return x[0] * n[1] == x[1] * n[0]
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let x = x.components(separatedBy: "/").map { Int($0)! }
    let n = n.components(separatedBy: "/").map { Int($0)! }
    return x[0] * n[1] == x[1] * n[0]
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/")[0])!
    let xDenominator = Int(x.components(separatedBy: "/")[1])!
    let nNumerator = Int(n.components(separatedBy: "/")[0])!
    let nDenominator = Int(n.components(separatedBy: "/")[1])!
    return (xNumerator * nDenominator) % nNumerator == 0 && (xDenominator * nNumerator) % nDenominator == 0
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/")[0])!
    let xDenominator = Int(x.components(separatedBy: "/")[1])!
    let nNumerator = Int(n.components(separatedBy: "/")[0])!
    let nDenominator = Int(n.components(separatedBy: "/")[1])!
    return (xNumerator * nDenominator) % nNumerator == 0 && (xDenominator * nNumerator) % nDenominator == 0
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/").first!)!
    let xDenominator = Int(x.components(separatedBy: "/").last!)!
    let nNumerator = Int(n.components(separatedBy: "/").first!)!
    let nDenominator = Int(n.components(separatedBy: "/").last!)!
    
    let xMultiplied = xNumerator * nDenominator
    let nMultiplied = nNumerator * xDenominator
    
    return xMultiplied % nDenominator == 0 && nMultiplied % xDenominator == 0
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/").first!)!
    let xDenominator = Int(x.components(separatedBy: "/").last!)!
    let nNumerator = Int(n.components(separatedBy: "/").first!)!
    let nDenominator = Int(n.components(separatedBy: "/").last!)!
    
    let xMultiplied = xNumerator * nDenominator
    let nMultiplied = nNumerator * xDenominator
    
    return xMultiplied % nDenominator == 0 && nMultiplied % xDenominator == 0
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/").first!)!
    let xDenominator = Int(x.components(separatedBy: "/").last!)!
    let nNumerator = Int(n.components(separatedBy: "/").first!)!
    let nDenominator = Int(n.components(separatedBy: "/").last!)!
    return (xNumerator * nDenominator) % nNumerator == 0 && (xDenominator * nNumerator) % nDenominator == 0
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/").first!)!
    let xDenominator = Int(x.components(separatedBy: "/").last!)!
    let nNumerator = Int(n.components(separatedBy: "/").first!)!
    let nDenominator = Int(n.components(separatedBy: "/").last!)!
    return (xNumerator * nDenominator) % nNumerator == 0 && (xDenominator * nNumerator) % nDenominator == 0
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let x = x.components(separatedBy: "/").map { Int($0)! }
    let n = n.components(separatedBy: "/").map { Int($0)! }
    return x[0] * n[1] == x[1] * n[0]
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let x = x.components(separatedBy: "/").map { Int($0)! }
    let n = n.components(separatedBy: "/").map { Int($0)! }
    return x[0] * n[1] == x[1] * n[0]
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/")[0])!
    let xDenominator = Int(x.components(separatedBy: "/")[1])!
    let nNumerator = Int(n.components(separatedBy: "/")[0])!
    let nDenominator = Int(n.components(separatedBy: "/")[1])!
    return (xNumerator * nDenominator) % nNumerator == 0 && (xDenominator * nNumerator) % nDenominator == 0
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/")[0])!
    let xDenominator = Int(x.components(separatedBy: "/")[1])!
    let nNumerator = Int(n.components(separatedBy: "/")[0])!
    let nDenominator = Int(n.components(separatedBy: "/")[1])!
    return (xNumerator * nDenominator) % nNumerator == 0 && (xDenominator * nNumerator) % nDenominator == 0
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/").first!)!
    let xDenominator = Int(x.components(separatedBy: "/").last!)!
    let nNumerator = Int(n.components(separatedBy: "/").first!)!
    let nDenominator = Int(n.components(separatedBy: "/").last!)!
    
    let xMultiplied = xNumerator * nDenominator
    let nMultiplied = nNumerator * xDenominator
    
    return xMultiplied % nDenominator == 0 && nMultiplied % xDenominator == 0
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/").first!)!
    let xDenominator = Int(x.components(separatedBy: "/").last!)!
    let nNumerator = Int(n.components(separatedBy: "/").first!)!
    let nDenominator = Int(n.components(separatedBy: "/").last!)!
    
    let xMultiplied = xNumerator * nDenominator
    let nMultiplied = nNumerator * xDenominator
    
    return xMultiplied % nDenominator == 0 && nMultiplied % xDenominator == 0
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/").first!)!
    let xDenominator = Int(x.components(separatedBy: "/").last!)!
    let nNumerator = Int(n.components(separatedBy: "/").first!)!
    let nDenominator = Int(n.components(separatedBy: "/").last!)!
    
    let xMultiplied = xNumerator * nDenominator
    let nMultiplied = nNumerator * xDenominator
    
    return xMultiplied % nDenominator == 0 && nMultiplied % xDenominator == 0
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/").first!)!
    let xDenominator = Int(x.components(separatedBy: "/").last!)!
    let nNumerator = Int(n.components(separatedBy: "/").first!)!
    let nDenominator = Int(n.components(separatedBy: "/").last!)!
    
    let xMultiplied = xNumerator * nDenominator
    let nMultiplied = nNumerator * xDenominator
    
    return xMultiplied % nDenominator == 0 && nMultiplied % xDenominator == 0
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/")[0])!
    let xDenominator = Int(x.components(separatedBy: "/")[1])!
    let nNumerator = Int(n.components(separatedBy: "/")[0])!
    let nDenominator = Int(n.components(separatedBy: "/")[1])!
    
    let xMultiplied = xNumerator * nDenominator
    let nMultiplied = nNumerator * xDenominator
    
    return xMultiplied % nDenominator == 0 && nMultiplied % xDenominator == 0
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xNumerator = Int(x.components(separatedBy: "/")[0])!
    let xDenominator = Int(x.components(separatedBy: "/")[1])!
    let nNumerator = Int(n.components(separatedBy: "/")[0])!
    let nDenominator = Int(n.components(separatedBy: "/")[1])!
    
    let xMultiplied = xNumerator * nDenominator
    let nMultiplied = nNumerator * xDenominator
    
    return xMultiplied % nDenominator == 0 && nMultiplied % xDenominator == 0
}
```
 // XCTAssertTrue failed

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: Write your code here
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: Write your code here
}
```
} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = sumOfDigits(num: $0)
        let sum2 = sumOfDigits(num: $1)
        if sum1 == sum2 {
            return $0 < $1
        }
        return sum1 < sum2
    }
}

func sumOfDigits(num: Int) -> Int {
    var sum = 0
    var num = num
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = sumOfDigits(num: $0)
        let sum2 = sumOfDigits(num: $1)
        if sum1 == sum2 {
            return $0 < $1
        }
        return sum1 < sum2
    }
}

func sumOfDigits(num: Int) -> Int {
    var sum = 0
    var num = num
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}
```
 // XCTAssertTrue failed

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: Write your code here
    return nums
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: Write your code here
    return nums
}
```
 // XCTAssertTrue failed

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: Write your code here
    return nums
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: Write your code here
    return nums
}
```
 // XCTAssertTrue failed

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: Write your code here
    return []
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: Write your code here
    return []
}
```
 // XCTAssertTrue failed

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: Write your code here
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: Write your code here
}
```
} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    var result = nums
    result.sort {
        let sum1 = sumOfDigits(num: $0)
        let sum2 = sumOfDigits(num: $1)
        return sum1 < sum2 || (sum1 == sum2 && $0 < $1)
    }
    return result
}

func sumOfDigits(num: Int) -> Int {
    var sum = 0
    var num = num
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    var result = nums
    result.sort {
        let sum1 = sumOfDigits(num: $0)
        let sum2 = sumOfDigits(num: $1)
        return sum1 < sum2 || (sum1 == sum2 && $0 < $1)
    }
    return result
}

func sumOfDigits(num: Int) -> Int {
    var sum = 0
    var num = num
    while num > 0 {
        sum += num % 10
        num /= 10
    }
    return sum
}
```
 // XCTAssertTrue failed

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: Write your code here
    return []
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: Write your code here
    return []
}

orderByPoints(nums: [1, 11, -1, -11, -12])
// [-1, -11, 1, -12, 11]
```
 // XCTAssertTrue failed

func orderByPoints(nums: [Int]) -> [Int] {
    let sortedByPoints = nums.sorted { (a, b) -> Bool in
        return sumOfDigits(a) < sumOfDigits(b)
    }
    
    return sortedByPoints
}

func sumOfDigits(_ number: Int) -> Int {
    var sum = 0
    var number = number
    
    while number > 0 {
        sum += number % 10
        number /= 10
    }
    
    return sum
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    let sortedByPoints = nums.sorted { (a, b) -> Bool in
        return sumOfDigits(a) < sumOfDigits(b)
    }
    
    return sortedByPoints
}

func sumOfDigits(_ number: Int) -> Int {
    var sum = 0
    var number = number
    
    while number > 0 {
        sum += number % 10
        number /= 10
    }
    
    return sum
}
```
 // XCTAssertTrue failed

func orderByPoints(nums: [Int]) -> [Int] {
    let sorted = nums.sorted { $0.sumOfDigits() < $1.sumOfDigits() }
    return sorted.sorted { $0.sumOfDigits() == $1.sumOfDigits() ? $0 < $1 : false }
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    let sorted = nums.sorted { $0.sumOfDigits() < $1.sumOfDigits() }
    return sorted.sorted { $0.sumOfDigits() == $1.sumOfDigits() ? $0 < $1 : false }
}

// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    let sorted = nums.sorted { $0.sumOfDigits() < $1.sumOfDigits() }
    return sorted.sorted { $0.sumOfDigits() == $1.sumOfDigits() ? $0 < $1 : false }
}

// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    let sorted = nums.sorted { $0.sumOfDigits() < $1.sumOfDigits() }
    return sorted.sorted { $0.sumOfDigits() == $1.sumOfDigits() ? $0 < $1 : false }
}

// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    let sorted = nums.sorted { $0.sumOfDigits() < $1.sumOfDigits() }
    return sorted.sorted { $0.sumOfDigits() == $1.sumOfDigits() ? $0 < $1 : false }
}

// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    let sorted = nums.sorted { $0.sumOfDigits() < $1.sumOfDigits() }
    return sorted.sorted { $0.sumOfDigits() == $1.sumOfDigits() ? $0 < $1 : false }
}

// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 == 1 && num / 10 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 == 1 && num / 10 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 != 0 && num / 10 % 2 != 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 != 0 && num / 10 % 2 != 0 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 == 1 && num / 10 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 == 1 && num / 10 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 == 1 && num / 10 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 == 1 && num / 10 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && (num % 10 == 1 || num % 10 == 9) && (num / 10 == 1 || num / 10 == 9) {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && (num % 10 == 1 || num % 10 == 9) && (num / 10 == 1 || num / 10 == 9) {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 {
            let firstDigit = num / 10
            let lastDigit = num % 10
            if firstDigit % 2 == 1 && lastDigit % 2 == 1 {
                count += 1
            }
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 {
            let firstDigit = num / 10
            let lastDigit = num % 10
            if firstDigit % 2 == 1 && lastDigit % 2 == 1 {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 == 1 && num / 10 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 == 1 && num / 10 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 == 1 && num / 10 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 == 1 && num / 10 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 == 1 && num / 10 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10 % 2 == 1 && num / 10 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && (num % 10) % 2 == 1 && (num / 10) % 2 == 1 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && (num % 10) % 2 == 1 && (num / 10) % 2 == 1 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func getMaxTriples(n: Int) -> Int {
    var maxTriples = 0
    var a = [Int]()
    for i in 1...n {
        a.append(i * i - i + 1)
    }
    for i in 0..<a.count {
        for j in i + 1..<a.count {
            for k in j + 1..<a.count {
                if a[i] + a[j] + a[k] % 3 == 0 {
                    maxTriples += 1
                }
            }
        }
    }
    return maxTriples
}
```swift
// You are given a positive integer n. You have to create an integer array a of length n.
// For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
// Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, 
// and a[i] + a[j] + a[k] is a multiple of 3.
// Example :
// Explanation: 
// a = [1, 3, 7, 13, 21]
// The only valid triple is (1, 7, 13).
// getMaxTriples(n: 5) == 1
func getMaxTriples(n: Int) -> Int {
    var maxTriples = 0
    var a = [Int]()
    for i in 1...n {
        a.append(i * i - i + 1)
    }
    for i in 0..<a.count {
        for j in i + 1..<a.count {
            for k in j + 1..<a.count {
                if a[i] + a[j] + a[k] % 3 == 0 {
                    maxTriples += 1
                }
            }
        }
    }
    return maxTriples
}
```
 // XCTAssertTrue failed

func getMaxTriples(n: Int) -> Int {
    var max = 0
    for i in 1...n {
        for j in i+1...n {
            for k in j+1...n {
                if (i * i - i + 1) + (j * j - j + 1) + (k * k - k + 1) % 3 == 0 {
                    max += 1
                }
            }
        }
    }
    return max
}
```swift
// You are given a positive integer n. You have to create an integer array a of length n.
// For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
// Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, 
// and a[i] + a[j] + a[k] is a multiple of 3.
// Example :
// Explanation: 
// a = [1, 3, 7, 13, 21]
// The only valid triple is (1, 7, 13).
// getMaxTriples(n: 5) == 1
func getMaxTriples(n: Int) -> Int {
    var max = 0
    for i in 1...n {
        for j in i+1...n {
            for k in j+1...n {
                if (i * i - i + 1) + (j * j - j + 1) + (k * k - k + 1) % 3 == 0 {
                    max += 1
                }
            }
        }
    }
    return max
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func getMaxTriples(n: Int) -> Int {
    var result = 0
    for i in 1...n {
        for j in i+1...n {
            for k in j+1...n {
                if i + j + k == 0 {
                    result += 1
                }
            }
        }
    }
    return result
}
```swift
// You are given a positive integer n. You have to create an integer array a of length n.
// For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
// Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, 
// and a[i] + a[j] + a[k] is a multiple of 3.
// Example :
// Explanation: 
// a = [1, 3, 7, 13, 21]
// The only valid triple is (1, 7, 13).
// getMaxTriples(n: 5) == 1
func getMaxTriples(n: Int) -> Int {
    var result = 0
    for i in 1...n {
        for j in i+1...n {
            for k in j+1...n {
                if i + j + k == 0 {
                    result += 1
                }
            }
        }
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func getMaxTriples(n: Int) -> Int {
    var result = 0
    var array = [Int]()
    for i in 1...n {
        array.append(i * i - i + 1)
    }
    for i in 0..<array.count {
        for j in i + 1..<array.count {
            for k in j + 1..<array.count {
                if array[i] + array[j] + array[k] % 3 == 0 {
                    result += 1
                }
            }
        }
    }
    return result
}
```swift
// You are given a positive integer n. You have to create an integer array a of length n.
// For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
// Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, 
// and a[i] + a[j] + a[k] is a multiple of 3.
// Example :
// Explanation: 
// a = [1, 3, 7, 13, 21]
// The only valid triple is (1, 7, 13).
// getMaxTriples(n: 5) == 1
func getMaxTriples(n: Int) -> Int {
    var result = 0
    var array = [Int]()
    for i in 1...n {
        array.append(i * i - i + 1)
    }
    for i in 0..<array.count {
        for j in i + 1..<array.count {
            for k in j + 1..<array.count {
                if array[i] + array[j] + array[k] % 3 == 0 {
                    result += 1
                }
            }
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getMaxTriples(n: Int) -> Int {
    var maxTriples = 0
    for i in 1...n {
        for j in i+1...n {
            for k in j+1...n {
                if (i * i - i + 1) + (j * j - j + 1) + (k * k - k + 1) % 3 == 0 {
                    maxTriples += 1
                }
            }
        }
    }
    return maxTriples
}
```swift
// You are given a positive integer n. You have to create an integer array a of length n.
// For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
// Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, 
// and a[i] + a[j] + a[k] is a multiple of 3.
// Example :
// Explanation: 
// a = [1, 3, 7, 13, 21]
// The only valid triple is (1, 7, 13).
// getMaxTriples(n: 5) == 1
func getMaxTriples(n: Int) -> Int {
    var maxTriples = 0
    for i in 1...n {
        for j in i+1...n {
            for k in j+1...n {
                if (i * i - i + 1) + (j * j - j + 1) + (k * k - k + 1) % 3 == 0 {
                    maxTriples += 1
                }
            }
        }
    }
    return maxTriples
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func getMaxTriples(n: Int) -> Int {
    var maxTriples = 0
    var array = [Int]()
    for i in 1...n {
        array.append(i * i - i + 1)
    }
    for i in 0..<array.count {
        for j in i + 1..<array.count {
            for k in j + 1..<array.count {
                if array[i] + array[j] + array[k] % 3 == 0 {
                    maxTriples += 1
                }
            }
        }
    }
    return maxTriples
}
```swift
// You are given a positive integer n. You have to create an integer array a of length n.
// For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
// Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, 
// and a[i] + a[j] + a[k] is a multiple of 3.
// Example :
// Explanation: 
// a = [1, 3, 7, 13, 21]
// The only valid triple is (1, 7, 13).
// getMaxTriples(n: 5) == 1
func getMaxTriples(n: Int) -> Int {
    var maxTriples = 0
    var array = [Int]()
    for i in 1...n {
        array.append(i * i - i + 1)
    }
    for i in 0..<array.count {
        for j in i + 1..<array.count {
            for k in j + 1..<array.count {
                if array[i] + array[j] + array[k] % 3 == 0 {
                    maxTriples += 1
                }
            }
        }
    }
    return maxTriples
}
```
 // XCTAssertTrue failed

func getMaxTriples(n: Int) -> Int {
    var result = 0
    for i in 1...n {
        for j in i+1...n {
            for k in j+1...n {
                if i + j + k == 0 || (i + j + k) % 3 != 0 {
                    continue
                }
                result += 1
            }
        }
    }
    return result
}
```swift
// You are given a positive integer n. You have to create an integer array a of length n.
// For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
// Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, 
// and a[i] + a[j] + a[k] is a multiple of 3.
// Example :
// Explanation: 
// a = [1, 3, 7, 13, 21]
// The only valid triple is (1, 7, 13).
// getMaxTriples(n: 5) == 1
func getMaxTriples(n: Int) -> Int {
    var result = 0
    for i in 1...n {
        for j in i+1...n {
            for k in j+1...n {
                if i + j + k == 0 || (i + j + k) % 3 != 0 {
                    continue
                }
                result += 1
            }
        }
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func getMaxTriples(n: Int) -> Int {
    var result = 0
    var array = [Int]()
    for i in 1...n {
        array.append(i * i - i + 1)
    }
    for i in 0..<array.count {
        for j in i + 1..<array.count {
            for k in j + 1..<array.count {
                if array[i] + array[j] + array[k] % 3 == 0 {
                    result += 1
                }
            }
        }
    }
    return result
}
```swift
// You are given a positive integer n. You have to create an integer array a of length n.
// For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
// Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, 
// and a[i] + a[j] + a[k] is a multiple of 3.
// Example :
// Explanation: 
// a = [1, 3, 7, 13, 21]
// The only valid triple is (1, 7, 13).
// getMaxTriples(n: 5) == 1
func getMaxTriples(n: Int) -> Int {
    var result = 0
    var array = [Int]()
    for i in 1...n {
        array.append(i * i - i + 1)
    }
    for i in 0..<array.count {
        for j in i + 1..<array.count {
            for k in j + 1..<array.count {
                if array[i] + array[j] + array[k] % 3 == 0 {
                    result += 1
                }
            }
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getMaxTriples(n: Int) -> Int {
    var max = 0
    for i in 1...n {
        for j in i+1...n {
            for k in j+1...n {
                if (i * i - i + 1) + (j * j - j + 1) + (k * k - k + 1) % 3 == 0 {
                    max += 1
                }
            }
        }
    }
    return max
}
```swift
// You are given a positive integer n. You have to create an integer array a of length n.
// For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
// Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, 
// and a[i] + a[j] + a[k] is a multiple of 3.
// Example :
// Explanation: 
// a = [1, 3, 7, 13, 21]
// The only valid triple is (1, 7, 13).
// getMaxTriples(n: 5) == 1
func getMaxTriples(n: Int) -> Int {
    var max = 0
    for i in 1...n {
        for j in i+1...n {
            for k in j+1...n {
                if (i * i - i + 1) + (j * j - j + 1) + (k * k - k + 1) % 3 == 0 {
                    max += 1
                }
            }
        }
    }
    return max
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func getMaxTriples(n: Int) -> Int {
    var a = [Int]()
    for i in 1...n {
        a.append(i * i - i + 1)
    }
    var count = 0
    for i in 0..<n {
        for j in i+1..<n {
            for k in j+1..<n {
                if a[i] + a[j] + a[k] % 3 == 0 {
                    count += 1
                }
            }
        }
    }
    return count
}
```swift
// You are given a positive integer n. You have to create an integer array a of length n.
// For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
// Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, 
// and a[i] + a[j] + a[k] is a multiple of 3.
// Example :
// Explanation: 
// a = [1, 3, 7, 13, 21]
// The only valid triple is (1, 7, 13).
// getMaxTriples(n: 5) == 1
func getMaxTriples(n: Int) -> Int {
    var a = [Int]()
    for i in 1...n {
        a.append(i * i - i + 1)
    }
    var count = 0
    for i in 0..<n {
        for j in i+1..<n {
            for k in j+1..<n {
                if a[i] + a[j] + a[k] % 3 == 0 {
                    count += 1
                }
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    // Your code goes here
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    // Your code goes here
}
```
} // missing return in global function expected to return '[String]'

func sortedListSum(lst: [String]) -> [String] {
    let sorted = lst.sorted { $0.count < $1.count }
    var result = [String]()
    for string in sorted {
        if string.count % 2 == 0 {
            result.append(string)
        }
    }
    return result.sorted()
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    let sorted = lst.sorted { $0.count < $1.count }
    var result = [String]()
    for string in sorted {
        if string.count % 2 == 0 {
            result.append(string)
        }
    }
    return result.sorted()
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    let sorted = lst.sorted { $0.count < $1.count }
    return sorted.filter { $0.count % 2 == 0 }
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    let sorted = lst.sorted { $0.count < $1.count }
    return sorted.filter { $0.count % 2 == 0 }
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    return lst.sorted {
        if $0.count != $1.count {
            return $0.count < $1.count
        } else {
            return $0 < $1
        }
    }
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    return lst.sorted {
        if $0.count != $1.count {
            return $0.count < $1.count
        } else {
            return $0 < $1
        }
    }
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    return lst.sorted { $0.count % 2 == 0 && $1.count % 2 == 0 ? $0 < $1 : $0.count % 2 == 0 }
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    return lst.sorted { $0.count % 2 == 0 && $1.count % 2 == 0 ? $0 < $1 : $0.count % 2 == 0 }
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    var result = lst
    result.sort { (a, b) -> Bool in
        return a.count < b.count
    }
    return result
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    var result = lst
    result.sort { (a, b) -> Bool in
        return a.count < b.count
    }
    return result
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    return lst.filter { $0.count % 2 == 0 }.sorted()
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    return lst.filter { $0.count % 2 == 0 }.sorted()
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    let sortedList = lst.sorted { $0.count < $1.count }
    return sortedList.filter { $0.count % 2 == 0 }
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    let sortedList = lst.sorted { $0.count < $1.count }
    return sortedList.filter { $0.count % 2 == 0 }
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    var result = [String]()
    for word in lst {
        if word.count % 2 == 0 {
            result.append(word)
        }
    }
    return result.sorted(by: { $0.count < $1.count })
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    var result = [String]()
    for word in lst {
        if word.count % 2 == 0 {
            result.append(word)
        }
    }
    return result.sorted(by: { $0.count < $1.count })
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    var result = [String]()
    for word in lst {
        if word.count % 2 == 0 {
            result.append(word)
        }
    }
    return result.sorted()
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    var result = [String]()
    for word in lst {
        if word.count % 2 == 0 {
            result.append(word)
        }
    }
    return result.sorted()
}
```
 // XCTAssertTrue failed

func xOrY(n: Int, x: Int, y: Int) -> Int {
    // Your code here
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    // Your code here
}
```
} // missing return in global function expected to return 'Int'

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n == 2 {
        return x
    }
    if n % 2 == 0 {
        return y
    }
    return x
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n == 2 {
        return x
    }
    if n % 2 == 0 {
        return y
    }
    return x
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n == 2 {
        return x
    }
    if n % 2 == 0 {
        return y
    }
    return x
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n == 2 {
        return x
    }
    if n % 2 == 0 {
        return y
    }
    return x
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n == 2 {
        return x
    }
    if n % 2 == 0 {
        return y
    }
    return x
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n == 2 {
        return x
    }
    if n % 2 == 0 {
        return y
    }
    return x
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n == 2 {
        return x
    }
    if n % 2 == 0 {
        return y
    }
    return x
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n == 2 {
        return x
    }
    if n % 2 == 0 {
        return y
    }
    return x
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int
 // XCTAssertTrue failed

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n % 2 == 0 || n % 3 == 0 {
        return y
    } else {
        return x
    }
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n % 2 == 0 || n % 3 == 0 {
        return y
    } else {
        return x
    }
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n % 2 == 0 || n % 3 == 0 {
        return y
    } else {
        return x
    }
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n % 2 == 0 || n % 3 == 0 {
        return y
    } else {
        return x
    }
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n % 2 == 0 || n % 3 == 0 {
        return y
    } else {
        return x
    }
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n % 2 == 0 || n % 3 == 0 {
        return y
    } else {
        return x
    }
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n % 2 == 0 || n % 3 == 0 {
        return y
    } else {
        return x
    }
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n % 2 == 0 || n % 3 == 0 {
        return y
    } else {
        return x
    }
}

// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
   
 // XCTAssertTrue failed

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n % 7 == 0 {
        return y
    } else {
        return x
    }
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n % 7 == 0 {
        return y
    } else {
        return x
    }
}
```
 // XCTAssertTrue failed

```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n == 1 {
        return x
    }
    if n == 2 {
        return x
    }
    if n == 3 {
        return x
    }
    if n == 4 {
        return y
    }
    if n == 5 {
        return x
    }
    if n == 6 {
        return y
    }
    if n == 7 {
        return x
    }
    if n == 8 {
        return y
    }
    if n == 9 {
        return y
    }
    if n == 10 {
        return y
    }
    if n == 11 {
        return x
    }
    if n == 12 {
        return y
    }
    if n == 13 {
        return x
    }
    if n == 14 {
        return y
    }
    if n == 15 {
        return y
    }
    if n == 16 {
        return y
    }
    if n == 17 {
        return x
    }
    if n == 18 {
        return y
    }
    if n == 19 {
        return y
    }
    if n == 20 {
        return y
    }
    if n == 21 {
        return x
    }
    if n == 22 {
        return y
    }
    if n == 23 {
        return x
    }
    if n == 24 {
        return y
    }
    if n == 25 {
        return y
    }
    if n == 26 {
        return y
    }
    if n == 27 {
        return x
    }
    if n == 28 {
        return y
    }
    if n == 29 {
        return y
    }
    if n == 30 {
        return y
    }
    if n == 31 {
        return y
    }
    if n == 32 {
        return y
    }
    if n == 33 {
        return x
    }
    if n == 34 {
        return x
    }
    if n == 35 {
        return y
    }
    if n == 36 {
        return y
    }
    if n == 37 {
        return x
    }
    if n == 38 {
        return y
    }
    if n == 39 {
        return y
    }
    if n == 40 {
        return y
    }
    if n == 41 {
        return x
    }
    if n == 42 {
        return y
    }
    if n == 43 {
        return y
    }
    if n == 44 {
        return y
    }
    if n == 45 {
        return x
    }
    if n == 46 {
        return y
    }
    if n == 47 {
        return y
    }
    if n == 48 {
        return y
    }
    if n == 49 {
        return y
    }
    if n == 50 {
        return y
    }
    if n == 51 {
        return x
    }
    if n == 52 {
        return y
    }
    if n == 53 {
        return x
    }
    if n == 54 {
        return y
    }
    if n == 55 {
        return y
    }
    if n == 56 {
        return y
    }
    if n == 57 {
        return x
    }
    if n == 58 {
        return y
    }
    if n == 59 {
        return y
    }
    if n == 60 {
        return y
    }
    if n == 61 {
        return y
    }
    if n == 62 {
        return x
    }
    if n == 63 {
        return y
    }
    if n == 64 {
        return y
    }
    if n == 65 {
XCTAssertTrue(xOrY(n: 7, x: 34, y: 12) == 34) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 15, x: 8, y: 5) == 5) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 3, x: 33, y: 5212) == 33) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 1259, x: 3, y: 52) == 3) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 7919, x: -1, y: 12) == -1) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 3609, x: 1245, y: 583) == 583) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 91, x: 56, y: 129) == 129) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 6, x: 34, y: 1234) == 1234) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 1, x: 2, y: 0) == 0) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 2, x: 2, y: 0) == 2) // cannot find 'xOrY' in scope

```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n == 1 {
        return x
    }
    if n == 2 {
        return x
    }
    if n == 3 {
        return x
    }
    if n == 4 {
        return y
    }
    if n == 5 {
        return x
    }
    if n == 6 {
        return y
    }
    if n == 7 {
        return x
    }
    if n == 8 {
        return y
    }
    if n == 9 {
        return y
    }
    if n == 10 {
        return y
    }
    if n == 11 {
        return x
    }
    if n == 12 {
        return y
    }
    if n == 13 {
        return x
    }
    if n == 14 {
        return y
    }
    if n == 15 {
        return y
    }
    if n == 16 {
        return y
    }
    if n == 17 {
        return x
    }
    if n == 18 {
        return y
    }
    if n == 19 {
        return y
    }
    if n == 20 {
        return y
    }
    if n == 21 {
        return x
    }
    if n == 22 {
        return y
    }
    if n == 23 {
        return x
    }
    if n == 24 {
        return y
    }
    if n == 25 {
        return y
    }
    if n == 26 {
        return y
    }
    if n == 27 {
        return x
    }
    if n == 28 {
        return y
    }
    if n == 29 {
        return y
    }
    if n == 30 {
        return y
    }
    if n == 31 {
        return y
    }
    if n == 32 {
        return y
    }
    if n == 33 {
        return x
    }
    if n == 34 {
        return x
    }
    if n == 35 {
        return y
    }
    if n == 36 {
        return y
    }
    if n == 37 {
        return x
    }
    if n == 38 {
        return y
    }
    if n == 39 {
        return y
    }
    if n == 40 {
        return y
    }
    if n == 41 {
        return x
    }
    if n == 42 {
        return y
    }
    if n == 43 {
        return y
    }
    if n == 44 {
        return y
    }
    if n == 45 {
        return x
    }
    if n == 46 {
        return y
    }
    if n == 47 {
        return y
    }
    if n == 48 {
        return y
    }
    if n == 49 {
        return y
    }
    if n == 50 {
        return y
    }
    if n == 51 {
        return x
    }
    if n == 52 {
        return y
    }
    if n == 53 {
        return x
    }
    if n == 54 {
        return y
    }
    if n == 55 {
        return y
    }
    if n == 56 {
        return y
    }
    if n == 57 {
        return x
    }
    if n == 58 {
        return y
    }
    if n == 59 {
        return y
    }
    if n == 60 {
        return y
    }
    if n == 61 {
        return y
    }
    if n == 62 {
        return x
    }
    if n == 63 {
        return y
    }
    if n == 64 {
        return y
    }
    if n == 65 {
XCTAssertTrue(xOrY(n: 7, x: 34, y: 12) == 34) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 15, x: 8, y: 5) == 5) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 3, x: 33, y: 5212) == 33) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 1259, x: 3, y: 52) == 3) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 7919, x: -1, y: 12) == -1) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 3609, x: 1245, y: 583) == 583) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 91, x: 56, y: 129) == 129) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 6, x: 34, y: 1234) == 1234) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 1, x: 2, y: 0) == 0) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 2, x: 2, y: 0) == 2) // cannot find 'xOrY' in scope

```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n == 1 {
        return x
    }
    if n == 2 {
        return x
    }
    if n == 3 {
        return x
    }
    if n == 4 {
        return y
    }
    if n == 5 {
        return x
    }
    if n == 6 {
        return y
    }
    if n == 7 {
        return x
    }
    if n == 8 {
        return y
    }
    if n == 9 {
        return y
    }
    if n == 10 {
        return y
    }
    if n == 11 {
        return x
    }
    if n == 12 {
        return y
    }
    if n == 13 {
        return x
    }
    if n == 14 {
        return y
    }
    if n == 15 {
        return y
    }
    if n == 16 {
        return y
    }
    if n == 17 {
        return x
    }
    if n == 18 {
        return y
    }
    if n == 19 {
        return y
    }
    if n == 20 {
        return y
    }
    if n == 21 {
        return y
    }
    if n == 22 {
        return y
    }
    if n == 23 {
        return x
    }
    if n == 24 {
        return y
    }
    if n == 25 {
        return y
    }
    if n == 26 {
        return y
    }
    if n == 27 {
        return y
    }
    if n == 28 {
        return y
    }
    if n == 29 {
        return y
    }
    if n == 30 {
        return y
    }
    if n == 31 {
        return y
    }
    if n == 32 {
        return y
    }
    if n == 33 {
        return x
    }
    if n == 34 {
        return x
    }
    if n == 35 {
        return y
    }
    if n == 36 {
        return y
    }
    if n == 37 {
        return y
    }
    if n == 38 {
        return y
    }
    if n == 39 {
        return y
    }
    if n == 40 {
        return y
    }
    if n == 41 {
        return y
    }
    if n == 42 {
        return y
    }
    if n == 43 {
        return y
    }
    if n == 44 {
        return y
    }
    if n == 45 {
        return y
    }
    if n == 46 {
        return y
    }
    if n == 47 {
        return y
    }
    if n == 48 {
        return y
    }
    if n == 49 {
        return y
    }
    if n == 50 {
        return y
    }
    if n == 51 {
        return y
    }
    if n == 52 {
        return y
    }
    if n == 53 {
        return y
    }
    if n == 54 {
        return y
    }
    if n == 55 {
        return y
    }
    if n == 56 {
        return y
    }
    if n == 57 {
        return y
    }
    if n == 58 {
        return y
    }
    if n == 59 {
        return y
    }
    if n == 60 {
        return y
    }
    if n == 61 {
        return y
    }
    if n == 62 {
        return y
    }
    if n == 63 {
        return y
    }
    if n == 64 {
        return y
    }
    if n == 65 {
XCTAssertTrue(xOrY(n: 7, x: 34, y: 12) == 34) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 15, x: 8, y: 5) == 5) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 3, x: 33, y: 5212) == 33) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 1259, x: 3, y: 52) == 3) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 7919, x: -1, y: 12) == -1) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 3609, x: 1245, y: 583) == 583) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 91, x: 56, y: 129) == 129) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 6, x: 34, y: 1234) == 1234) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 1, x: 2, y: 0) == 0) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 2, x: 2, y: 0) == 2) // cannot find 'xOrY' in scope

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n % 2 == 0 {
        return y
    } else {
        return x
    }
}
```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n % 2 == 0 {
        return y
    } else {
        return x
    }
}
```
 // XCTAssertTrue failed

```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n == 2 {
        return x
    }
    if n % 2 == 0 {
        return y
    }
    if n % 3 == 0 {
        return y
    }
    if n % 5 == 0 {
        return y
    }
    if n % 7 == 0 {
        return y
    }
    if n % 11 == 0 {
        return y
    }
    if n % 13 == 0 {
        return y
    }
    if n % 17 == 0 {
        return y
    }
    if n % 19 == 0 {
        return y
    }
    if n % 23 == 0 {
        return y
    }
    if n % 29 == 0 {
        return y
    }
    if n % 31 == 0 {
        return y
    }
    if n % 37 == 0 {
        return y
    }
    if n % 41 == 0 {
        return y
    }
    if n % 43 == 0 {
        return y
    }
    if n % 47 == 0 {
        return y
    }
    if n % 53 == 0 {
        return y
    }
    if n % 59 == 0 {
        return y
    }
    if n % 61 == 0 {
        return y
    }
    if n % 67 == 0 {
        return y
    }
    if n % 71 == 0 {
        return y
    }
    if n % 73 == 0 {
        return y
    }
    if n % 79 == 0 {
        return y
    }
    if n % 83 == 0 {
        return y
    }
    if n % 89 == 0 {
        return y
    }
    if n % 97 == 0 {
        return y
    }
    if n % 101 == 0 {
        return y
    }
    if n % 103 == 0 {
        return y
    }
    if n % 107 == 0 {
        return y
    }
    if n % 109 == 0 {
        return y
    }
    if n % 113 == 0 {
        return y
    }
    if n % 127 == 0 {
        return y
    }
    if n % 131 == 0 {
        return y
    }
    if n % 137 == 0 {
        return y
    }
    if n % 139 == 0 {
        return y
    }
    if n % 149 == 0 {
        return y
    }
    if n % 151 == 0 {
        return y
    }
    if n % 157 == 0 {
        return y
    }
    if n % 163 == 0 {
        return y
    }
    if n % 167 == 0 {
        return y
    }
    if n % 173 == 0 {
        return y
    }
    if n % 179 == 0 {
        return y
    }
    if n % 181 == 0 {
        return y
    }
    if n % 191 == 0 {
        return y
    }
    if n % 193 == 0 {
        return y
    }
    if n % 197 == 0 {
        return y
    }
    if n % 199 == 0 {
        return y
    }
    if n % 211 == 0 {
        return y
    }
    if n % 223 == 0 {
        return y
    }
    if n % 227 == 0 {
        return y
    }
    if n % 229 == 0 {
        return y
    }
    if n % 233 == 0 {
        return y
    }
    if n % 239 == 0 {
        return y
XCTAssertTrue(xOrY(n: 7, x: 34, y: 12) == 34) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 15, x: 8, y: 5) == 5) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 3, x: 33, y: 5212) == 33) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 1259, x: 3, y: 52) == 3) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 7919, x: -1, y: 12) == -1) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 3609, x: 1245, y: 583) == 583) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 91, x: 56, y: 129) == 129) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 6, x: 34, y: 1234) == 1234) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 1, x: 2, y: 0) == 0) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 2, x: 2, y: 0) == 2) // cannot find 'xOrY' in scope

```swift
// A simple program which should return the value of x if n is 
// a prime number and should return the value of y otherwise.
// Examples:
// xOrY(n: 7, x: 34, y: 12) == 34
// xOrY(n: 15, x: 8, y: 5) == 5
func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n == 1 {
        return x
    }
    if n == 2 {
        return x
    }
    if n == 3 {
        return x
    }
    if n == 4 {
        return y
    }
    if n == 5 {
        return x
    }
    if n == 6 {
        return y
    }
    if n == 7 {
        return x
    }
    if n == 8 {
        return y
    }
    if n == 9 {
        return y
    }
    if n == 10 {
        return y
    }
    if n == 11 {
        return x
    }
    if n == 12 {
        return y
    }
    if n == 13 {
        return x
    }
    if n == 14 {
        return y
    }
    if n == 15 {
        return y
    }
    if n == 16 {
        return y
    }
    if n == 17 {
        return x
    }
    if n == 18 {
        return y
    }
    if n == 19 {
        return y
    }
    if n == 20 {
        return y
    }
    if n == 21 {
        return y
    }
    if n == 22 {
        return y
    }
    if n == 23 {
        return x
    }
    if n == 24 {
        return y
    }
    if n == 25 {
        return y
    }
    if n == 26 {
        return y
    }
    if n == 27 {
        return y
    }
    if n == 28 {
        return y
    }
    if n == 29 {
        return x
    }
    if n == 30 {
        return y
    }
    if n == 31 {
        return y
    }
    if n == 32 {
        return y
    }
    if n == 33 {
        return y
    }
    if n == 34 {
        return x
    }
    if n == 35 {
        return y
    }
    if n == 36 {
        return y
    }
    if n == 37 {
        return y
    }
    if n == 38 {
        return y
    }
    if n == 39 {
        return y
    }
    if n == 40 {
        return y
    }
    if n == 41 {
        return y
    }
    if n == 42 {
        return y
    }
    if n == 43 {
        return x
    }
    if n == 44 {
        return y
    }
    if n == 45 {
        return y
    }
    if n == 46 {
        return y
    }
    if n == 47 {
        return y
    }
    if n == 48 {
        return y
    }
    if n == 49 {
        return y
    }
    if n == 50 {
        return y
    }
    if n == 51 {
        return y
    }
    if n == 52 {
        return y
    }
    if n == 53 {
        return y
    }
    if n == 54 {
        return y
    }
    if n == 55 {
        return y
    }
    if n == 56 {
        return y
    }
    if n == 57 {
        return y
    }
    if n == 58 {
        return y
    }
    if n == 59 {
        return y
    }
    if n == 60 {
        return y
    }
    if n == 61 {
        return y
    }
    if n == 62 {
        return y
    }
    if n == 63 {
        return y
    }
    if n == 64 {
        return y
    }
    if n == 65 {
XCTAssertTrue(xOrY(n: 7, x: 34, y: 12) == 34) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 15, x: 8, y: 5) == 5) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 3, x: 33, y: 5212) == 33) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 1259, x: 3, y: 52) == 3) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 7919, x: -1, y: 12) == -1) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 3609, x: 1245, y: 583) == 583) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 91, x: 56, y: 129) == 129) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 6, x: 34, y: 1234) == 1234) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 1, x: 2, y: 0) == 0) // cannot find 'xOrY' in scope
XCTAssertTrue(xOrY(n: 2, x: 2, y: 0) == 2) // cannot find 'xOrY' in scope

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number > 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number > 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```
sum += number * number // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number > 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number > 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```
sum += number * number // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number > 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number > 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```
sum += number * number // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number >= 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number >= 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```
sum += number * number // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number > 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number > 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```
sum += number * number // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number > 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number > 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```
sum += number * number // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        if num.truncatingRemainder(dividingBy: 2) == 1 {
            sum += num * num
        }
    }
    return sum
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        if num.truncatingRemainder(dividingBy: 2) == 1 {
            sum += num * num
        }
    }
    return sum
}
```
sum += num * num // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number >= 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```swift
// Given an array of numbers, return the sum of squares of the numbers
// in the array that are odd. Ignore numbers that are negative or not integers.
// If the input array is empty, return 0.
// doubleTheDifference(lst: [1, 3, 2, 0]) == 10
// doubleTheDifference(lst: [-1, -2, 0]) == 0
// doubleTheDifference(lst: [9, -2]) == 81
// doubleTheDifference(lst: [0]) == 0
func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for number in lst {
        if number >= 0 && number.truncatingRemainder(dividingBy: 2) == 1 {
            sum += number * number
        }
    }
    return sum
}
```
sum += number * number // cannot convert value of type 'Double' to expected argument type 'Int'