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 {
    var closeElements = false
    for i in 0..<numbers.count {
        for j in 0..<numbers.count {
            if i!= j && abs(numbers[i] - numbers[j]) < threshold {
                closeElements = true
                break
            }
        }
        if closeElements {
            break
        }
    }
    return closeElements
}
```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 {
    var closeElements = false
    for i in 0..<numbers.count {
        for j in 0..<numbers.count {
            if i!= j && abs(numbers[i] - numbers[j]) < threshold {
                closeElements = true
                break
            }
        }
        if closeElements {
            break
        }
    }
    return closeElements
}
```
if i!= j && abs(numbers[i] - numbers[j]) < threshold { // cannot assign value of type 'Bool' to type 'Int'
if i!= j && abs(numbers[i] - numbers[j]) < threshold { // cannot force unwrap value of non-optional type 'Int'
if i!= j && abs(numbers[i] - numbers[j]) < threshold { // '=' must have consistent whitespace on both sides
if i!= j && abs(numbers[i] - numbers[j]) < threshold { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if i!= j && abs(numbers[i] - numbers[j]) < threshold { // use of '=' in a boolean context, did you mean '=='?

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in (i+1)...(numbers.count-1) {
            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-1) {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```
 // Fatal error: Range requires lowerBound <= upperBound

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 {
    for i in 0..<numbers.count {
        for j in (i + 1)...(numbers.count - 1) {
            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 - 1) {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    var closeElements = false
    for i in 0..<numbers.count {
        for j in (i+1)...(numbers.count-1) {
            if abs(numbers[i] - numbers[j]) < threshold {
                closeElements = true
                break
            }
        }
        if closeElements {
            break
        }
    }
    return closeElements
}
```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 {
    var closeElements = false
    for i in 0..<numbers.count {
        for j in (i+1)...(numbers.count-1) {
            if abs(numbers[i] - numbers[j]) < threshold {
                closeElements = true
                break
            }
        }
        if closeElements {
            break
        }
    }
    return closeElements
}
```
 // Fatal error: Range requires lowerBound <= upperBound

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 {
    var closeElements = false
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                closeElements = true
                break
            }
        }
        if closeElements {
            break
        }
    }
    return closeElements
}
```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 {
    var closeElements = false
    for i in 0..<numbers.count {
        for j in i+1..<numbers.count {
            if abs(numbers[i] - numbers[j]) < threshold {
                closeElements = true
                break
            }
        }
        if closeElements {
            break
        }
    }
    return closeElements
}
```

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count {
        for j in (i + 1)...(numbers.count - 1) {
            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 - 1) {
            if abs(numbers[i] - numbers[j]) < threshold {
                return true
            }
        }
    }
    return false
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func separateParenGroups(parenString: String) -> [String] {
    // TODO: Implement this function
}
```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
}
```
} // missing return in global function expected to return '[String]'

func separateParenGroups(parenString: String) -> [String] {
    // TODO: implement this function
}
```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
}
```
} // missing return in global function expected to return '[String]'

func separateParenGroups(parenString: String) -> [String] {
    // TODO: implement this function
}
```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
}
```
} // missing return in global function expected to return '[String]'

func separateParenGroups(parenString: String) -> [String] {
    // TODO: Implement this function
}
```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
}
```
} // missing return in global function expected to return '[String]'

func separateParenGroups(parenString: String) -> [String] {
    // TODO: Implement this function
}
```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
}
```
} // missing return in global function expected to return '[String]'

func separateParenGroups(parenString: String) -> [String] {
    var parenStack = [String]()
    var result = [String]()
    var index = 0
    var parenStringLength = parenString.characters.count
    while index < parenStringLength {
        if parenString[index] == "(" {
            parenStack.append("(")
        } else if parenString[index] == ")" {
            if parenStack.count == 0 {
                result.append(parenString[index])
            } else {
                parenStack.removeLast()
            }
        }
        index += 1
    }
    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 parenStack = [String]()
    var result = [String]()
    var index = 0
    var parenStringLength = parenString.characters.count
    while index < parenStringLength {
        if parenString[index] == "(" {
            parenStack.append("(")
        } else if parenString[index] == ")" {
            if parenStack.count == 0 {
                result.append(parenString[index])
            } else {
                parenStack.removeLast()
            }
        }
        index += 1
    }
    return result
}
```
var parenStringLength = parenString.characters.count // 'characters' is unavailable: Please use String directly
if parenString[index] == "(" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
} else if parenString[index] == ")" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
result.append(parenString[index]) // cannot convert value of type 'Character' to expected argument type 'String'

func separateParenGroups(parenString: String) -> [String] {
    var parenStack = [String]()
    var result = [String]()
    for character in parenString {
        if character == "(" {
            parenStack.append(character)
        } else if character == ")" {
            let lastParen = parenStack.removeLast()
            if lastParen == "(" {
                result.append(String(lastParen))
            } else {
                let paren = String(lastParen) + String(character)
                result.append(paren)
            }
        }
    }
    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 parenStack = [String]()
    var result = [String]()
    for character in parenString {
        if character == "(" {
            parenStack.append(character)
        } else if character == ")" {
            let lastParen = parenStack.removeLast()
            if lastParen == "(" {
                result.append(String(lastParen))
            } else {
                let paren = String(lastParen) + String(character)
                result.append(paren)
            }
        }
    }
    return result
}
```
parenStack.append(character) // cannot convert value of type 'Character' to expected argument type 'String'

func separateParenGroups(parenString: String) -> [String] {
    // TODO: implement me!
}
```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 me!
}
```
} // missing return in global function expected to return '[String]'

func separateParenGroups(parenString: String) -> [String] {
    // TODO: implement this function
}
```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
}
```
} // missing return in global function expected to return '[String]'

func separateParenGroups(parenString: String) -> [String] {
    var parenStack = [String]()
    var result = [String]()
    var index = 0
    while index < parenString.characters.count {
        let character = parenString.characters[index]
        switch character {
        case "(":
            parenStack.append("(")
        case ")":
            if parenStack.count > 0 {
                parenStack.removeLast()
            }
        default:
            break
        }
        if parenStack.count == 0 {
            let subString = parenString.substringFromIndex(index)
            let subStringRange = subString.rangeOfString("()")
            if subStringRange.location!= NSNotFound {
                result.append(subString.substringWithRange(subStringRange))
            }
        }
        index += 1
    }
    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 parenStack = [String]()
    var result = [String]()
    var index = 0
    while index < parenString.characters.count {
        let character = parenString.characters[index]
        switch character {
        case "(":
            parenStack.append("(")
        case ")":
            if parenStack.count > 0 {
                parenStack.removeLast()
            }
        default:
            break
        }
        if parenStack.count == 0 {
            let subString = parenString.substringFromIndex(index)
            let subStringRange = subString.rangeOfString("()")
            if subStringRange.location!= NSNotFound {
                result.append(subString.substringWithRange(subStringRange))
            }
        }
        index += 1
    }
    return result
}
```
while index < parenString.characters.count { // 'characters' is unavailable: Please use String directly
let character = parenString.characters[index] // 'characters' is unavailable: Please use String directly
let character = parenString.characters[index] // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
let subString = parenString.substringFromIndex(index) // value of type 'String' has no member 'substringFromIndex'
if subStringRange.location!= NSNotFound { // '=' must have consistent whitespace on both sides
if subStringRange.location!= NSNotFound { // use of '=' in a boolean context, did you mean '=='?

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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 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 {
        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 {
        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 {
        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 {
        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 meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / 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 = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / Double(numbers.count)
}
```
let mean = mean(numbers: numbers) // use of local variable 'mean' before its declaration

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / 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 = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / Double(numbers.count)
}
```
let mean = mean(numbers: numbers) // use of local variable 'mean' before its declaration

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / 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 = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / Double(numbers.count)
}
```
let mean = mean(numbers: numbers) // use of local variable 'mean' before its declaration

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / 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 = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / Double(numbers.count)
}
```
let mean = mean(numbers: numbers) // use of local variable 'mean' before its declaration

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = mean(numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / 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 = mean(numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / Double(numbers.count)
}
```
let mean = mean(numbers) // use of local variable 'mean' before its declaration

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / 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 = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / Double(numbers.count)
}
```
let mean = mean(numbers: numbers) // use of local variable 'mean' before its declaration

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / 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 = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / Double(numbers.count)
}
```
let mean = mean(numbers: numbers) // use of local variable 'mean' before its declaration

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / 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 = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / Double(numbers.count)
}
```
let mean = mean(numbers: numbers) // use of local variable 'mean' before its declaration

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / 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 = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / Double(numbers.count)
}
```
let mean = mean(numbers: numbers) // use of local variable 'mean' before its declaration

func meanAbsoluteDeviation(numbers: [Double]) -> Double {
    let mean = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / 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 = mean(numbers: numbers)
    var sum = 0.0
    for number in numbers {
        sum += abs(number - mean)
    }
    return sum / Double(numbers.count)
}
```
let mean = mean(numbers: numbers) // use of local variable 'mean' before its declaration

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerate() {
        if index == 0 {
            result.append(number)
        } else {
            result.append(delimeter)
            result.append(number)
        }
    }
    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.enumerate() {
        if index == 0 {
            result.append(number)
        } else {
            result.append(delimeter)
            result.append(number)
        }
    }
    return result
}
```
for (index, number) in numbers.enumerate() { // value of type '[Int]' has no member 'enumerate'

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<numbers.count {
        if i == 0 {
            result.append(numbers[i])
        } else {
            result.append(delimeter)
            result.append(numbers[i])
        }
    }
    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 i in 0..<numbers.count {
        if i == 0 {
            result.append(numbers[i])
        } else {
            result.append(delimeter)
            result.append(numbers[i])
        }
    }
    return result
}
```

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result: [Int] = []
    for i in 0..<numbers.count {
        if i == 0 {
            result.append(numbers[i])
        } else {
            result.append(delimeter)
            result.append(numbers[i])
        }
    }
    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 i in 0..<numbers.count {
        if i == 0 {
            result.append(numbers[i])
        } else {
            result.append(delimeter)
            result.append(numbers[i])
        }
    }
    return result
}
```

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<numbers.count - 1 {
        result.append(numbers[i])
        result.append(delimeter)
    }
    result.append(numbers[numbers.count - 1])
    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 i in 0..<numbers.count - 1 {
        result.append(numbers[i])
        result.append(delimeter)
    }
    result.append(numbers[numbers.count - 1])
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result: [Int] = []
    for (index, value) in numbers.enumerated() {
        if index == 0 {
            result.append(value)
        } else {
            result.append(delimeter)
            result.append(value)
        }
    }
    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, value) in numbers.enumerated() {
        if index == 0 {
            result.append(value)
        } else {
            result.append(delimeter)
            result.append(value)
        }
    }
    return result
}
```

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<numbers.count - 1 {
        result.append(numbers[i])
        result.append(delimeter)
    }
    result.append(numbers[numbers.count - 1])
    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 i in 0..<numbers.count - 1 {
        result.append(numbers[i])
        result.append(delimeter)
    }
    result.append(numbers[numbers.count - 1])
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<numbers.count {
        if i == 0 {
            result.append(numbers[i])
        } else {
            result.append(delimeter)
            result.append(numbers[i])
        }
    }
    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 i in 0..<numbers.count {
        if i == 0 {
            result.append(numbers[i])
        } else {
            result.append(delimeter)
            result.append(numbers[i])
        }
    }
    return result
}
```

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result: [Int] = []
    for i in 0..<numbers.count {
        if i == 0 {
            result.append(numbers[i])
        } else {
            result.append(delimeter)
            result.append(numbers[i])
        }
    }
    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 i in 0..<numbers.count {
        if i == 0 {
            result.append(numbers[i])
        } else {
            result.append(delimeter)
            result.append(numbers[i])
        }
    }
    return result
}
```

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<numbers.count {
        if i == 0 {
            result.append(numbers[i])
        } else {
            result.append(delimeter)
            result.append(numbers[i])
        }
    }
    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 i in 0..<numbers.count {
        if i == 0 {
            result.append(numbers[i])
        } else {
            result.append(delimeter)
            result.append(numbers[i])
        }
    }
    return result
}
```

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for i in 0..<numbers.count {
        if i == 0 {
            result.append(numbers[i])
        } else {
            result.append(delimeter)
            result.append(numbers[i])
        }
    }
    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 i in 0..<numbers.count {
        if i == 0 {
            result.append(numbers[i])
        } else {
            result.append(delimeter)
            result.append(numbers[i])
        }
    }
    return result
}
```

func parseNestedParens(parenString: String) -> [Int] {
    var parenStack: [Int] = []
    var parenLevel: Int = 0
    var parenLevels: [Int] = []
    for paren in parenString.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            parenStack.removeLast()
        }
        parenLevels.append(parenLevel)
    }
    return parenLevels
}
```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 parenStack: [Int] = []
    var parenLevel: Int = 0
    var parenLevels: [Int] = []
    for paren in parenString.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            parenStack.removeLast()
        }
        parenLevels.append(parenLevel)
    }
    return parenLevels
}
```
for paren in parenString.split(" ") { // no exact matches in call to instance method 'split'

func parseNestedParens(parenString: String) -> [Int] {
    var parenStack = [Int]()
    var result = [Int]()
    for paren in parenString.split(" ").map(String.init) {
        switch paren {
        case "(":
            parenStack.append(parenStack.count)
        case ")":
            parenStack.removeLast()
        default:
            let level = parenStack.count
            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 parenStack = [Int]()
    var result = [Int]()
    for paren in parenString.split(" ").map(String.init) {
        switch paren {
        case "(":
            parenStack.append(parenStack.count)
        case ")":
            parenStack.removeLast()
        default:
            let level = parenStack.count
            result.append(level)
        }
    }
    return result
}
```
for paren in parenString.split(" ").map(String.init) { // no exact matches in call to instance method 'split'

func parseNestedParens(parenString: String) -> [Int] {
    var parenStack = [Int]()
    var result = [Int]()
    for char in parenString.characters {
        switch char {
        case "(":
            parenStack.append(1)
        case ")":
            parenStack.removeLast()
        default:
            continue
        }
        if parenStack.isEmpty {
            result.append(parenStack.count)
        }
    }
    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 parenStack = [Int]()
    var result = [Int]()
    for char in parenString.characters {
        switch char {
        case "(":
            parenStack.append(1)
        case ")":
            parenStack.removeLast()
        default:
            continue
        }
        if parenStack.isEmpty {
            result.append(parenStack.count)
        }
    }
    return result
}
```
for char in parenString.characters { // 'characters' is unavailable: Please use String directly

func parseNestedParens(parenString: String) -> [Int] {
    var parenStack: [Int] = []
    var parenLevel: Int = 0
    var parenLevels: [Int] = []
    for paren in parenString.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            parenStack.removeLast()
        }
        parenLevels.append(parenLevel)
    }
    return parenLevels
}
```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 parenStack: [Int] = []
    var parenLevel: Int = 0
    var parenLevels: [Int] = []
    for paren in parenString.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            parenStack.removeLast()
        }
        parenLevels.append(parenLevel)
    }
    return parenLevels
}
```
for paren in parenString.split(" ") { // no exact matches in call to instance method 'split'

func parseNestedParens(parenString: String) -> [Int] {
    var parenStack: [Int] = []
    var parenLevel: Int = 0
    var parenLevels: [Int] = []
    for paren in parenString.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            parenLevels.append(parenStack.popLast()!)
        }
    }
    return parenLevels
}
```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 parenStack: [Int] = []
    var parenLevel: Int = 0
    var parenLevels: [Int] = []
    for paren in parenString.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            parenLevels.append(parenStack.popLast()!)
        }
    }
    return parenLevels
}
```
for paren in parenString.split(" ") { // no exact matches in call to instance method 'split'

func parseNestedParens(parenString: String) -> [Int] {
    var parenStack: [Int] = []
    var parenLevel: Int = 0
    var parenLevels: [Int] = []
    
    for paren in parenString.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            if parenLevel == parenStack.last! {
                parenStack.removeLast()
            }
        }
        
        if parenLevel > parenStack.last! {
            parenLevels.append(parenLevel)
        }
    }
    
    return parenLevels
}
```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 parenStack: [Int] = []
    var parenLevel: Int = 0
    var parenLevels: [Int] = []
    
    for paren in parenString.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            if parenLevel == parenStack.last! {
                parenStack.removeLast()
            }
        }
        
        if parenLevel > parenStack.last! {
            parenLevels.append(parenLevel)
        }
    }
    
    return parenLevels
}
```
for paren in parenString.split(" ") { // no exact matches in call to instance method 'split'

```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: Implement this function
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of the current level of nesting
    // Hint: You can use a stack to keep track of
XCTAssertTrue(parseNestedParens(parenString: "(()()) ((())) () ((())()())") == [2, 3, 1, 3]) // cannot find 'parseNestedParens' in scope
XCTAssertTrue(parseNestedParens(parenString: "() (()) ((())) (((())))") == [1, 2, 3, 4]) // cannot find 'parseNestedParens' in scope
XCTAssertTrue(parseNestedParens(parenString: "(()(())((())))") == [4]) // cannot find 'parseNestedParens' in scope

func parseNestedParens(parenString: String) -> [Int] {
    var parenStack: [Int] = []
    var parenLevel: Int = 0
    var parenLevels: [Int] = []
    for paren in parenString.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            if parenLevel < 0 {
                parenLevel = parenStack.popLast()!
            }
        }
        parenLevels.append(parenLevel)
    }
    return parenLevels
}
```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 parenStack: [Int] = []
    var parenLevel: Int = 0
    var parenLevels: [Int] = []
    for paren in parenString.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            if parenLevel < 0 {
                parenLevel = parenStack.popLast()!
            }
        }
        parenLevels.append(parenLevel)
    }
    return parenLevels
}
```
for paren in parenString.split(" ") { // no exact matches in call to instance method 'split'

func parseNestedParens(parenString: String) -> [Int] {
    var result: [Int] = []
    var stack: [Int] = []
    var parenCount: Int = 0
    for paren in parenString.split(separator: " ") {
        if paren == "(" {
            parenCount += 1
            stack.append(parenCount)
        } else {
            parenCount -= 1
            stack.removeLast()
        }
        if parenCount == 0 {
            result.append(stack.count)
        }
    }
    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 parenCount: Int = 0
    for paren in parenString.split(separator: " ") {
        if paren == "(" {
            parenCount += 1
            stack.append(parenCount)
        } else {
            parenCount -= 1
            stack.removeLast()
        }
        if parenCount == 0 {
            result.append(stack.count)
        }
    }
    return result
}
```
 // Fatal error: Can't remove last element from an empty collection

func parseNestedParens(parenString: String) -> [Int] {
    var parenStack = [Int]()
    var parenLevels = [Int]()
    for paren in parenString.split(" ") {
        if paren.hasPrefix("(") {
            parenStack.append(parenLevels.count)
        } else if paren.hasSuffix(")") {
            let parenIndex = parenStack.last!
            parenStack.removeLast()
            parenLevels.append(parenLevels.count - parenIndex)
        }
    }
    return parenLevels
}
```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 parenStack = [Int]()
    var parenLevels = [Int]()
    for paren in parenString.split(" ") {
        if paren.hasPrefix("(") {
            parenStack.append(parenLevels.count)
        } else if paren.hasSuffix(")") {
            let parenIndex = parenStack.last!
            parenStack.removeLast()
            parenLevels.append(parenLevels.count - parenIndex)
        }
    }
    return parenLevels
}
```
for paren in parenString.split(" ") { // no exact matches in call to instance method 'split'

func filterBySubstring(strings: [String], substring: String) -> [String] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```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] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```
if string.containsString(substring) { // value of type 'String' has no member 'containsString'

func filterBySubstring(strings: [String], substring: String) -> [String] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```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] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```
if string.containsString(substring) { // value of type 'String' has no member 'containsString'

func filterBySubstring(strings: [String], substring: String) -> [String] {
    var result = [String]()
    for string in strings {
        if string.containsString(substring) {
            result.append(string)
        }
    }
    return result
}
```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] {
    var result = [String]()
    for string in strings {
        if string.containsString(substring) {
            result.append(string)
        }
    }
    return result
}
```
if string.containsString(substring) { // value of type 'String' has no member 'containsString'

func filterBySubstring(strings: [String], substring: String) -> [String] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```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] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```
if string.containsString(substring) { // value of type 'String' has no member 'containsString'

func filterBySubstring(strings: [String], substring: String) -> [String] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```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] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```
if string.containsString(substring) { // value of type 'String' has no member 'containsString'

func filterBySubstring(strings: [String], substring: String) -> [String] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```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] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```
if string.containsString(substring) { // value of type 'String' has no member 'containsString'

func filterBySubstring(strings: [String], substring: String) -> [String] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```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] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```
if string.containsString(substring) { // value of type 'String' has no member 'containsString'

func filterBySubstring(strings: [String], substring: String) -> [String] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```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] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```
if string.containsString(substring) { // value of type 'String' has no member 'containsString'

func filterBySubstring(strings: [String], substring: String) -> [String] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```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] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```
if string.containsString(substring) { // value of type 'String' has no member 'containsString'

func filterBySubstring(strings: [String], substring: String) -> [String] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```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] {
    var filteredStrings = [String]()
    for string in strings {
        if string.containsString(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```
if string.containsString(substring) { // value of type 'String' has no member 'containsString'

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 = 0
    var result = [Int]()
    for i in 0..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        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 = 0
    var result = [Int]()
    for i in 0..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        result.append(max)
    }
    return result
}
```

func rollingMax(numbers: [Int]) -> [Int] {
    var max = 0
    var result = [Int]()
    for i in 0..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        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 = 0
    var result = [Int]()
    for i in 0..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        result.append(max)
    }
    return result
}
```

func rollingMax(numbers: [Int]) -> [Int] {
    var max = 0
    var maxes = [Int]()
    for number in numbers {
        if number > max {
            max = number
        }
        maxes.append(max)
    }
    return maxes
}
```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 = 0
    var maxes = [Int]()
    for number in numbers {
        if number > max {
            max = number
        }
        maxes.append(max)
    }
    return maxes
}
```

func rollingMax(numbers: [Int]) -> [Int] {
    var max = 0
    var result: [Int] = []
    for i in 0..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        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 = 0
    var result: [Int] = []
    for i in 0..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        result.append(max)
    }
    return result
}
```

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 rollingMax(numbers: [Int]) -> [Int] {
    var max = 0
    var result = [Int]()
    for i in 0..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        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 = 0
    var result = [Int]()
    for i in 0..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        result.append(max)
    }
    return result
}
```

func rollingMax(numbers: [Int]) -> [Int] {
    var max = 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 = 0
    var result = [Int]()
    for number in numbers {
        if number > max {
            max = number
        }
        result.append(max)
    }
    return result
}
```

func rollingMax(numbers: [Int]) -> [Int] {
    var result: [Int] = []
    var max: Int = 0
    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 result: [Int] = []
    var max: Int = 0
    for number in numbers {
        if number > max {
            max = number
        }
        result.append(max)
    }
    return result
}
```

func rollingMax(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var max = Int.min
    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 result = [Int]()
    var max = Int.min
    for number in numbers {
        if number > max {
            max = number
        }
        result.append(max)
    }
    return result
}
```

func rollingMax(numbers: [Int]) -> [Int] {
    var max = 0
    var result = [Int]()
    for i in 0..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        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 = 0
    var result = [Int]()
    for i in 0..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        result.append(max)
    }
    return result
}
```

func makePalindrome(string: String) -> String {
    var palindrome = string
    var reversed = string.reversed()
    var suffix = string
    var prefix = ""
    
    while suffix.hasPrefix(reversed) {
        suffix = suffix.dropFirst()
        reversed = reversed.dropLast()
    }
    
    while!suffix.isEmpty {
        prefix += String(reversed.first!)
        suffix = suffix.dropFirst()
        reversed = reversed.dropLast()
    }
    
    palindrome += reversed.reversed()
    palindrome += prefix
    
    return palindrome
}
```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 {
    var palindrome = string
    var reversed = string.reversed()
    var suffix = string
    var prefix = ""
    
    while suffix.hasPrefix(reversed) {
        suffix = suffix.dropFirst()
        reversed = reversed.dropLast()
    }
    
    while!suffix.isEmpty {
        prefix += String(reversed.first!)
        suffix = suffix.dropFirst()
        reversed = reversed.dropLast()
    }
    
    palindrome += reversed.reversed()
    palindrome += prefix
    
    return palindrome
}
```
while suffix.hasPrefix(reversed) { // 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'
reversed = reversed.dropLast() // no 'dropLast' candidates produce the expected contextual result type 'ReversedCollection<String>'
while!suffix.isEmpty { // expected expression, var, or let in 'while' condition

func makePalindrome(string: String) -> String {
    // Find the longest palindromic suffix of the supplied string.
    let palindromeSuffix = string.reversed().prefix(while: { $0 == string[$0.index] })
    // Find the shortest prefix of the supplied string that comes before the palindromic suffix.
    let prefix = string.prefix(until: string.index(before: palindromeSuffix.endIndex))
    // Append the reverse of the prefix to the end of the supplied string.
    return String(prefix) + String(palindromeSuffix.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 {
    // Find the longest palindromic suffix of the supplied string.
    let palindromeSuffix = string.reversed().prefix(while: { $0 == string[$0.index] })
    // Find the shortest prefix of the supplied string that comes before the palindromic suffix.
    let prefix = string.prefix(until: string.index(before: palindromeSuffix.endIndex))
    // Append the reverse of the prefix to the end of the supplied string.
    return String(prefix) + String(palindromeSuffix.reversed())
}
```
let palindromeSuffix = string.reversed().prefix(while: { $0 == string[$0.index] }) // value of type 'String.Element' (aka 'Character') has no member 'index'
let prefix = string.prefix(until: string.index(before: palindromeSuffix.endIndex)) // no exact matches in call to instance method 'prefix'

func makePalindrome(string: String) -> String {
    let reversed = string.reversed()
    let longestPalindromicSuffix = string.prefix(while: { reversed.hasPrefix($0) && isPalindrome(string: reversed) })
    let shortestPalindromicPrefix = string.suffix(while: { string.hasPrefix($0) && isPalindrome(string: string) })
    return String(longestPalindromicSuffix) + String(shortestPalindromicPrefix.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 {
    let reversed = string.reversed()
    let longestPalindromicSuffix = string.prefix(while: { reversed.hasPrefix($0) && isPalindrome(string: reversed) })
    let shortestPalindromicPrefix = string.suffix(while: { string.hasPrefix($0) && isPalindrome(string: string) })
    return String(longestPalindromicSuffix) + String(shortestPalindromicPrefix.reversed())
}
```
let longestPalindromicSuffix = string.prefix(while: { reversed.hasPrefix($0) && isPalindrome(string: reversed) }) // value of type 'ReversedCollection<String>' has no member 'hasPrefix'
let longestPalindromicSuffix = string.prefix(while: { reversed.hasPrefix($0) && isPalindrome(string: reversed) }) // cannot find 'isPalindrome' in scope
let shortestPalindromicPrefix = string.suffix(while: { string.hasPrefix($0) && isPalindrome(string: string) }) // cannot find 'isPalindrome' in scope
let shortestPalindromicPrefix = string.suffix(while: { string.hasPrefix($0) && isPalindrome(string: string) }) // no exact matches in call to instance method 'suffix'

func makePalindrome(string: String) -> String {
    let reversed = string.reversed()
    let longestPalindrome = string.prefix(while: { reversed.hasPrefix($0) })
    return String(longestPalindrome) + String(reversed.dropLast(longestPalindrome.count))
}
```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.reversed()
    let longestPalindrome = string.prefix(while: { reversed.hasPrefix($0) })
    return String(longestPalindrome) + String(reversed.dropLast(longestPalindrome.count))
}
```
let longestPalindrome = string.prefix(while: { reversed.hasPrefix($0) }) // value of type 'ReversedCollection<String>' has no member 'hasPrefix'

func makePalindrome(string: String) -> String {
    // Find the longest postfix of supplied string that is a palindrome.
    var palindrome = string
    var reversed = string.reversed()
    while palindrome.hasPrefix(reversed) {
        palindrome = palindrome.dropLast(reversed.count)
        reversed = reversed.dropFirst(reversed.count)
    }

    // Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
    return string + reversed.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 {
    // Find the longest postfix of supplied string that is a palindrome.
    var palindrome = string
    var reversed = string.reversed()
    while palindrome.hasPrefix(reversed) {
        palindrome = palindrome.dropLast(reversed.count)
        reversed = reversed.dropFirst(reversed.count)
    }

    // Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
    return string + reversed.reversed()
}
```
while palindrome.hasPrefix(reversed) { // cannot convert value of type 'ReversedCollection<String>' to expected argument type 'String'
palindrome = palindrome.dropLast(reversed.count) // no 'dropLast' candidates produce the expected contextual result type 'String'
reversed = reversed.dropFirst(reversed.count) // no 'dropFirst' candidates produce the expected contextual result type 'ReversedCollection<String>'

func makePalindrome(string: String) -> String {
    // Find the longest palindrome suffix.
    let suffix = string.reversed().dropFirstWhile { $0!= string.last }.reversed()
    // Find the longest palindrome prefix.
    let prefix = string.prefix(while: { $0!= string.first })
    // Append the prefix and the suffix in reverse order.
    return prefix + suffix.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 {
    // Find the longest palindrome suffix.
    let suffix = string.reversed().dropFirstWhile { $0!= string.last }.reversed()
    // Find the longest palindrome prefix.
    let prefix = string.prefix(while: { $0!= string.first })
    // Append the prefix and the suffix in reverse order.
    return prefix + suffix.reversed()
}
```
let suffix = string.reversed().dropFirstWhile { $0!= string.last }.reversed() // cannot assign through '!': '$0' is immutable
let suffix = string.reversed().dropFirstWhile { $0!= string.last }.reversed() // '=' must have consistent whitespace on both sides
let suffix = string.reversed().dropFirstWhile { $0!= string.last }.reversed() // reference to member 'dropFirstWhile' cannot be resolved without a contextual type
let prefix = string.prefix(while: { $0!= string.first }) // '=' must have consistent whitespace on both sides
let prefix = string.prefix(while: { $0!= string.first }) // value of optional type 'String.Element?' (aka 'Optional<Character>') must be unwrapped to a value of type 'String.Element' (aka 'Character')
let prefix = string.prefix(while: { $0!= string.first }) // cannot force unwrap value of non-optional type 'String.Element' (aka 'Character')
let prefix = string.prefix(while: { $0!= string.first }) // cannot convert value of type '()' to closure result type 'Bool'

func makePalindrome(string: String) -> String {
    var palindrome = string
    var reversed = string.reversed()
    while palindrome.hasSuffix(reversed) {
        palindrome += reversed
        reversed = reversed.dropLast()
    }
    return palindrome
}
```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 {
    var palindrome = string
    var reversed = string.reversed()
    while palindrome.hasSuffix(reversed) {
        palindrome += reversed
        reversed = reversed.dropLast()
    }
    return palindrome
}
```
while palindrome.hasSuffix(reversed) { // cannot convert value of type 'ReversedCollection<String>' to expected argument type 'String'
reversed = reversed.dropLast() // no 'dropLast' candidates produce the expected contextual result type 'ReversedCollection<String>'

func makePalindrome(string: String) -> String {
    var palindrome = string
    var reversed = string.reversed()
    
    while palindrome.hasSuffix(reversed) {
        palindrome += reversed
        reversed = string.prefix(reversed.count - 1).reversed()
    }
    
    return palindrome
}
```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 {
    var palindrome = string
    var reversed = string.reversed()
    
    while palindrome.hasSuffix(reversed) {
        palindrome += reversed
        reversed = string.prefix(reversed.count - 1).reversed()
    }
    
    return palindrome
}
```
while palindrome.hasSuffix(reversed) { // cannot convert value of type 'ReversedCollection<String>' to expected argument type 'String'
reversed = string.prefix(reversed.count - 1).reversed() // cannot assign value of type 'ReversedCollection<String.SubSequence>' (aka 'ReversedCollection<Substring>') to type 'ReversedCollection<String>'

func makePalindrome(string: String) -> String {
    // Find the longest palindromic suffix of the supplied string.
    let palindromicSuffix = string.reversed().prefix(while: { $0 == string[$0.index] })
    // Find the longest palindromic prefix of the supplied string.
    let palindromicPrefix = string.prefix(while: { $0 == string.reversed().$0 })
    // Append the reverse of the prefix to the end of the supplied string.
    return string + palindromicPrefix.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 {
    // Find the longest palindromic suffix of the supplied string.
    let palindromicSuffix = string.reversed().prefix(while: { $0 == string[$0.index] })
    // Find the longest palindromic prefix of the supplied string.
    let palindromicPrefix = string.prefix(while: { $0 == string.reversed().$0 })
    // Append the reverse of the prefix to the end of the supplied string.
    return string + palindromicPrefix.reversed()
}
```
let palindromicSuffix = string.reversed().prefix(while: { $0 == string[$0.index] }) // value of type 'String.Element' (aka 'Character') has no member 'index'
let palindromicPrefix = string.prefix(while: { $0 == string.reversed().$0 }) // expected member name following '.'

func makePalindrome(string: String) -> String {
    // Find the longest palindrome suffix.
    let suffix = string.reversed().prefix(while: {!$0.isEmpty })
    // Find the shortest palindrome prefix.
    let prefix = string.prefix(while: {!$0.isEmpty })
    // Append the prefix and suffix in reverse order.
    return String(prefix.reversed()) + 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 {
    // Find the longest palindrome suffix.
    let suffix = string.reversed().prefix(while: {!$0.isEmpty })
    // Find the shortest palindrome prefix.
    let prefix = string.prefix(while: {!$0.isEmpty })
    // Append the prefix and suffix in reverse order.
    return String(prefix.reversed()) + suffix
}
```
let suffix = string.reversed().prefix(while: {!$0.isEmpty }) // value of type 'String.Element' (aka 'Character') has no member 'isEmpty'
let prefix = string.prefix(while: {!$0.isEmpty }) // value of type 'String.Element' (aka 'Character') has no member 'isEmpty'

func stringXor(a: String, b: String) -> String {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'String'

func stringXor(a: String, b: String) -> String {
    var result = ""
    for (index, char) in a.enumerated() {
        if char == b[index] {
            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 {
    var result = ""
    for (index, char) in a.enumerated() {
        if char == b[index] {
            result.append("0")
        } else {
            result.append("1")
        }
    }
    return result
}
```
if char == b[index] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func stringXor(a: String, b: String) -> String {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'String'

func stringXor(a: String, b: String) -> String {
    return String(a.characters.map {
        if $0 == "0" {
            return "1"
        } else {
            return "0"
        }
    })
}
```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.characters.map {
        if $0 == "0" {
            return "1"
        } else {
            return "0"
        }
    })
}
```
return String(a.characters.map { // 'characters' is unavailable: Please use String directly

func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        if a[i] == b[i] {
            result += "0"
        } else {
            result += "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 {
    var result = ""
    for i in 0..<a.count {
        if a[i] == b[i] {
            result += "0"
        } else {
            result += "1"
        }
    }
    return result
}
```
if a[i] == b[i] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if a[i] == b[i] { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func stringXor(a: String, b: String) -> String {
    var result = ""
    for (index, value) in a.enumerated() {
        if value == "1" {
            if b[index] == "1" {
                result.append("0")
            } else {
                result.append("1")
            }
        } else {
            if b[index] == "1" {
                result.append("1")
            } else {
                result.append("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 (index, value) in a.enumerated() {
        if value == "1" {
            if b[index] == "1" {
                result.append("0")
            } else {
                result.append("1")
            }
        } else {
            if b[index] == "1" {
                result.append("1")
            } else {
                result.append("0")
            }
        }
    }
    return result
}
```
if b[index] == "1" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if b[index] == "1" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<max(a.count, b.count) {
        let aBit = a.count > i? a[i] : "0"
        let bBit = b.count > i? b[i] : "0"
        result += String(aBit.asciiValue.flatMap { $0 == "1"? "0" : "1" }.unicodeScalars.first!)
    }
    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 in 0..<max(a.count, b.count) {
        let aBit = a.count > i? a[i] : "0"
        let bBit = b.count > i? b[i] : "0"
        result += String(aBit.asciiValue.flatMap { $0 == "1"? "0" : "1" }.unicodeScalars.first!)
    }
    return result
}
```
let aBit = a.count > i? a[i] : "0" // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
let aBit = a.count > i? a[i] : "0" // consecutive statements on a line must be separated by ';'
let aBit = a.count > i? a[i] : "0" // consecutive statements on a line must be separated by ';'
let aBit = a.count > i? a[i] : "0" // cannot use optional chaining on non-optional value of type 'Int'
let aBit = a.count > i? a[i] : "0" // expression of type 'Character' is unused
let aBit = a.count > i? a[i] : "0" // expected expression
let aBit = a.count > i? a[i] : "0" // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
let bBit = b.count > i? b[i] : "0" // expected expression
let bBit = b.count > i? b[i] : "0" // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
let bBit = b.count > i? b[i] : "0" // cannot use optional chaining on non-optional value of type 'Int'
let bBit = b.count > i? b[i] : "0" // expression of type 'Character' is unused
let bBit = b.count > i? b[i] : "0" // consecutive statements on a line must be separated by ';'
let bBit = b.count > i? b[i] : "0" // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
let bBit = b.count > i? b[i] : "0" // consecutive statements on a line must be separated by ';'

func stringXor(a: String, b: String) -> String {
    // Your code here.
}
```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 {
    // Your code here.
}
```
} // missing return in global function expected to return 'String'

func stringXor(a: String, b: String) -> String {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'String'

func stringXor(a: String, b: String) -> String {
    // TODO: Implement this function.
}
```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 {
    // TODO: Implement this function.
}
```
} // missing return in global function expected to return 'String'

func longest(strings: [String]) -> String? {
    var longest: String?
    for string in strings {
        if longest == nil || 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? {
    var longest: String?
    for string in strings {
        if longest == nil || string.count > longest.count {
            longest = string
        }
    }
    return longest
}
```
if longest == nil || string.count > longest.count { // value of optional type 'String?' must be unwrapped to refer to member 'count' of wrapped base type 'String'

func longest(strings: [String]) -> String? {
    var longestString: String?
    var longestLength = 0
    for string in strings {
        if string.length > longestLength {
            longestString = string
            longestLength = string.length
        }
    }
    return longestString
}
```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? {
    var longestString: String?
    var longestLength = 0
    for string in strings {
        if string.length > longestLength {
            longestString = string
            longestLength = string.length
        }
    }
    return longestString
}
```
if string.length > longestLength { // value of type 'String' has no member 'length'
longestLength = string.length // value of type 'String' has no member 'length'

func longest(strings: [String]) -> String? {
    var longest: String?
    for string in strings {
        if longest == nil || string.length > longest.length {
            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? {
    var longest: String?
    for string in strings {
        if longest == nil || string.length > longest.length {
            longest = string
        }
    }
    return longest
}
```
if longest == nil || string.length > longest.length { // value of type 'String?' has no member 'length'
if longest == nil || string.length > longest.length { // value of type 'String' has no member 'length'

func longest(strings: [String]) -> String? {
    // TODO: Implement this function
}
```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? {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'String?'

func longest(strings: [String]) -> String? {
    var longestString: String?
    var longestLength = 0
    for string in strings {
        if string.length > longestLength {
            longestString = string
            longestLength = string.length
        }
    }
    return longestString
}
```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? {
    var longestString: String?
    var longestLength = 0
    for string in strings {
        if string.length > longestLength {
            longestString = string
            longestLength = string.length
        }
    }
    return longestString
}
```
if string.length > longestLength { // value of type 'String' has no member 'length'
longestLength = string.length // value of type 'String' has no member 'length'

func longest(strings: [String]) -> String? {
    var longest: String?
    for string in strings {
        if longest == nil || string.length > longest.length {
            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? {
    var longest: String?
    for string in strings {
        if longest == nil || string.length > longest.length {
            longest = string
        }
    }
    return longest
}
```
if longest == nil || string.length > longest.length { // value of type 'String?' has no member 'length'
if longest == nil || string.length > longest.length { // value of type 'String' has no member 'length'

func longest(strings: [String]) -> String? {
    var longest: String?
    for string in strings {
        if string.count > longest?.count?? 0 {
            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? {
    var longest: String?
    for string in strings {
        if string.count > longest?.count?? 0 {
            longest = string
        }
    }
    return longest
}
```
if string.count > longest?.count?? 0 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if string.count > longest?.count?? 0 { // expected '{' after 'if' condition
if string.count > longest?.count?? 0 { // cannot use optional chaining on non-optional value of type 'Int'
if string.count > longest?.count?? 0 { // cannot use optional chaining on non-optional value of type 'Int'

func longest(strings: [String]) -> String? {
    var longest: String?
    for string in strings {
        if string.count > longest?.count?? 0 {
            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? {
    var longest: String?
    for string in strings {
        if string.count > longest?.count?? 0 {
            longest = string
        }
    }
    return longest
}
```
if string.count > longest?.count?? 0 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if string.count > longest?.count?? 0 { // expected '{' after 'if' condition
if string.count > longest?.count?? 0 { // cannot use optional chaining on non-optional value of type 'Int'
if string.count > longest?.count?? 0 { // cannot use optional chaining on non-optional value of type 'Int'

func longest(strings: [String]) -> String? {
    var longest = nil
    for string in strings {
        if longest == nil || 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? {
    var longest = nil
    for string in strings {
        if longest == nil || string.count > longest.count {
            longest = string
        }
    }
    return longest
}
```
var longest = nil // 'nil' requires a contextual type

func longest(strings: [String]) -> String? {
    var longest: String?
    for string in strings {
        if longest == nil || string.length > longest.length {
            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? {
    var longest: String?
    for string in strings {
        if longest == nil || string.length > longest.length {
            longest = string
        }
    }
    return longest
}
```
if longest == nil || string.length > longest.length { // value of type 'String?' has no member 'length'
if longest == nil || string.length > longest.length { // value of type 'String' has no member 'length'

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    var a = a
    var b = b
    
    while b!= 0 {
        let temp = a % b
        a = b
        b = temp
    }
    
    return 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 {
    var a = a
    var b = b
    
    while b!= 0 {
        let temp = a % b
        a = b
        b = temp
    }
    
    return a
}
```
while b!= 0 { // use of '=' in a boolean context, did you mean '=='?
while b!= 0 { // cannot force unwrap value of non-optional type 'Int'
while b!= 0 { // '=' must have consistent whitespace on both sides

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    // TODO: implement greatest common divisor algorithm
}
```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 {
    // TODO: implement greatest common divisor algorithm
}
```
} // missing return in global function expected to return 'Int'

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    var a = a
    var b = b
    
    while b!= 0 {
        let temp = a
        a = b
        b = temp % b
    }
    
    return 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 {
    var a = a
    var b = b
    
    while b!= 0 {
        let temp = a
        a = b
        b = temp % b
    }
    
    return a
}
```
while b!= 0 { // use of '=' in a boolean context, did you mean '=='?
while b!= 0 { // cannot force unwrap value of non-optional type 'Int'
while b!= 0 { // '=' must have consistent whitespace on both sides

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    //...
}
```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 {
    //...
}
```
} // missing return in global function expected to return 'Int'

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    // TODO: Implement greatest common divisor
}
```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 {
    // TODO: Implement greatest common divisor
}
```
} // missing return in global function expected to return 'Int'

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    var a = a
    var b = b
    var c = a % b
    while c!= 0 {
        a = b
        b = c
        c = 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 {
    var a = a
    var b = b
    var c = a % b
    while c!= 0 {
        a = b
        b = c
        c = a % b
    }
    return b
}
```
while c!= 0 { // use of '=' in a boolean context, did you mean '=='?
while c!= 0 { // cannot force unwrap value of non-optional type 'Int'
while c!= 0 { // '=' must have consistent whitespace on both sides

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    var a = a
    var b = b
    
    while a!= b {
        if a > b {
            a = a - b
        } else {
            b = b - a
        }
    }
    
    return 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 {
    var a = a
    var b = b
    
    while a!= b {
        if a > b {
            a = a - b
        } else {
            b = b - a
        }
    }
    
    return a
}
```
while a!= b { // use of '=' in a boolean context, did you mean '=='?
while a!= b { // cannot force unwrap value of non-optional type 'Int'
while a!= b { // '=' must have consistent whitespace on both sides

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    var a = a
    var b = b
    
    while a!= b {
        if a > b {
            a -= b
        } else {
            b -= a
        }
    }
    
    return 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 {
    var a = a
    var b = b
    
    while a!= b {
        if a > b {
            a -= b
        } else {
            b -= a
        }
    }
    
    return a
}
```
while a!= b { // use of '=' in a boolean context, did you mean '=='?
while a!= b { // cannot force unwrap value of non-optional type 'Int'
while a!= b { // '=' must have consistent whitespace on both sides

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    var a = a
    var b = b
    
    while a!= b {
        if a > b {
            a = a - b
        } else {
            b = b - a
        }
    }
    
    return 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 {
    var a = a
    var b = b
    
    while a!= b {
        if a > b {
            a = a - b
        } else {
            b = b - a
        }
    }
    
    return a
}
```
while a!= b { // use of '=' in a boolean context, did you mean '=='?
while a!= b { // cannot force unwrap value of non-optional type 'Int'
while a!= b { // '=' must have consistent whitespace on both sides

func greatestCommonDivisor(a: Int, b: Int) -> Int {
    //...
}
```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 {
    //...
}
```
} // missing return in global function expected to return 'Int'

func allPrefixes(string: String) -> [String] {
    var prefixes = [String]()
    for i in 0..<string.length {
        prefixes.append(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.length {
        prefixes.append(string.prefix(i))
    }
    return prefixes
}
```
for i in 0..<string.length { // value of type 'String' has no member 'length'

func allPrefixes(string: String) -> [String] {
    var result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i + 1))
    }
    return result
}
```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 result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i + 1))
    }
    return result
}
```
for i in 0..<string.length { // value of type 'String' has no member 'length'

func allPrefixes(string: String) -> [String] {
    var result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i+1))
    }
    return result
}
```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 result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i+1))
    }
    return result
}
```
for i in 0..<string.length { // value of type 'String' has no member 'length'

func allPrefixes(string: String) -> [String] {
    var prefixes = [String]()
    for index in 0..<string.count {
        prefixes.append(string.prefix(index))
    }
    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 index in 0..<string.count {
        prefixes.append(string.prefix(index))
    }
    return prefixes
}
```
prefixes.append(string.prefix(index)) // no exact matches in call to instance method 'append'

func allPrefixes(string: String) -> [String] {
    var result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i+1))
    }
    return result
}
```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 result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i+1))
    }
    return result
}
```
for i in 0..<string.length { // value of type 'String' has no member 'length'

func allPrefixes(string: String) -> [String] {
    var result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i))
    }
    return result
}
```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 result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i))
    }
    return result
}
```
for i in 0..<string.length { // value of type 'String' has no member 'length'

func allPrefixes(string: String) -> [String] {
    var result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i + 1))
    }
    return result
}
```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 result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i + 1))
    }
    return result
}
```
for i in 0..<string.length { // value of type 'String' has no member 'length'

func allPrefixes(string: String) -> [String] {
    var result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i))
    }
    return result
}
```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 result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i))
    }
    return result
}
```
for i in 0..<string.length { // value of type 'String' has no member 'length'

func allPrefixes(string: String) -> [String] {
    var prefixes = [String]()
    for i in 0..<string.length {
        prefixes.append(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.length {
        prefixes.append(string.prefix(i))
    }
    return prefixes
}
```
for i in 0..<string.length { // value of type 'String' has no member 'length'

func allPrefixes(string: String) -> [String] {
    var result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i))
    }
    return result
}
```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 result = [String]()
    for i in 0..<string.length {
        result.append(string.prefix(i))
    }
    return result
}
```
for i in 0..<string.length { // value of type 'String' has no member 'length'

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+1 {
        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+1 {
        result += "\(i) "
    }
    return result
}
```
 // XCTAssertTrue failed

func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0..<n+1 {
        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+1 {
        result += "\(i) "
    }
    return result
}
```
 // XCTAssertTrue failed

func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0..<n+1 {
        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+1 {
        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+1 {
        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+1 {
        result += "\(i) "
    }
    return result
}
```
 // XCTAssertTrue failed

func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0..<n+1 {
        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+1 {
        result += "\(i) "
    }
    return result
}
```
 // XCTAssertTrue failed

func stringSequence(n: Int) -> String {
    var result = ""
    for i in 0..<n+1 {
        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+1 {
        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 countDistinctCharacters(string: String) -> Int {
    let lowercaseString = string.lowerCased()
    var distinctCharacters = [Character]()
    for character in lowercaseString.characters {
        if!distinctCharacters.contains(character) {
            distinctCharacters.append(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 lowercaseString = string.lowerCased()
    var distinctCharacters = [Character]()
    for character in lowercaseString.characters {
        if!distinctCharacters.contains(character) {
            distinctCharacters.append(character)
        }
    }
    return distinctCharacters.count
}
```
let lowercaseString = string.lowerCased() // value of type 'String' has no member 'lowerCased'
if!distinctCharacters.contains(character) { // expected expression, var, or let in 'if' condition

func countDistinctCharacters(string: String) -> Int {
    var count = 0
    var seen = [Character: Bool]()
    for character in string.characters {
        if!seen[character] {
            seen[character] = true
            count += 1
        }
    }
    return 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 count = 0
    var seen = [Character: Bool]()
    for character in string.characters {
        if!seen[character] {
            seen[character] = true
            count += 1
        }
    }
    return count
}
```
for character in string.characters { // 'characters' is unavailable: Please use String directly
if!seen[character] { // expected expression, var, or let in 'if' condition

func countDistinctCharacters(string: String) -> Int {
    let lowercaseString = string.lowerCased()
    let distinctCharacters = Set(lowercaseString.unicodeScalars)
    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 lowercaseString = string.lowerCased()
    let distinctCharacters = Set(lowercaseString.unicodeScalars)
    return distinctCharacters.count
}
```
let lowercaseString = string.lowerCased() // value of type 'String' has no member 'lowerCased'

func countDistinctCharacters(string: String) -> Int {
    var count = 0
    var seen = [Character: Bool]()
    for character in string.characters {
        if!seen[character] {
            seen[character] = true
            count += 1
        }
    }
    return 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 count = 0
    var seen = [Character: Bool]()
    for character in string.characters {
        if!seen[character] {
            seen[character] = true
            count += 1
        }
    }
    return count
}
```
for character in string.characters { // 'characters' is unavailable: Please use String directly
if!seen[character] { // expected expression, var, or let in 'if' condition

func countDistinctCharacters(string: String) -> Int {
    // TODO: Implement this function
    var count = 0
    var set = Set<Character>()
    for character in string.characters {
        set.insert(character)
    }
    count = set.count
    return 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 {
    // TODO: Implement this function
    var count = 0
    var set = Set<Character>()
    for character in string.characters {
        set.insert(character)
    }
    count = set.count
    return count
}
```
for character in string.characters { // 'characters' is unavailable: Please use String directly

func countDistinctCharacters(string: String) -> Int {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func countDistinctCharacters(string: String) -> Int {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func countDistinctCharacters(string: String) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func countDistinctCharacters(string: String) -> Int {
    var count = 0
    var seen = [Character: Bool]()
    for character in string.characters {
        if!seen[character] {
            seen[character] = true
            count += 1
        }
    }
    return 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 count = 0
    var seen = [Character: Bool]()
    for character in string.characters {
        if!seen[character] {
            seen[character] = true
            count += 1
        }
    }
    return count
}
```
for character in string.characters { // 'characters' is unavailable: Please use String directly
if!seen[character] { // expected expression, var, or let in 'if' condition

func countDistinctCharacters(string: String) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func parseMusic(musicString: String) -> [Int] {
    // TODO: Your implementation goes here
}
```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] {
    // TODO: Your implementation goes here
}
```
} // missing return in global function expected to return '[Int]'

func parseMusic(musicString: String) -> [Int] {
    var notes: [Int] = []
    var currentBeat = 0
    for character in musicString {
        switch character {
        case 'o':
            notes.append(currentBeat)
            currentBeat += 4
        case 'o|':
            notes.append(currentBeat)
            currentBeat += 2
        case '.|':
            notes.append(currentBeat)
            currentBeat += 1
        default:
            break
        }
    }
    return notes
}
```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 notes: [Int] = []
    var currentBeat = 0
    for character in musicString {
        switch character {
        case 'o':
            notes.append(currentBeat)
            currentBeat += 4
        case 'o|':
            notes.append(currentBeat)
            currentBeat += 2
        case '.|':
            notes.append(currentBeat)
            currentBeat += 1
        default:
            break
        }
    }
    return notes
}
```
case 'o': // single-quoted string literal found, use '"'
case 'o|': // expression pattern of type 'String' cannot match values of type 'Character'
case 'o|': // single-quoted string literal found, use '"'
case '.|': // single-quoted string literal found, use '"'
case '.|': // expression pattern of type 'String' cannot match values of type 'Character'

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 0
    for character in musicString {
        switch character {
        case 'o':
            currentBeat += 4
        case '|':
            currentBeat /= 2
        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 = 0
    for character in musicString {
        switch character {
        case 'o':
            currentBeat += 4
        case '|':
            currentBeat /= 2
        default:
            break
        }
        result.append(currentBeat)
    }
    return result
}
```
case 'o': // single-quoted string literal found, use '"'
case '|': // single-quoted string literal found, use '"'

func parseMusic(musicString: String) -> [Int] {
    var notes = [Int]()
    var note = 0
    for character in musicString {
        switch character {
        case 'o':
            note += 4
        case '|':
            note /= 2
        case '.':
            note -= 1
        default:
            break
        }
        notes.append(note)
    }
    return notes
}
```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 notes = [Int]()
    var note = 0
    for character in musicString {
        switch character {
        case 'o':
            note += 4
        case '|':
            note /= 2
        case '.':
            note -= 1
        default:
            break
        }
        notes.append(note)
    }
    return notes
}
```
case 'o': // single-quoted string literal found, use '"'
case '|': // single-quoted string literal found, use '"'
case '.': // single-quoted string literal found, use '"'

func parseMusic(musicString: String) -> [Int] {
    // Your implementation goes here
}
```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] {
    // Your implementation goes here
}
```
} // missing return in global function expected to return '[Int]'

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 0
    for character in musicString {
        switch character {
        case 'o':
            currentBeat += 4
        case '|':
            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 = 0
    for character in musicString {
        switch character {
        case 'o':
            currentBeat += 4
        case '|':
            currentBeat /= 2
        case '.':
            currentBeat -= 1
        default:
            break
        }
        result.append(currentBeat)
    }
    return result
}
```
case 'o': // single-quoted string literal found, use '"'
case '|': // single-quoted string literal found, use '"'
case '.': // single-quoted string literal found, use '"'

func parseMusic(musicString: String) -> [Int] {
    // Your implementation goes here
}
```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] {
    // Your implementation goes here
}
```
} // missing return in global function expected to return '[Int]'

func parseMusic(musicString: String) -> [Int] {
    // Your implementation goes here
}
```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] {
    // Your implementation goes here
}
```
} // missing return in global function expected to return '[Int]'

func parseMusic(musicString: String) -> [Int] {
    var parsedMusic = [Int]()
    var currentBeat = 0
    for character in musicString {
        switch character {
        case 'o':
            currentBeat += 4
        case '|':
            currentBeat += 2
        case '.':
            currentBeat += 1
        default:
            break
        }
        parsedMusic.append(currentBeat)
    }
    return parsedMusic
}
```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 parsedMusic = [Int]()
    var currentBeat = 0
    for character in musicString {
        switch character {
        case 'o':
            currentBeat += 4
        case '|':
            currentBeat += 2
        case '.':
            currentBeat += 1
        default:
            break
        }
        parsedMusic.append(currentBeat)
    }
    return parsedMusic
}
```
case 'o': // single-quoted string literal found, use '"'
case '|': // single-quoted string literal found, use '"'
case '.': // single-quoted string literal found, use '"'

func parseMusic(musicString: String) -> [Int] {
    var beats = [Int]()
    var currentBeat = 0
    for char in musicString {
        switch char {
        case 'o':
            currentBeat += 4
        case '|':
            currentBeat /= 2
        default:
            break
        }
        beats.append(currentBeat)
    }
    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] {
    var beats = [Int]()
    var currentBeat = 0
    for char in musicString {
        switch char {
        case 'o':
            currentBeat += 4
        case '|':
            currentBeat /= 2
        default:
            break
        }
        beats.append(currentBeat)
    }
    return beats
}
```
case 'o': // single-quoted string literal found, use '"'
case '|': // single-quoted string literal found, use '"'

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.index(string.startIndex, offsetBy: 1)
    while index!= string.endIndex {
        if string.hasPrefix(substring, range: index...) {
            count += 1
        }
        index = string.index(index, offsetBy: 1)
    }
    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.index(string.startIndex, offsetBy: 1)
    while index!= string.endIndex {
        if string.hasPrefix(substring, range: index...) {
            count += 1
        }
        index = string.index(index, offsetBy: 1)
    }
    return count
}
```
while index!= string.endIndex { // use of '=' in a boolean context, did you mean '=='?
while index!= string.endIndex { // cannot force unwrap value of non-optional type 'String.Index'
while index!= string.endIndex { // '=' must have consistent whitespace on both sides
if string.hasPrefix(substring, range: index...) { // extra argument 'range' in call

func howManyTimes(string: String, substring: String) -> Int {
    let range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch)
    var count = 0
    while range!= nil {
        count += 1
        string = string.stringByReplacingCharactersInRange(range!, withString: "")
        range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch)
    }
    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 {
    let range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch)
    var count = 0
    while range!= nil {
        count += 1
        string = string.stringByReplacingCharactersInRange(range!, withString: "")
        range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch)
    }
    return count
}
```
let range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch) // type 'NSStringCompareOptions' has no member 'CaseInsensitiveSearch'
let range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch) // value of type 'String' has no member 'rangeOfString'
while range!= nil { // '=' must have consistent whitespace on both sides
while range!= nil { // use of '=' in a boolean context, did you mean '=='?
string = string.stringByReplacingCharactersInRange(range!, withString: "") // cannot assign to value: 'string' is a 'let' constant
string = string.stringByReplacingCharactersInRange(range!, withString: "") // value of type 'String' has no member 'stringByReplacingCharactersInRange'
range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch) // value of type 'String' has no member 'rangeOfString'
range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch) // type 'NSStringCompareOptions' has no member 'CaseInsensitiveSearch'

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.index(string.startIndex, advancedBy: substring.characters.count)
    while index!= string.endIndex {
        count += 1
        index = string.index(index, advancedBy: substring.characters.count)
    }
    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.index(string.startIndex, advancedBy: substring.characters.count)
    while index!= string.endIndex {
        count += 1
        index = string.index(index, advancedBy: substring.characters.count)
    }
    return count
}
```
var index = string.index(string.startIndex, advancedBy: substring.characters.count) // no exact matches in call to instance method 'index'
while index!= string.endIndex { // use of '=' in a boolean context, did you mean '=='?
while index!= string.endIndex { // '=' must have consistent whitespace on both sides
index = string.index(index, advancedBy: substring.characters.count) // no exact matches in call to instance method 'index'

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.index(string.startIndex, offsetBy: 1)
    while index!= string.endIndex {
        if string.hasPrefix(substring, range: Range<String.Index>(start: index, end: index + substring.count)) {
            count += 1
        }
        index = string.index(index, offsetBy: 1)
    }
    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.index(string.startIndex, offsetBy: 1)
    while index!= string.endIndex {
        if string.hasPrefix(substring, range: Range<String.Index>(start: index, end: index + substring.count)) {
            count += 1
        }
        index = string.index(index, offsetBy: 1)
    }
    return count
}
```
while index!= string.endIndex { // cannot force unwrap value of non-optional type 'String.Index'
while index!= string.endIndex { // '=' must have consistent whitespace on both sides
while index!= string.endIndex { // use of '=' in a boolean context, did you mean '=='?
if string.hasPrefix(substring, range: Range<String.Index>(start: index, end: index + substring.count)) { // extra argument 'range' in call
if string.hasPrefix(substring, range: Range<String.Index>(start: index, end: index + substring.count)) { // no exact matches in call to initializer
if string.hasPrefix(substring, range: Range<String.Index>(start: index, end: index + substring.count)) { // binary operator '+' cannot be applied to operands of type 'String.Index' and 'Int'

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.index(string.startIndex, advancedBy: substring.characters.count)
    while index!= string.endIndex {
        count += 1
        index = string.index(index, advancedBy: substring.characters.count)
    }
    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.index(string.startIndex, advancedBy: substring.characters.count)
    while index!= string.endIndex {
        count += 1
        index = string.index(index, advancedBy: substring.characters.count)
    }
    return count
}
```
var index = string.index(string.startIndex, advancedBy: substring.characters.count) // no exact matches in call to instance method 'index'
while index!= string.endIndex { // use of '=' in a boolean context, did you mean '=='?
while index!= string.endIndex { // '=' must have consistent whitespace on both sides
index = string.index(index, advancedBy: substring.characters.count) // no exact matches in call to instance method 'index'

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.index(string.startIndex, advancedBy: 1)
    while index!= string.endIndex {
        if string.hasPrefix(substring, range: Range<String.Index>(start: index, end: index + substring.count)) {
            count += 1
        }
        index = string.index(index, advancedBy: 1)
    }
    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.index(string.startIndex, advancedBy: 1)
    while index!= string.endIndex {
        if string.hasPrefix(substring, range: Range<String.Index>(start: index, end: index + substring.count)) {
            count += 1
        }
        index = string.index(index, advancedBy: 1)
    }
    return count
}
```
var index = string.index(string.startIndex, advancedBy: 1) // no exact matches in call to instance method 'index'
while index!= string.endIndex { // '=' must have consistent whitespace on both sides
while index!= string.endIndex { // use of '=' in a boolean context, did you mean '=='?
if string.hasPrefix(substring, range: Range<String.Index>(start: index, end: index + substring.count)) { // extra argument 'range' in call
if string.hasPrefix(substring, range: Range<String.Index>(start: index, end: index + substring.count)) { // no exact matches in call to initializer
index = string.index(index, advancedBy: 1) // no exact matches in call to instance method 'index'

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.index(string.startIndex, advancedBy: 1)
    while index!= string.endIndex {
        if string.hasPrefix(substring, range: Range<String.Index>(start: index, end: index + substring.count)) {
            count += 1
            index = string.index(index, offsetBy: substring.count)
        } else {
            index = string.index(index, offsetBy: 1)
        }
    }
    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.index(string.startIndex, advancedBy: 1)
    while index!= string.endIndex {
        if string.hasPrefix(substring, range: Range<String.Index>(start: index, end: index + substring.count)) {
            count += 1
            index = string.index(index, offsetBy: substring.count)
        } else {
            index = string.index(index, offsetBy: 1)
        }
    }
    return count
}
```
var index = string.index(string.startIndex, advancedBy: 1) // no exact matches in call to instance method 'index'
while index!= string.endIndex { // '=' must have consistent whitespace on both sides
while index!= string.endIndex { // use of '=' in a boolean context, did you mean '=='?
if string.hasPrefix(substring, range: Range<String.Index>(start: index, end: index + substring.count)) { // extra argument 'range' in call
if string.hasPrefix(substring, range: Range<String.Index>(start: index, end: index + substring.count)) { // no exact matches in call to initializer

func howManyTimes(string: String, substring: String) -> Int {
    let count = string.components(separatedBy: substring).count - 1
    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 {
    let count = string.components(separatedBy: substring).count - 1
    return count
}
```
 // XCTAssertTrue failed

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.index(string.startIndex, advancedBy: substring.characters.count)
    while index!= string.endIndex {
        count += 1
        index = string.index(index, advancedBy: substring.characters.count)
    }
    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.index(string.startIndex, advancedBy: substring.characters.count)
    while index!= string.endIndex {
        count += 1
        index = string.index(index, advancedBy: substring.characters.count)
    }
    return count
}
```
var index = string.index(string.startIndex, advancedBy: substring.characters.count) // no exact matches in call to instance method 'index'
while index!= string.endIndex { // use of '=' in a boolean context, did you mean '=='?
while index!= string.endIndex { // '=' must have consistent whitespace on both sides
index = string.index(index, advancedBy: substring.characters.count) // no exact matches in call to instance method 'index'

func howManyTimes(string: String, substring: String) -> Int {
    let count = string.components(separatedBy: substring).count - 1
    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 {
    let count = string.components(separatedBy: substring).count - 1
    return count
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    // TODO: Implement this method
}
```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 {
    // TODO: Implement this method
}
```
} // missing return in global function expected to return 'String'

func sortNumbers(numbers: String) -> String {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'String'

func sortNumbers(numbers: String) -> String {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'String'

func sortNumbers(numbers: String) -> String {
    // TODO: Implement this method
}
```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 {
    // TODO: Implement this method
}
```
} // missing return in global function expected to return 'String'

func sortNumbers(numbers: String) -> String {
    // TODO: Implement this method
}
```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 {
    // TODO: Implement this method
}
```
} // missing return in global function expected to return 'String'

func sortNumbers(numbers: String) -> String {
    // TODO: Implement this method
}
```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 {
    // TODO: Implement this method
}
```
} // missing return in global function expected to return 'String'

func sortNumbers(numbers: String) -> String {
    // TODO: Implement this method
    return ""
}
```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 {
    // TODO: Implement this method
    return ""
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    // TODO: Implement this function
    return ""
}
```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 {
    // TODO: Implement this function
    return ""
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    // TODO: Implement this function
    return ""
}
```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 {
    // TODO: Implement this function
    return ""
}
```
 // XCTAssertTrue failed

func sortNumbers(numbers: String) -> String {
    // TODO: Implement this function
    return ""
}
```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 {
    // TODO: Implement this function
    return ""
}
```
 // XCTAssertTrue failed

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: Implement this function
}
```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 this function
}
```
} // missing return in global function expected to return '(Double, Double)'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: Implement
}
```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
}
```
} // missing return in global function expected to return '(Double, Double)'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: implement
}
```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
}
```
} // missing return in global function expected to return '(Double, Double)'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: implement
}
```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
}
```
} // missing return in global function expected to return '(Double, Double)'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: implement
}
```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
}
```
} // missing return in global function expected to return '(Double, Double)'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: implement
}
```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
}
```
} // missing return in global function expected to return '(Double, Double)'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: implement
}
```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
}
```
} // missing return in global function expected to return '(Double, Double)'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: implement
}
```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
}
```
} // missing return in global function expected to return '(Double, Double)'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    // TODO: implement
}
```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
}
```
} // missing return in global function expected to return '(Double, Double)'

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var minDiff = Double.greatestFiniteMagnitude
    var minIndex = 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
                minIndex = i
            }
        }
    }
    return (numbers[minIndex], numbers[minIndex+1])
}
```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.greatestFiniteMagnitude
    var minIndex = 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
                minIndex = i
            }
        }
    }
    return (numbers[minIndex], numbers[minIndex+1])
}
```
 // XCTAssertTrue failed

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.reduce(Double.infinity, combine: { min, num in
        return min < num? min : num
    })
    let max = numbers.reduce(Double.min, combine: { max, num in
        return max > num? max : num
    })
    return numbers.map { (num: Double) -> Double in
        return (num - 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.reduce(Double.infinity, combine: { min, num in
        return min < num? min : num
    })
    let max = numbers.reduce(Double.min, combine: { max, num in
        return max > num? max : num
    })
    return numbers.map { (num: Double) -> Double in
        return (num - min) / (max - min)
    }
}
```
let min = numbers.reduce(Double.infinity, combine: { min, num in // extraneous argument label 'combine:' in call
return min < num? min : num // cannot convert value of type 'Bool' to closure result type 'Double'
return min < num? min : num // cannot use optional chaining on non-optional value of type 'Double'
return min < num? min : num // consecutive statements on a line must be separated by ';'
return min < num? min : num // expected expression
return min < num? min : num // consecutive statements on a line must be separated by ';'
return min < num? min : num // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
let max = numbers.reduce(Double.min, combine: { max, num in // type 'Double' has no member 'min'
let max = numbers.reduce(Double.min, combine: { max, num in // extraneous argument label 'combine:' in call
return max > num? max : num // consecutive statements on a line must be separated by ';'
return max > num? max : num // cannot use optional chaining on non-optional value of type 'Double'
return max > num? max : num // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return max > num? max : num // expected expression
return max > num? max : num // consecutive statements on a line must be separated by ';'

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.reduce(Double.max) { $0 < $1? $0 : $1 }
    let max = numbers.reduce(Double.min) { $0 > $1? $0 : $1 }
    return numbers.map { $0 / (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.reduce(Double.max) { $0 < $1? $0 : $1 }
    let max = numbers.reduce(Double.min) { $0 > $1? $0 : $1 }
    return numbers.map { $0 / (max - min) }
}
```
let min = numbers.reduce(Double.max) { $0 < $1? $0 : $1 } // expected expression
let min = numbers.reduce(Double.max) { $0 < $1? $0 : $1 } // type 'Double' has no member 'max'
let min = numbers.reduce(Double.max) { $0 < $1? $0 : $1 } // consecutive statements on a line must be separated by ';'
let min = numbers.reduce(Double.max) { $0 < $1? $0 : $1 } // missing argument label 'into:' in call
let min = numbers.reduce(Double.max) { $0 < $1? $0 : $1 } // consecutive statements on a line must be separated by ';'
let max = numbers.reduce(Double.min) { $0 > $1? $0 : $1 } // type 'Double' has no member 'min'
let max = numbers.reduce(Double.min) { $0 > $1? $0 : $1 } // missing argument label 'into:' in call
let max = numbers.reduce(Double.min) { $0 > $1? $0 : $1 } // consecutive statements on a line must be separated by ';'
let max = numbers.reduce(Double.min) { $0 > $1? $0 : $1 } // expected expression
let max = numbers.reduce(Double.min) { $0 > $1? $0 : $1 } // consecutive statements on a line must be separated by ';'

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.reduce(0.0, combine: { (min: Double, value: Double) -> Double in
        return min < value? min : value
    })
    let max = numbers.reduce(0.0, combine: { (max: Double, value: Double) -> Double in
        return max > value? max : value
    })
    let range = max - min
    return numbers.map { (value: Double) -> Double in
        return (value - 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] {
    let min = numbers.reduce(0.0, combine: { (min: Double, value: Double) -> Double in
        return min < value? min : value
    })
    let max = numbers.reduce(0.0, combine: { (max: Double, value: Double) -> Double in
        return max > value? max : value
    })
    let range = max - min
    return numbers.map { (value: Double) -> Double in
        return (value - min) / range
    }
}
```
let min = numbers.reduce(0.0, combine: { (min: Double, value: Double) -> Double in // extraneous argument label 'combine:' in call
return min < value? min : value // cannot convert value of type 'Bool' to closure result type 'Double'
return min < value? min : value // cannot use optional chaining on non-optional value of type 'Double'
return min < value? min : value // expected expression
return min < value? min : value // consecutive statements on a line must be separated by ';'
return min < value? min : value // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return min < value? min : value // consecutive statements on a line must be separated by ';'
let max = numbers.reduce(0.0, combine: { (max: Double, value: Double) -> Double in // extraneous argument label 'combine:' in call
return max > value? max : value // expected expression
return max > value? max : value // consecutive statements on a line must be separated by ';'
return max > value? max : value // cannot convert value of type 'Bool' to closure result type 'Double'
return max > value? max : value // cannot use optional chaining on non-optional value of type 'Double'
return max > value? max : value // consecutive statements on a line must be separated by ';'
return max > value? max : value // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let max = numbers.maxElement()!
    let min = numbers.minElement()!
    let range = max - min
    return numbers.map { $0 / 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] {
    let max = numbers.maxElement()!
    let min = numbers.minElement()!
    let range = max - min
    return numbers.map { $0 / range }
}
```
let max = numbers.maxElement()! // value of type '[Double]' has no member 'maxElement'
let min = numbers.minElement()! // value of type '[Double]' has no member 'minElement'

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.reduce(0.0, combine: { (min: Double, number: Double) -> Double in
        return min < number? min : number
    })
    let max = numbers.reduce(0.0, combine: { (max: Double, number: Double) -> Double in
        return max > number? max : number
    })
    let range = max - min
    return numbers.map { (number: Double) -> Double in
        return (number - 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] {
    let min = numbers.reduce(0.0, combine: { (min: Double, number: Double) -> Double in
        return min < number? min : number
    })
    let max = numbers.reduce(0.0, combine: { (max: Double, number: Double) -> Double in
        return max > number? max : number
    })
    let range = max - min
    return numbers.map { (number: Double) -> Double in
        return (number - min) / range
    }
}
```
let min = numbers.reduce(0.0, combine: { (min: Double, number: Double) -> Double in // extraneous argument label 'combine:' in call
return min < number? min : number // expected expression
return min < number? min : number // cannot use optional chaining on non-optional value of type 'Double'
return min < number? min : number // consecutive statements on a line must be separated by ';'
return min < number? min : number // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return min < number? min : number // consecutive statements on a line must be separated by ';'
return min < number? min : number // cannot convert value of type 'Bool' to closure result type 'Double'
let max = numbers.reduce(0.0, combine: { (max: Double, number: Double) -> Double in // extraneous argument label 'combine:' in call
return max > number? max : number // cannot convert value of type 'Bool' to closure result type 'Double'
return max > number? max : number // expected expression
return max > number? max : number // cannot use optional chaining on non-optional value of type 'Double'
return max > number? max : number // consecutive statements on a line must be separated by ';'
return max > number? max : number // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return max > number? max : number // consecutive statements on a line must be separated by ';'

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.reduce(0.0, combine: { (min: Double, number: Double) -> Double in
        return min < number? min : number
    })
    let max = numbers.reduce(0.0, combine: { (max: Double, number: Double) -> Double in
        return max > number? max : number
    })
    return numbers.map { (number: Double) -> 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.reduce(0.0, combine: { (min: Double, number: Double) -> Double in
        return min < number? min : number
    })
    let max = numbers.reduce(0.0, combine: { (max: Double, number: Double) -> Double in
        return max > number? max : number
    })
    return numbers.map { (number: Double) -> Double in
        return (number - min) / (max - min)
    }
}
```
let min = numbers.reduce(0.0, combine: { (min: Double, number: Double) -> Double in // extraneous argument label 'combine:' in call
return min < number? min : number // expected expression
return min < number? min : number // cannot use optional chaining on non-optional value of type 'Double'
return min < number? min : number // consecutive statements on a line must be separated by ';'
return min < number? min : number // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return min < number? min : number // consecutive statements on a line must be separated by ';'
return min < number? min : number // cannot convert value of type 'Bool' to closure result type 'Double'
let max = numbers.reduce(0.0, combine: { (max: Double, number: Double) -> Double in // extraneous argument label 'combine:' in call
return max > number? max : number // cannot convert value of type 'Bool' to closure result type 'Double'
return max > number? max : number // expected expression
return max > number? max : number // cannot use optional chaining on non-optional value of type 'Double'
return max > number? max : number // consecutive statements on a line must be separated by ';'
return max > number? max : number // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return max > number? max : number // consecutive statements on a line must be separated by ';'

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.reduce(Double.infinity, <)
    let max = numbers.reduce(Double.mininum, >)
    let scale = max - min
    return numbers.map { $0 - min }.map { $0 / scale }
}
```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.reduce(Double.infinity, <)
    let max = numbers.reduce(Double.mininum, >)
    let scale = max - min
    return numbers.map { $0 - min }.map { $0 / scale }
}
```
let min = numbers.reduce(Double.infinity, <) // no exact matches in reference to operator function '<'
let min = numbers.reduce(Double.infinity, <) // cannot convert value of type 'Double' to expected argument type 'Bool'
let max = numbers.reduce(Double.mininum, >) // type 'Double' has no member 'mininum'
let max = numbers.reduce(Double.mininum, >) // cannot convert value of type '(Double, Double) -> Bool' to expected argument type '(Bool, Double) throws -> Bool'

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.reduce(0.0, combine: { (min: Double, number: Double) -> Double in
        return min < number? min : number
    })
    let max = numbers.reduce(0.0, combine: { (max: Double, number: Double) -> Double in
        return max > number? max : number
    })
    let range = max - min
    return numbers.map { (number: Double) -> Double in
        return (number - 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] {
    let min = numbers.reduce(0.0, combine: { (min: Double, number: Double) -> Double in
        return min < number? min : number
    })
    let max = numbers.reduce(0.0, combine: { (max: Double, number: Double) -> Double in
        return max > number? max : number
    })
    let range = max - min
    return numbers.map { (number: Double) -> Double in
        return (number - min) / range
    }
}
```
let min = numbers.reduce(0.0, combine: { (min: Double, number: Double) -> Double in // extraneous argument label 'combine:' in call
return min < number? min : number // expected expression
return min < number? min : number // cannot use optional chaining on non-optional value of type 'Double'
return min < number? min : number // consecutive statements on a line must be separated by ';'
return min < number? min : number // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return min < number? min : number // consecutive statements on a line must be separated by ';'
return min < number? min : number // cannot convert value of type 'Bool' to closure result type 'Double'
let max = numbers.reduce(0.0, combine: { (max: Double, number: Double) -> Double in // extraneous argument label 'combine:' in call
return max > number? max : number // cannot convert value of type 'Bool' to closure result type 'Double'
return max > number? max : number // expected expression
return max > number? max : number // cannot use optional chaining on non-optional value of type 'Double'
return max > number? max : number // consecutive statements on a line must be separated by ';'
return max > number? max : number // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return max > number? max : number // consecutive statements on a line must be separated by ';'

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.reduce(Double.greatestFiniteMagnitude, { min, number in
        return min < number? min : number
    })
    let max = numbers.reduce(Double.leastNonMagnitude, { max, number in
        return max > number? max : number
    })
    return numbers.map { number 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.reduce(Double.greatestFiniteMagnitude, { min, number in
        return min < number? min : number
    })
    let max = numbers.reduce(Double.leastNonMagnitude, { max, number in
        return max > number? max : number
    })
    return numbers.map { number in
        return (number - min) / (max - min)
    }
}
```
return min < number? min : number // expected expression
return min < number? min : number // cannot use optional chaining on non-optional value of type 'Double'
return min < number? min : number // consecutive statements on a line must be separated by ';'
return min < number? min : number // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return min < number? min : number // consecutive statements on a line must be separated by ';'
return min < number? min : number // cannot convert value of type 'Bool' to closure result type 'Double'
let max = numbers.reduce(Double.leastNonMagnitude, { max, number in // type 'Double' has no member 'leastNonMagnitude'
return max > number? max : number // cannot use optional chaining on non-optional value of type 'Double'
return max > number? max : number // expected expression
return max > number? max : number // consecutive statements on a line must be separated by ';'
return max > number? max : number // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return max > number? max : number // consecutive statements on a line must be separated by ';'

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.reduce(Double.greatestFiniteMagnitude, { min, num in
        return min < num? min : num
    })
    let max = numbers.reduce(Double.leastNonMagnitude, { max, num in
        return max > num? max : num
    })
    return numbers.map { (num: Double) -> Double in
        return (num - 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.reduce(Double.greatestFiniteMagnitude, { min, num in
        return min < num? min : num
    })
    let max = numbers.reduce(Double.leastNonMagnitude, { max, num in
        return max > num? max : num
    })
    return numbers.map { (num: Double) -> Double in
        return (num - min) / (max - min)
    }
}
```
return min < num? min : num // cannot convert value of type 'Bool' to closure result type 'Double'
return min < num? min : num // cannot use optional chaining on non-optional value of type 'Double'
return min < num? min : num // consecutive statements on a line must be separated by ';'
return min < num? min : num // expected expression
return min < num? min : num // consecutive statements on a line must be separated by ';'
return min < num? min : num // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
let max = numbers.reduce(Double.leastNonMagnitude, { max, num in // type 'Double' has no member 'leastNonMagnitude'
return max > num? max : num // consecutive statements on a line must be separated by ';'
return max > num? max : num // cannot use optional chaining on non-optional value of type 'Double'
return max > num? max : num // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return max > num? max : num // expected expression
return max > num? max : num // consecutive statements on a line must be separated by ';'

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 { $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 { $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 { $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 { $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 { $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 { $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 { $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 { $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 { $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 strlen(string: String) -> Int {
    var length = 0
    for i in 0..<string.length {
        if string[i] == '\0' {
            break
        }
        length += 1
    }
    return length
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    var length = 0
    for i in 0..<string.length {
        if string[i] == '\0' {
            break
        }
        length += 1
    }
    return length
}
```
for i in 0..<string.length { // value of type 'String' has no member 'length'
if string[i] == '\0' { // single-quoted string literal found, use '"'

func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```

func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```

func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```

func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```

func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```

func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```

func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```

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 {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```swift
// Return length of given string
// strlen(string: "") == 0
// strlen(string: "abc") == 3
func strlen(string: String) -> Int {
    var length = 0
    for _ in string {
        length += 1
    }
    return length
}
```

func largestDivisor(n: Int) -> Int {
    // Your code here
}
```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 {
    // Your code here
}
```
} // missing return in global function expected to return 'Int'

func largestDivisor(n: Int) -> Int {
    var divisor: Int = n
    var divisorFound = false
    while divisor > 1 &&!divisorFound {
        if n % divisor == 0 {
            divisorFound = true
        } else {
            divisor -= 1
        }
    }
    return divisor
}
```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 divisor: Int = n
    var divisorFound = false
    while divisor > 1 &&!divisorFound {
        if n % divisor == 0 {
            divisorFound = true
        } else {
            divisor -= 1
        }
    }
    return divisor
}
```
var divisorFound = false // variable 'divisorFound' was written to, but never read
while divisor > 1 &&!divisorFound { // expected '{' after 'while' condition

func largestDivisor(n: Int) -> Int {
    var divisor = n
    var divisorRemainder = divisor % 2
    while divisorRemainder!= 0 {
        divisor -= divisorRemainder
        divisorRemainder = divisor % 2
    }
    return divisor
}
```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 divisor = n
    var divisorRemainder = divisor % 2
    while divisorRemainder!= 0 {
        divisor -= divisorRemainder
        divisorRemainder = divisor % 2
    }
    return divisor
}
```
while divisorRemainder!= 0 { // use of '=' in a boolean context, did you mean '=='?
while divisorRemainder!= 0 { // '=' must have consistent whitespace on both sides
while divisorRemainder!= 0 { // cannot force unwrap value of non-optional type 'Int'

func largestDivisor(n: Int) -> Int {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Int'

func largestDivisor(n: Int) -> Int {
    var largest = n
    for i in 1...n {
        if n % i == 0 {
            largest = i
        }
    }
    return largest
}
```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 largest = n
    for i in 1...n {
        if n % i == 0 {
            largest = i
        }
    }
    return largest
}
```
 // XCTAssertTrue failed

func largestDivisor(n: Int) -> Int {
    var divisor = n
    while divisor > 1 {
        if n % divisor == 0 {
            return divisor
        }
        divisor -= 1
    }
    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 {
    var divisor = n
    while divisor > 1 {
        if n % divisor == 0 {
            return divisor
        }
        divisor -= 1
    }
    return 1
}
```
 // XCTAssertTrue failed

func largestDivisor(n: Int) -> Int {
    for i in n..<2*n {
        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 n..<2*n {
        if n % i == 0 {
            return i
        }
    }
    return 1
}
```
 // XCTAssertTrue failed

func largestDivisor(n: Int) -> Int {
    var largest = n
    for i in 1...n {
        if n % i == 0 {
            largest = i
        }
    }
    return largest
}
```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 largest = n
    for i in 1...n {
        if n % i == 0 {
            largest = i
        }
    }
    return largest
}
```
 // XCTAssertTrue failed

func largestDivisor(n: Int) -> Int {
    var divisor = n
    var divisorRemainder = 0
    while divisor > 1 {
        divisorRemainder = n % divisor
        if divisorRemainder == 0 {
            return divisor
        }
        divisor -= 1
    }
    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 {
    var divisor = n
    var divisorRemainder = 0
    while divisor > 1 {
        divisorRemainder = n % divisor
        if divisorRemainder == 0 {
            return divisor
        }
        divisor -= 1
    }
    return 1
}
```
 // XCTAssertTrue failed

func largestDivisor(n: Int) -> Int {
    for i in n..<2*n {
        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 n..<2*n {
        if n % i == 0 {
            return i
        }
    }
    return 1
}
```
 // XCTAssertTrue failed

func factorize(n: Int) -> [Int] {
    // TODO: Implement
}
```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] {
    // TODO: Implement
}
```
} // missing return in global function expected to return '[Int]'

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var i = 2
    while i * i <= n {
        if n % i == 0 {
            factors.append(i)
            n /= i
        } else {
            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 {
        if n % i == 0 {
            factors.append(i)
            n /= i
        } else {
            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 i = 2
    while i*i <= n {
        if n % i == 0 {
            factors.append(i)
            n /= i
        } else {
            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 {
        if n % i == 0 {
            factors.append(i)
            n /= i
        } else {
            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 factor: Int = 2
    while n > 1 {
        if n % factor == 0 {
            factors.append(factor)
            n /= factor
        } else {
            factor += 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 factor: Int = 2
    while n > 1 {
        if n % factor == 0 {
            factors.append(factor)
            n /= factor
        } else {
            factor += 1
        }
    }
    return factors
}
```
n /= factor // left side of mutating operator isn't mutable: 'n' is a 'let' constant

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    for i in 2...n {
        if n % i == 0 {
            var count = 1
            while n % i == 0 {
                n /= i
                count += 1
            }
            factors.append(count)
            factors.append(i)
        }
    }
    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]()
    for i in 2...n {
        if n % i == 0 {
            var count = 1
            while n % i == 0 {
                n /= i
                count += 1
            }
            factors.append(count)
            factors.append(i)
        }
    }
    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 currentFactor = 2
    var currentFactorCount = 0
    while n > 1 {
        if n % currentFactor == 0 {
            currentFactorCount += 1
            n /= currentFactor
        } else {
            if currentFactorCount > 0 {
                factors.append(currentFactor)
                factors.append(currentFactorCount)
                currentFactorCount = 0
            }
            currentFactor += 1
        }
    }
    if currentFactorCount > 0 {
        factors.append(currentFactor)
        factors.append(currentFactorCount)
    }
    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 currentFactor = 2
    var currentFactorCount = 0
    while n > 1 {
        if n % currentFactor == 0 {
            currentFactorCount += 1
            n /= currentFactor
        } else {
            if currentFactorCount > 0 {
                factors.append(currentFactor)
                factors.append(currentFactorCount)
                currentFactorCount = 0
            }
            currentFactor += 1
        }
    }
    if currentFactorCount > 0 {
        factors.append(currentFactor)
        factors.append(currentFactorCount)
    }
    return factors
}
```
n /= currentFactor // left side of mutating operator isn't mutable: 'n' is a 'let' constant

func factorize(n: Int) -> [Int] {
    var factors: [Int] = []
    var i = 2
    while i * i <= n {
        if n % i == 0 {
            factors.append(i)
            n /= i
        } else {
            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 {
        if n % i == 0 {
            factors.append(i)
            n /= i
        } else {
            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 i = 2
    while n > 1 {
        if n % i == 0 {
            factors.append(i)
            n /= i
        } else {
            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 i = 2
    while n > 1 {
        if n % i == 0 {
            factors.append(i)
            n /= i
        } else {
            i += 1
        }
    }
    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 i = 2
    while n > 1 {
        if n % i == 0 {
            factors.append(i)
            n /= i
        } else {
            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 i = 2
    while n > 1 {
        if n % i == 0 {
            factors.append(i)
            n /= i
        } else {
            i += 1
        }
    }
    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] = []
    for i in 2...n {
        if n % i == 0 {
            var count = 0
            while n % i == 0 {
                n /= i
                count += 1
            }
            factors.append(count)
            factors.append(i)
        }
    }
    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] = []
    for i in 2...n {
        if n % i == 0 {
            var count = 0
            while n % i == 0 {
                n /= i
                count += 1
            }
            factors.append(count)
            factors.append(i)
        }
    }
    return factors
}
```
n /= i // left side of mutating operator isn't mutable: 'n' is a 'let' constant

func removeDuplicates(numbers: [Int]) -> [Int] {
    // TODO: Implement removeDuplicates
}
```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] {
    // TODO: Implement removeDuplicates
}
```
} // missing return in global function expected to return '[Int]'

func removeDuplicates(numbers: [Int]) -> [Int] {
    // TODO: Implement me!
}
```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] {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return '[Int]'

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var seen = [Int: Int]()
    for number in numbers {
        seen[number] = seen[number]?.advanced(by: 1)?? 1
        if seen[number] == 1 {
            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]()
    var seen = [Int: Int]()
    for number in numbers {
        seen[number] = seen[number]?.advanced(by: 1)?? 1
        if seen[number] == 1 {
            result.append(number)
        }
    }
    return result
}
```
seen[number] = seen[number]?.advanced(by: 1)?? 1 // consecutive statements on a line must be separated by ';'
seen[number] = seen[number]?.advanced(by: 1)?? 1 // cannot use optional chaining on non-optional value of type 'Int'
seen[number] = seen[number]?.advanced(by: 1)?? 1 // cannot use optional chaining on non-optional value of type 'Int'
seen[number] = seen[number]?.advanced(by: 1)?? 1 // integer literal is unused

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var seen = [Int: Int]()
    for number in numbers {
        seen[number] = seen[number]?.advanced(by: 1)?? 1
        if seen[number] == 1 {
            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]()
    var seen = [Int: Int]()
    for number in numbers {
        seen[number] = seen[number]?.advanced(by: 1)?? 1
        if seen[number] == 1 {
            result.append(number)
        }
    }
    return result
}
```
seen[number] = seen[number]?.advanced(by: 1)?? 1 // consecutive statements on a line must be separated by ';'
seen[number] = seen[number]?.advanced(by: 1)?? 1 // cannot use optional chaining on non-optional value of type 'Int'
seen[number] = seen[number]?.advanced(by: 1)?? 1 // cannot use optional chaining on non-optional value of type 'Int'
seen[number] = seen[number]?.advanced(by: 1)?? 1 // integer literal is unused

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var seen = [Int: Int]()
    for number in numbers {
        seen[number] = seen[number]?? 0
        seen[number] += 1
        if seen[number] == 1 {
            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]()
    var seen = [Int: Int]()
    for number in numbers {
        seen[number] = seen[number]?? 0
        seen[number] += 1
        if seen[number] == 1 {
            result.append(number)
        }
    }
    return result
}
```
seen[number] = seen[number]?? 0 // consecutive statements on a line must be separated by ';'
seen[number] = seen[number]?? 0 // cannot use optional chaining on non-optional value of type 'Int'
seen[number] = seen[number]?? 0 // integer literal is unused
seen[number] += 1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var seen = [Int: Int]()
    for number in numbers {
        seen[number] = seen[number]?.advanced(by: 1)?? 1
        if seen[number] == 1 {
            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]()
    var seen = [Int: Int]()
    for number in numbers {
        seen[number] = seen[number]?.advanced(by: 1)?? 1
        if seen[number] == 1 {
            result.append(number)
        }
    }
    return result
}
```
seen[number] = seen[number]?.advanced(by: 1)?? 1 // consecutive statements on a line must be separated by ';'
seen[number] = seen[number]?.advanced(by: 1)?? 1 // cannot use optional chaining on non-optional value of type 'Int'
seen[number] = seen[number]?.advanced(by: 1)?? 1 // cannot use optional chaining on non-optional value of type 'Int'
seen[number] = seen[number]?.advanced(by: 1)?? 1 // integer literal is unused

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var seen = [Int: Bool]()
    for number in numbers {
        if!seen[number] {
            seen[number] = true
            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]()
    var seen = [Int: Bool]()
    for number in numbers {
        if!seen[number] {
            seen[number] = true
            result.append(number)
        }
    }
    return result
}
```
if!seen[number] { // expected expression, var, or let in 'if' condition

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    for number in numbers {
        if result.contains(number) {
            continue
        }
        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) {
            continue
        }
        result.append(number)
    }
    return result
}
```
 // XCTAssertTrue failed

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var seen = [Int: Int]()
    for number in numbers {
        seen[number] = seen[number]?.advancedBy(1)?? 0 + 1
        if seen[number] == 1 {
            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]()
    var seen = [Int: Int]()
    for number in numbers {
        seen[number] = seen[number]?.advancedBy(1)?? 0 + 1
        if seen[number] == 1 {
            result.append(number)
        }
    }
    return result
}
```
seen[number] = seen[number]?.advancedBy(1)?? 0 + 1 // value of type 'Int' has no member 'advancedBy'
seen[number] = seen[number]?.advancedBy(1)?? 0 + 1 // consecutive statements on a line must be separated by ';'
seen[number] = seen[number]?.advancedBy(1)?? 0 + 1 // result of operator '+' is unused

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var seen = [Int: Int]()
    for number in numbers {
        seen[number] = seen[number]?.advancedBy(1)?? 0 + 1
        if seen[number] == 1 {
            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]()
    var seen = [Int: Int]()
    for number in numbers {
        seen[number] = seen[number]?.advancedBy(1)?? 0 + 1
        if seen[number] == 1 {
            result.append(number)
        }
    }
    return result
}
```
seen[number] = seen[number]?.advancedBy(1)?? 0 + 1 // value of type 'Int' has no member 'advancedBy'
seen[number] = seen[number]?.advancedBy(1)?? 0 + 1 // consecutive statements on a line must be separated by ';'
seen[number] = seen[number]?.advancedBy(1)?? 0 + 1 // result of operator '+' is unused

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

func flipCase(string: String) -> String {
    // TODO: Implement flipCase
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    // TODO: Implement flipCase
}
```
} // missing return in global function expected to return 'String'

func flipCase(string: String) -> String {
    let lowercase = string.lowercaseString
    let uppercase = string.uppercaseString
    return lowercase.enumerate().reduce("") { (result, element) -> String in
        if element.1 == false {
            return result + uppercase[element.0]
        } else {
            return result + lowercase[element.0]
        }
    }
}
```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 = string.lowercaseString
    let uppercase = string.uppercaseString
    return lowercase.enumerate().reduce("") { (result, element) -> String in
        if element.1 == false {
            return result + uppercase[element.0]
        } else {
            return result + lowercase[element.0]
        }
    }
}
```
let lowercase = string.lowercaseString // value of type 'String' has no member 'lowercaseString'
let uppercase = string.uppercaseString // value of type 'String' has no member 'uppercaseString'

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

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

func flipCase(string: String) -> String {
    var flippedString = string
    for index in 0..<string.characters.count {
        if string.lowercaseString.hasPrefix(string.characters[index]) {
            flippedString.removeAtIndex(index)
            flippedString.insert(string.uppercaseString[index], atIndex: index)
        } else {
            flippedString.removeAtIndex(index)
            flippedString.insert(string.lowercaseString[index], atIndex: index)
        }
    }
    return flippedString
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    var flippedString = string
    for index in 0..<string.characters.count {
        if string.lowercaseString.hasPrefix(string.characters[index]) {
            flippedString.removeAtIndex(index)
            flippedString.insert(string.uppercaseString[index], atIndex: index)
        } else {
            flippedString.removeAtIndex(index)
            flippedString.insert(string.lowercaseString[index], atIndex: index)
        }
    }
    return flippedString
}
```
for index in 0..<string.characters.count { // 'characters' is unavailable: Please use String directly
if string.lowercaseString.hasPrefix(string.characters[index]) { // value of type 'String' has no member 'lowercaseString'
flippedString.removeAtIndex(index) // value of type 'String' has no member 'removeAtIndex'
flippedString.insert(string.uppercaseString[index], atIndex: index) // value of type 'String' has no member 'uppercaseString'
flippedString.insert(string.uppercaseString[index], atIndex: index) // no exact matches in call to instance method 'insert'
flippedString.removeAtIndex(index) // value of type 'String' has no member 'removeAtIndex'
flippedString.insert(string.lowercaseString[index], atIndex: index) // no exact matches in call to instance method 'insert'
flippedString.insert(string.lowercaseString[index], atIndex: index) // value of type 'String' has no member 'lowercaseString'

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

func flipCase(string: String) -> String {
    let lowercase = string.lowercased()
    let uppercase = string.uppercased()
    return lowercase.map {
        if $0.isLowercase {
            return String(uppercase.characters.startIndex.advancedBy($0.advancedIndex(lowercase)))
        } else {
            return String(lowercase.characters.startIndex.advancedBy($0.advancedIndex(uppercase)))
        }
    }
}
```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 = string.lowercased()
    let uppercase = string.uppercased()
    return lowercase.map {
        if $0.isLowercase {
            return String(uppercase.characters.startIndex.advancedBy($0.advancedIndex(lowercase)))
        } else {
            return String(lowercase.characters.startIndex.advancedBy($0.advancedIndex(uppercase)))
        }
    }
}
```
return lowercase.map { // cannot convert return expression of type '[T]' to return type 'String'
return String(uppercase.characters.startIndex.advancedBy($0.advancedIndex(lowercase))) // value of type 'String.Index' has no member 'advancedBy'
return String(uppercase.characters.startIndex.advancedBy($0.advancedIndex(lowercase))) // value of type 'String.Element' (aka 'Character') has no member 'advancedIndex'

func flipCase(string: String) -> String {
    let lowercase = string.lowercaseString
    let uppercase = string.uppercaseString
    return lowercase.enumerate()
       .reduce(String()) {
            (partial, element) -> String in
            let (index, character) = element
            if character.isLowercase {
                return partial + uppercase[index]
            } else {
                return partial + lowercase[index]
            }
    }
}
```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 = string.lowercaseString
    let uppercase = string.uppercaseString
    return lowercase.enumerate()
       .reduce(String()) {
            (partial, element) -> String in
            let (index, character) = element
            if character.isLowercase {
                return partial + uppercase[index]
            } else {
                return partial + lowercase[index]
            }
    }
}
```
let lowercase = string.lowercaseString // value of type 'String' has no member 'lowercaseString'
let uppercase = string.uppercaseString // value of type 'String' has no member 'uppercaseString'

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

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

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

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

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

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

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

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

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

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

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

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    var result = [String]()
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```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] {
    var result = [String]()
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    var result: [String] = []
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```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] {
    var result: [String] = []
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    var result: [String] = []
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```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] {
    var result: [String] = []
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    var result: [String] = []
    for s in strings {
        if s.hasPrefix(prefix) {
            result.append(s)
        }
    }
    return result
}
```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] {
    var result: [String] = []
    for s in strings {
        if s.hasPrefix(prefix) {
            result.append(s)
        }
    }
    return result
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    var result = [String]()
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```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] {
    var result = [String]()
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    var result: [String] = []
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```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] {
    var result: [String] = []
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    var result: [String] = []
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```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] {
    var result: [String] = []
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    var result = [String]()
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```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] {
    var result = [String]()
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    var result: [String] = []
    for s in strings {
        if s.hasPrefix(prefix) {
            result.append(s)
        }
    }
    return result
}
```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] {
    var result: [String] = []
    for s in strings {
        if s.hasPrefix(prefix) {
            result.append(s)
        }
    }
    return result
}
```

func filterByPrefix(strings: [String], prefix: String) -> [String] {
    var result: [String] = []
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    return result
}
```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] {
    var result: [String] = []
    for string in strings {
        if string.hasPrefix(prefix) {
            result.append(string)
        }
    }
    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 positive = [Int]()
    for i in l {
        if i > 0 {
            positive.append(i)
        }
    }
    return positive
}
```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 positive = [Int]()
    for i in l {
        if i > 0 {
            positive.append(i)
        }
    }
    return positive
}
```

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 positive = [Int]()
    for i in l {
        if i > 0 {
            positive.append(i)
        }
    }
    return positive
}
```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 positive = [Int]()
    for i in l {
        if i > 0 {
            positive.append(i)
        }
    }
    return positive
}
```

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 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 isPrime(n: Int) -> Bool {
    if n <= 1 {
        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 {
    if n <= 1 {
        return false
    }
    for i in 2..n/2 {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```
for i in 2..n/2 { // cannot find operator '..' in scope; did you mean '...'?

func isPrime(n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    if n <= 3 {
        return true
    }
    if n % 2 == 0 || n % 3 == 0 {
        return false
    }
    for i in 5..<Int.max / 2 {
        if i * i > n {
            break
        }
        if n % i == 0 || n % (i + 2) == 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 <= 1 {
        return false
    }
    if n <= 3 {
        return true
    }
    if n % 2 == 0 || n % 3 == 0 {
        return false
    }
    for i in 5..<Int.max / 2 {
        if i * i > n {
            break
        }
        if n % i == 0 || n % (i + 2) == 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 {
    if n < 2 {
        return false
    }
    if n == 2 {
        return true
    }
    if n % 2 == 0 {
        return false
    }
    for i in 3...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
    }
    if n == 2 {
        return true
    }
    if n % 2 == 0 {
        return false
    }
    for i in 3...Int(sqrt(Double(n))) {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```
 // Fatal error: Range requires lowerBound <= upperBound

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

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 {
    if n <= 1 {
        return false
    }
    if n == 2 {
        return true
    }
    if n % 2 == 0 {
        return false
    }
    for i in 3...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 <= 1 {
        return false
    }
    if n == 2 {
        return true
    }
    if n % 2 == 0 {
        return false
    }
    for i in 3...Int(sqrt(Double(n))) {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```
 // Fatal error: Range requires lowerBound <= upperBound

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

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 {
    if n <= 1 {
        return false
    }
    if n <= 3 {
        return true
    }
    if n % 2 == 0 || n % 3 == 0 {
        return false
    }
    for i in 5..<Int(sqrt(Double(n))) {
        if n % i == 0 || n % (i + 2) == 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 <= 1 {
        return false
    }
    if n <= 3 {
        return true
    }
    if n % 2 == 0 || n % 3 == 0 {
        return false
    }
    for i in 5..<Int(sqrt(Double(n))) {
        if n % i == 0 || n % (i + 2) == 0 {
            return false
        }
    }
    return true
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func sortThird(l: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0...l.count-1 {
        if i % 3!= 0 {
            result.append(l[i])
        } else {
            result.append(l[i])
        }
    }
    return result
}
```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 result: [Int] = []
    for i in 0...l.count-1 {
        if i % 3!= 0 {
            result.append(l[i])
        } else {
            result.append(l[i])
        }
    }
    return result
}
```
if i % 3!= 0 { // cannot force unwrap value of non-optional type 'Int'
if i % 3!= 0 { // '=' must have consistent whitespace on both sides
if i % 3!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 3!= 0 { // expression is not assignable: binary operator returns immutable value

func sortThird(l: [Int]) -> [Int] {
    var lPrime = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime[i] = lPrime[i] + 1
        }
    }
    return lPrime
}
```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 lPrime = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime[i] = lPrime[i] + 1
        }
    }
    return lPrime
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var lPrime = l
    for i in 0...l.count-1 {
        if i % 3 == 0 {
            lPrime[i] = l[i]
        }
    }
    return lPrime
}
```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 lPrime = l
    for i in 0...l.count-1 {
        if i % 3 == 0 {
            lPrime[i] = l[i]
        }
    }
    return lPrime
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var lPrime = [Int]()
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime.append(l[i])
        } else {
            lPrime.append(l[i])
        }
    }
    lPrime.sort()
    return lPrime
}
```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 lPrime = [Int]()
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime.append(l[i])
        } else {
            lPrime.append(l[i])
        }
    }
    lPrime.sort()
    return lPrime
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var lPrime = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime[i] = lPrime[i] + 1
        }
    }
    return lPrime
}
```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 lPrime = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime[i] = lPrime[i] + 1
        }
    }
    return lPrime
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var lPrime = l
    for i in 0..<lPrime.count {
        if i % 3 == 0 {
            lPrime[i] = lPrime[i] + 1
        }
    }
    return lPrime
}
```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 lPrime = l
    for i in 0..<lPrime.count {
        if i % 3 == 0 {
            lPrime[i] = lPrime[i] + 1
        }
    }
    return lPrime
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var lPrime = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime[i] = l[i]
        }
    }
    return lPrime
}
```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 lPrime = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime[i] = l[i]
        }
    }
    return lPrime
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var lPrime = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime[i] = l[i]
        }
    }
    return lPrime
}
```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 lPrime = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime[i] = l[i]
        }
    }
    return lPrime
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var lPrime = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime[i] = l[i]
        }
    }
    return lPrime
}
```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 lPrime = l
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime[i] = l[i]
        }
    }
    return lPrime
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var lPrime = [Int]()
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime.append(l[i])
        } else {
            lPrime.append(l[i])
        }
    }
    return lPrime
}
```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 lPrime = [Int]()
    for i in 0..<l.count {
        if i % 3 == 0 {
            lPrime.append(l[i])
        } else {
            lPrime.append(l[i])
        }
    }
    return lPrime
}
```
 // 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
}
```
if!result.contains(i) { // expected expression, var, or let in 'if' condition

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
}
```
if!result.contains(i) { // expected expression, var, or let in 'if' condition

func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    var seen = [Int]()
    for i in l {
        if!seen.contains(i) {
            seen.append(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]()
    var seen = [Int]()
    for i in l {
        if!seen.contains(i) {
            seen.append(i)
            result.append(i)
        }
    }
    return result
}
```
if!seen.contains(i) { // expected expression, var, or let in 'if' condition

func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    var seen = [Int]()
    for i in l {
        if!seen.contains(i) {
            result.append(i)
            seen.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]()
    var seen = [Int]()
    for i in l {
        if!seen.contains(i) {
            result.append(i)
            seen.append(i)
        }
    }
    return result
}
```
if!seen.contains(i) { // expected expression, var, or let in 'if' condition

func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    var seen = [Int: Bool]()
    for i in l {
        if!seen[i] {
            seen[i] = true
            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]()
    var seen = [Int: Bool]()
    for i in l {
        if!seen[i] {
            seen[i] = true
            result.append(i)
        }
    }
    return result
}
```
if!seen[i] { // expected expression, var, or let in 'if' condition

func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    var map = [Int: Bool]()
    for i in l {
        if!map[i] {
            result.append(i)
            map[i] = true
        }
    }
    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]()
    var map = [Int: Bool]()
    for i in l {
        if!map[i] {
            result.append(i)
            map[i] = true
        }
    }
    return result
}
```
if!map[i] { // expected expression, var, or let in 'if' condition

func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    var map = [Int: Bool]()
    for i in l {
        if!map[i] {
            result.append(i)
            map[i] = true
        }
    }
    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]()
    var map = [Int: Bool]()
    for i in l {
        if!map[i] {
            result.append(i)
            map[i] = true
        }
    }
    return result
}
```
if!map[i] { // expected expression, var, or let in 'if' condition

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
}
```
if!result.contains(i) { // expected expression, var, or let in 'if' condition

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
}
```
if!result.contains(i) { // expected expression, var, or let in 'if' condition

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
}
```
if!result.contains(i) { // expected expression, var, or let in 'if' condition

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

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

func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        if i % 11 == 0 || i % 13 == 0 {
            if i % 11 == 0 {
                count += 1
            } else {
                count += 2
            }
        }
    }
    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 % 11 == 0 {
                count += 1
            } else {
                count += 2
            }
        }
    }
    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 % 11 == 0 {
                count += 1
            }
            if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            }
            if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            }
            if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            }
            if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            } else if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            } else if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            }
            if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            }
            if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            } else if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            } else if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            } else if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            } else if i % 13 == 0 {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 0...n-1 {
        if i % 11 == 0 || i % 13 == 0 {
            if i % 3 == 0 {
                count += 1
            } else if i % 5 == 0 {
                count += 1
            } else if i % 7 == 0 {
                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-1 {
        if i % 11 == 0 || i % 13 == 0 {
            if i % 3 == 0 {
                count += 1
            } else if i % 5 == 0 {
                count += 1
            } else if i % 7 == 0 {
                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 % 11 == 0 {
                count += 1
            } else if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            } else if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            }
            if i % 13 == 0 {
                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 % 11 == 0 {
                count += 1
            }
            if i % 13 == 0 {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    var l2 = [Int]()
    for i in 0...l.count-1 {
        if i % 2 == 0 {
            l2.append(l[i])
        }
    }
    l2.sort()
    return l2
}
```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 l2 = [Int]()
    for i in 0...l.count-1 {
        if i % 2 == 0 {
            l2.append(l[i])
        }
    }
    l2.sort()
    return l2
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    var sorted = l
    for i in 0..<l.count/2 {
        if i % 2 == 0 {
            var j = i + 1
            while j < l.count {
                if l[j] < l[i] {
                    var temp = l[j]
                    l[j] = l[i]
                    l[i] = temp
                }
                j += 2
            }
        }
    }
    return sorted
}
```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 sorted = l
    for i in 0..<l.count/2 {
        if i % 2 == 0 {
            var j = i + 1
            while j < l.count {
                if l[j] < l[i] {
                    var temp = l[j]
                    l[j] = l[i]
                    l[i] = temp
                }
                j += 2
            }
        }
    }
    return sorted
}
```
l[j] = l[i] // cannot assign through subscript: 'l' is a 'let' constant
l[i] = temp // cannot assign through subscript: 'l' is a 'let' constant

func sortEven(l: [Int]) -> [Int] {
    var result = [Int]()
    for (i, v) in l.enumerate() {
        if i % 2 == 0 {
            result.append(v)
        }
    }
    result.sort()
    return result
}
```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 result = [Int]()
    for (i, v) in l.enumerate() {
        if i % 2 == 0 {
            result.append(v)
        }
    }
    result.sort()
    return result
}
```
for (i, v) in l.enumerate() { // value of type '[Int]' has no member 'enumerate'

func sortEven(l: [Int]) -> [Int] {
    var result = [Int]()
    for (i, v) in l.enumerate() {
        if i % 2 == 0 {
            result.append(v)
        }
    }
    result.sort()
    return result
}
```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 result = [Int]()
    for (i, v) in l.enumerate() {
        if i % 2 == 0 {
            result.append(v)
        }
    }
    result.sort()
    return result
}
```
for (i, v) in l.enumerate() { // value of type '[Int]' has no member 'enumerate'

func sortEven(l: [Int]) -> [Int] {
    var result = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            // Sort the even indicies
            result.sortInPlace { $0 > $1 }
        }
    }
    return result
}
```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 result = l
    for i in 0..<l.count {
        if i % 2 == 0 {
            // Sort the even indicies
            result.sortInPlace { $0 > $1 }
        }
    }
    return result
}
```
result.sortInPlace { $0 > $1 } // value of type '[Int]' has no member 'sortInPlace'

func sortEven(l: [Int]) -> [Int] {
    var sorted = l
    for i in 0..<l.count/2 {
        if l[i]!= l[i*2] {
            sorted[i*2] = l[i]
        }
    }
    return sorted
}
```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 sorted = l
    for i in 0..<l.count/2 {
        if l[i]!= l[i*2] {
            sorted[i*2] = l[i]
        }
    }
    return sorted
}
```
if l[i]!= l[i*2] { // cannot force unwrap value of non-optional type 'Int'
if l[i]!= l[i*2] { // use of '=' in a boolean context, did you mean '=='?
if l[i]!= l[i*2] { // '=' must have consistent whitespace on both sides

func sortEven(l: [Int]) -> [Int] {
    var result = [Int]()
    for (index, value) in enumerate(l) {
        if index % 2 == 0 {
            result.append(value)
        }
    }
    result.sort()
    return result
}
```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 result = [Int]()
    for (index, value) in enumerate(l) {
        if index % 2 == 0 {
            result.append(value)
        }
    }
    result.sort()
    return result
}
```
for (index, value) in enumerate(l) { // cannot find 'enumerate' in scope

func sortEven(l: [Int]) -> [Int] {
    var sorted = l
    for i in 0..<l.count/2 {
        if i % 2 == 0 {
            if l[i] > l[i+1] {
                sorted[i] = l[i+1]
                sorted[i+1] = l[i]
            }
        }
    }
    return sorted
}
```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 sorted = l
    for i in 0..<l.count/2 {
        if i % 2 == 0 {
            if l[i] > l[i+1] {
                sorted[i] = l[i+1]
                sorted[i+1] = l[i]
            }
        }
    }
    return sorted
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<l.count {
        if i % 2 == 0 {
            result.append(l[i])
        }
    }
    result.sort()
    return result
}
```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 result = [Int]()
    for i in 0..<l.count {
        if i % 2 == 0 {
            result.append(l[i])
        }
    }
    result.sort()
    return result
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    var result = l
    for i in 0..<l.count/2 {
        if i % 2 == 0 {
            if l[i] > l[i+1] {
                result[i] = l[i+1]
                result[i+1] = l[i]
            }
        }
    }
    return result
}
```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 result = l
    for i in 0..<l.count/2 {
        if i % 2 == 0 {
            if l[i] > l[i+1] {
                result[i] = l[i+1]
                result[i+1] = l[i]
            }
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func primeFib(n: Int) -> Int {
    let fib = fibonacci(n)
    for i in 2..<fib {
        if fib % i == 0 {
            return i
        }
    }
    return fib
}
```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 {
    let fib = fibonacci(n)
    for i in 2..<fib {
        if fib % i == 0 {
            return i
        }
    }
    return fib
}
```
let fib = fibonacci(n) // cannot find 'fibonacci' in scope

func primeFib(n: Int) -> Int {
    if n < 1 {
        fatalError("n must be greater than 0")
    }
    
    var fib1 = 1
    var fib2 = 1
    var fib3 = 0
    var fib4 = 0
    
    for i in 1...n {
        fib4 = fib3
        fib3 = fib2
        fib2 = fib1
        fib1 = fib1 + fib2
        if isPrime(fib1) {
            return fib1
        }
    }
    
    fatalError("n must be less than the number of Fibonacci numbers")
}
```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 {
    if n < 1 {
        fatalError("n must be greater than 0")
    }
    
    var fib1 = 1
    var fib2 = 1
    var fib3 = 0
    var fib4 = 0
    
    for i in 1...n {
        fib4 = fib3
        fib3 = fib2
        fib2 = fib1
        fib1 = fib1 + fib2
        if isPrime(fib1) {
            return fib1
        }
    }
    
    fatalError("n must be less than the number of Fibonacci numbers")
}
```
if isPrime(fib1) { // cannot find 'isPrime' in scope

func primeFib(n: Int) -> Int {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Int'

func primeFib(n: Int) -> Int {
    var a = 0
    var b = 1
    var c = 1
    var i = 1
    while i < n {
        a = b
        b = c
        c = a + b
        if isPrime(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 = 0
    var b = 1
    var c = 1
    var i = 1
    while i < n {
        a = b
        b = c
        c = a + b
        if isPrime(c) {
            i += 1
        }
    }
    return c
}
```
if isPrime(c) { // cannot find 'isPrime' in scope

func primeFib(n: Int) -> Int {
    var fib = fibonacci(n)
    var prime = prime(n)
    return fib * prime
}
```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 fib = fibonacci(n)
    var prime = prime(n)
    return fib * prime
}
```
var fib = fibonacci(n) // cannot find 'fibonacci' in scope
var prime = prime(n) // use of local variable 'prime' before its declaration
return fib * prime // cannot convert return expression of type 'Duration' to return type 'Int'

func primeFib(n: Int) -> Int {
    if n < 2 {
        return 2
    }
    var a = 0
    var b = 1
    var c = 1
    var count = 0
    while count < n {
        c = a + b
        if isPrime(c) {
            a = b
            b = c
            count += 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 {
    if n < 2 {
        return 2
    }
    var a = 0
    var b = 1
    var c = 1
    var count = 0
    while count < n {
        c = a + b
        if isPrime(c) {
            a = b
            b = c
            count += 1
        }
    }
    return c
}
```
if isPrime(c) { // cannot find 'isPrime' in scope

func primeFib(n: Int) -> Int {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Int'

func primeFib(n: Int) -> Int {
    var fib = [Int]()
    var i = 0
    var a = 0
    var b = 1
    var c = 0
    var next = 0
    while i < n {
        next = a + b
        a = b
        b = next
        if isPrime(next) {
            fib.append(next)
            i = i + 1
        }
    }
    return fib[n-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 fib = [Int]()
    var i = 0
    var a = 0
    var b = 1
    var c = 0
    var next = 0
    while i < n {
        next = a + b
        a = b
        b = next
        if isPrime(next) {
            fib.append(next)
            i = i + 1
        }
    }
    return fib[n-1]
}
```
if isPrime(next) { // cannot find 'isPrime' in scope

func primeFib(n: Int) -> Int {
    let fib = fibonacci(n)
    for i in 0..<fib.count {
        if!isPrime(fib[i]) {
            return fib[i]
        }
    }
    return fib[fib.count - 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 {
    let fib = fibonacci(n)
    for i in 0..<fib.count {
        if!isPrime(fib[i]) {
            return fib[i]
        }
    }
    return fib[fib.count - 1]
}
```
let fib = fibonacci(n) // cannot find 'fibonacci' in scope
if!isPrime(fib[i]) { // expected expression, var, or let in 'if' condition

func primeFib(n: Int) -> Int {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Int'

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: implement me!
}
```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 me!
}
```
} // missing return in global function expected to return 'Bool'

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: implement me!
}
```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 me!
}
```
} // missing return in global function expected to return 'Bool'

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: implement me!
}
```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 me!
}
```
} // missing return in global function expected to return 'Bool'

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: implement me!
}
```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 me!
}
```
} // missing return in global function expected to return 'Bool'

func triplesSumToZero(l: [Int]) -> Bool {
    var sum = 0
    for i in 0..<l.count {
        for j in 0..<l.count {
            if i!= j {
                sum = l[i] + l[j]
                if sum == 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 sum = 0
    for i in 0..<l.count {
        for j in 0..<l.count {
            if i!= j {
                sum = l[i] + l[j]
                if sum == 0 {
                    return true
                }
            }
        }
    }
    return false
}
```
if i!= j { // cannot force unwrap value of non-optional type 'Int'
if i!= j { // '=' must have consistent whitespace on both sides
if i!= j { // use of '=' in a boolean context, did you mean '=='?

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: implement me!
}
```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 me!
}
```
} // missing return in global function expected to return 'Bool'

func triplesSumToZero(l: [Int]) -> Bool {
    var sum = 0
    for i in 0..<l.count {
        for j in 0..<l.count {
            for k in 0..<l.count {
                if i!= j && i!= k && j!= k {
                    sum = l[i] + l[j] + l[k]
                    if sum == 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 sum = 0
    for i in 0..<l.count {
        for j in 0..<l.count {
            for k in 0..<l.count {
                if i!= j && i!= k && j!= k {
                    sum = l[i] + l[j] + l[k]
                    if sum == 0 {
                        return true
                    }
                }
            }
        }
    }
    return false
}
```
if i!= j && i!= k && j!= k { // '=' must have consistent whitespace on both sides
if i!= j && i!= k && j!= k { // '=' must have consistent whitespace on both sides
if i!= j && i!= k && j!= k { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if i!= j && i!= k && j!= k { // use of '=' in a boolean context, did you mean '=='?
if i!= j && i!= k && j!= k { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if i!= j && i!= k && j!= k { // cannot force unwrap value of non-optional type 'Int'
if i!= j && i!= k && j!= k { // cannot force unwrap value of non-optional type 'Int'
if i!= j && i!= k && j!= k { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if i!= j && i!= k && j!= k { // cannot force unwrap value of non-optional type 'Int'
if i!= j && i!= k && j!= k { // cannot assign value of type '()' to type 'Int'
if i!= j && i!= k && j!= k { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if i!= j && i!= k && j!= k { // '=' must have consistent whitespace on both sides

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: implement me!
}
```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 me!
}
```
} // missing return in global function expected to return 'Bool'

func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: implement me!
}
```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 me!
}
```
} // missing return in global function expected to return 'Bool'

func triplesSumToZero(l: [Int]) -> Bool {
    var sum = 0
    for i in l {
        sum += i
    }
    if sum < 0 {
        return false
    }
    for i in l {
        for j in l {
            if i == j {
                continue
            }
            if i + j == -sum {
                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 sum = 0
    for i in l {
        sum += i
    }
    if sum < 0 {
        return false
    }
    for i in l {
        for j in l {
            if i == j {
                continue
            }
            if i + j == -sum {
                return true
            }
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Int'

```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 {
    // TODO: Implement this function.
    // You should use a for loop to iterate through the cars.
    // You should use a while loop to check if two cars collide.
    // You should use a break statement to exit the while loop when two cars collide.
    // You should use a continue statement to skip the rest of the cars when two cars collide.
    // You should use a return statement to return the number of collisions.
    // You should use a guard statement to handle the case when n <= 0.
    // You should use a guard statement to handle the case when n == 1.
    // You should use a guard statement to handle the case when n > 1.
    // You should use a guard statement to handle the case when n > 2.
    // You should use a guard statement to handle the case when n > 3.
    // You should use a guard statement to handle the case when n > 4.
    // You should use a guard statement to handle the case when n > 5.
    // You should use a guard statement to handle the case when n > 6.
    // You should use a guard statement to handle the case when n > 7.
    // You should use a guard statement to handle the case when n > 8.
    // You should use a guard statement to handle the case when n > 9.
    // You should use a guard statement to handle the case when n > 10.
    // You should use a guard statement to handle the case when n > 11.
    // You should use a guard statement to handle the case when n > 12.
    // You should use a guard statement to handle the case when n > 13.
    // You should use a guard statement to handle the case when n > 14.
    // You should use a guard statement to handle the case when n > 15.
    // You should use a guard statement to handle the case when n > 16.
    // You should use a guard statement to handle the case when n > 17.
    // You should use a guard statement to handle the case when n > 18.
    // You should use a guard statement to handle the case when n > 19.
    // You should use a guard statement to handle the case when n > 20.
    // You should use a guard statement to handle the case when n > 21.
    // You should use a guard statement to handle the case when n > 22.
    // You should use a guard statement to handle the case when n > 23.
    // You should use a guard statement to handle the case when n > 24.
    // You should use a guard statement to handle the case when n > 25.
    // You should use a guard statement to handle the case when n > 26.
    // You should use a guard statement to handle the case when n > 27.
    // You should use a guard statement to handle the case when n > 28.
    // You should use a guard statement to handle the case when n > 29.
    // You should use a guard statement to handle the case when n > 30.
    // You should use a guard statement to handle the case when n > 31.
    // You should use a guard statement to handle the case when n > 32.
    // You should use a guard statement to handle the case when n > 33.
    // You should use a guard statement to handle the case when n > 34.
    // You should use a guard statement to handle the case when n > 35.
    // You should use a guard statement to handle the case when n > 36.
    // You should use a guard statement to handle the case when n > 37.
    // You should use a guard statement to handle the case when n > 38.
    // You should use a guard statement to handle the case when n > 39.
    // You should use a guard statement to handle the case when n > 40.
    // You should use a guard statement to handle the case when n > 41.
    // You should use a guard statement to handle the case when n > 42.
    // You should use a guard statement to handle the case when n > 43.
    // You should use a guard statement to handle the case when n > 44.
    // You should use a guard statement to handle the case when n > 45.
    // You should use a guard statement to handle the case when n > 46.
    // You should use a guard statement to handle the case when n > 47.
    // You should use a guard statement to handle the case when n > 48.
    // You should use a guard statement to handle the case when n > 49.
    // You should use
XCTAssertTrue(carRaceCollision(n: 2) == 4) // cannot find 'carRaceCollision' in scope
XCTAssertTrue(carRaceCollision(n: 3) == 9) // cannot find 'carRaceCollision' in scope
XCTAssertTrue(carRaceCollision(n: 4) == 16) // cannot find 'carRaceCollision' in scope
XCTAssertTrue(carRaceCollision(n: 8) == 64) // cannot find 'carRaceCollision' in scope
XCTAssertTrue(carRaceCollision(n: 10) == 100) // cannot find 'carRaceCollision' in scope

func carRaceCollision(n: Int) -> Int {
    // TODO: Implement this function.
    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 {
    // TODO: Implement this function.
    return 0
}
```
 // XCTAssertTrue failed

func carRaceCollision(n: Int) -> Int {
    // TODO: Implement this function.
    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 {
    // TODO: Implement this function.
    return 0
}
```
 // 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

```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 {
    // TODO: Implement this function.
    // You can use the following variables to help you:
    //   - cars: An array of cars.
    //   - collisions: The number of collisions.
    //   - left: The cars moving left to right.
    //   - right: The cars moving right to left.
    //   - leftIndex: The index of the car that's moving left to right.
    //   - rightIndex: The index of the car that's moving right to left.
    //   - leftSpeed: The speed of the cars moving left to right.
    //   - rightSpeed: The speed of the cars moving right to left.
    //   - leftCar: The car that's moving left to right.
    //   - rightCar: The car that's moving right to left.
    //   - leftDistance: The distance between the left car and the right car.
    //   - rightDistance: The distance between the left car and the right car.
    //   - leftCarSpeed: The speed of the left car.
    //   - rightCarSpeed: The speed of the right car.
    //   - leftCarDistance: The distance between the left car and the right car.
    //   - rightCarDistance: The distance between the left car and the right car.
    //   - leftCarCollision: Whether the left car collided.
    //   - rightCarCollision: Whether the right car collided.
    //   - leftCarCollisionDistance: The distance between the left car and the right car.
    //   - rightCarCollisionDistance: The distance between the left car and the right car.
    //   - leftCarCollisionSpeed: The speed of the left car.
    //   - rightCarCollisionSpeed: The speed of the right car.
    //   - leftCarCollisionDistance: The distance between the left car and the right car.
    //   - rightCarCollisionDistance: The distance between the left car and the right car.
    //   - leftCarCollisionSpeed: The speed of the left car.
    //   - rightCarCollisionSpeed: The speed of the right car.
    //   - leftCarCollisionDistance: The distance between the left car and the right car.
    //   - rightCarCollisionDistance: The distance between the left car and the right car.
    //   - leftCarCollisionSpeed: The speed of the left car.
    //   - rightCarCollisionSpeed: The speed of the right car.
    //   - leftCarCollisionDistance: The distance between the left car and the right car.
    //   - rightCarCollisionDistance: The distance between the left car and the right car.
    //   - leftCarCollisionSpeed: The speed of the left car.
    //   - rightCarCollisionSpeed: The speed of the right car.
    //   - leftCarCollisionDistance: The distance between the left car and the right car.
    //   - rightCarCollisionDistance: The distance between the left car and the right car.
    //   - leftCarCollisionSpeed: The speed of the left car.
    //   - rightCarCollisionSpeed: The speed of the right car.
    //   - leftCarCollisionDistance: The distance between the left car and the right car.
    //   - rightCarCollisionDistance: The distance between the left car and the right car.
    //   - leftCarCollisionSpeed: The speed of the left car.
    //   - rightCarCollisionSpeed: The speed of the right car.
    //   - leftCarCollisionDistance: The distance between the left car and the right car.
    //   - rightCarCollisionDistance: The distance between the left car and the right car.
    //   - leftCarCollisionSpeed: The speed of the left car.
    //   - rightCarCollisionSpeed: The speed of the right car.
    //   - leftCarCollisionDistance: The distance between the left car and the right car.
    //   - rightCarCollisionDistance: The distance between the left car and the right car.
    //   - leftCarCollisionSpeed: The speed of the left car.
    //   - rightCarCollisionSpeed: The speed of the right car.
    //   - leftCarCollisionDistance: The distance between the left car and the right car.
    //   - rightCarCollisionDistance: The distance between the left car and the right car.
    //   - leftCarCollisionSpeed:
XCTAssertTrue(carRaceCollision(n: 2) == 4) // cannot find 'carRaceCollision' in scope
XCTAssertTrue(carRaceCollision(n: 3) == 9) // cannot find 'carRaceCollision' in scope
XCTAssertTrue(carRaceCollision(n: 4) == 16) // cannot find 'carRaceCollision' in scope
XCTAssertTrue(carRaceCollision(n: 8) == 64) // cannot find 'carRaceCollision' in scope
XCTAssertTrue(carRaceCollision(n: 10) == 100) // cannot find 'carRaceCollision' in scope

func carRaceCollision(n: Int) -> Int {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func carRaceCollision(n: Int) -> Int {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func carRaceCollision(n: Int) -> Int {
    // TODO: Implement this function.
    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 {
    // TODO: Implement this function.
    return 0
}
```
 // 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 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 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 me!
}
```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 me!
}
```
} // missing return in global function expected to return 'Bool'

func pairsSumToZero(l: [Int]) -> Bool {
    var sum = 0
    for i in 0..<l.count {
        for j in 0..<l.count {
            if i!= j {
                sum = l[i] + l[j]
                if sum == 0 {
                    return true
                }
            }
        }
    }
    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 sum = 0
    for i in 0..<l.count {
        for j in 0..<l.count {
            if i!= j {
                sum = l[i] + l[j]
                if sum == 0 {
                    return true
                }
            }
        }
    }
    return false
}
```
if i!= j { // cannot force unwrap value of non-optional type 'Int'
if i!= j { // '=' must have consistent whitespace on both sides
if i!= j { // use of '=' in a boolean context, did you mean '=='?

func pairsSumToZero(l: [Int]) -> Bool {
    var sum = 0
    for i in 0..<l.count {
        for j in 0..<l.count {
            if i!= j {
                sum = l[i] + l[j]
                if sum == 0 {
                    return true
                }
            }
        }
    }
    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 sum = 0
    for i in 0..<l.count {
        for j in 0..<l.count {
            if i!= j {
                sum = l[i] + l[j]
                if sum == 0 {
                    return true
                }
            }
        }
    }
    return false
}
```
if i!= j { // cannot force unwrap value of non-optional type 'Int'
if i!= j { // '=' must have consistent whitespace on both sides
if i!= j { // use of '=' in a boolean context, did you mean '=='?

func pairsSumToZero(l: [Int]) -> Bool {
    var sum = 0
    for i in 0..<l.count {
        for j in 0..<l.count {
            if i!= j {
                sum = l[i] + l[j]
                if sum == 0 {
                    return true
                }
            }
        }
    }
    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 sum = 0
    for i in 0..<l.count {
        for j in 0..<l.count {
            if i!= j {
                sum = l[i] + l[j]
                if sum == 0 {
                    return true
                }
            }
        }
    }
    return false
}
```
if i!= j { // cannot force unwrap value of non-optional type 'Int'
if i!= j { // '=' must have consistent whitespace on both sides
if i!= j { // use of '=' in a boolean context, did you mean '=='?

func pairsSumToZero(l: [Int]) -> Bool {
    // TODO: implement me!
}
```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 me!
}
```
} // missing return in global function expected to return 'Bool'

func pairsSumToZero(l: [Int]) -> Bool {
    // TODO: implement pairsSumToZero
    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 pairsSumToZero
    return false
}
```
 // XCTAssertTrue failed

func pairsSumToZero(l: [Int]) -> Bool {
    // TODO: implement pairsSumToZero
    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 pairsSumToZero
    return false
}
```
 // XCTAssertTrue failed

func pairsSumToZero(l: [Int]) -> Bool {
    var sum = 0
    for i in 0..<l.count {
        for j in 0..<l.count {
            if i!= j {
                sum = l[i] + l[j]
                if sum == 0 {
                    return true
                }
            }
        }
    }
    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 sum = 0
    for i in 0..<l.count {
        for j in 0..<l.count {
            if i!= j {
                sum = l[i] + l[j]
                if sum == 0 {
                    return true
                }
            }
        }
    }
    return false
}
```
if i!= j { // cannot force unwrap value of non-optional type 'Int'
if i!= j { // '=' must have consistent whitespace on both sides
if i!= j { // use of '=' in a boolean context, did you mean '=='?

func pairsSumToZero(l: [Int]) -> Bool {
    // TODO: implement pairsSumToZero
    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 pairsSumToZero
    return false
}
```
 // XCTAssertTrue failed

func pairsSumToZero(l: [Int]) -> Bool {
    // TODO: implement pairsSumToZero
    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 pairsSumToZero
    return false
}
```
 // XCTAssertTrue failed

func changeBase(x: Int, base: Int) -> String {
    // Your code here.
}
```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 {
    // Your code here.
}
```
} // missing return in global function expected to return 'String'

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var number = x
    var digits = "0123456789ABCDEF"
    
    while number > 0 {
        result = String(digits[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
    var digits = "0123456789ABCDEF"
    
    while number > 0 {
        result = String(digits[number % base]) + result
        number /= base
    }
    
    return result
}
```
var digits = "0123456789ABCDEF" // variable 'digits' was never mutated; consider changing to 'let' constant
result = String(digits[number % base]) + result // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var remainder = x
    var power = 1
    while remainder > 0 {
        var digit = remainder % base
        if digit < 10 {
            result = String(UnicodeScalar(digit + 48)) + result
        } else {
            result = String(UnicodeScalar(digit + 87)) + result
        }
        remainder = remainder / base
        power = power * 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
    var power = 1
    while remainder > 0 {
        var digit = remainder % base
        if digit < 10 {
            result = String(UnicodeScalar(digit + 48)) + result
        } else {
            result = String(UnicodeScalar(digit + 87)) + result
        }
        remainder = remainder / base
        power = power * base
    }
    return result
}
```
result = String(UnicodeScalar(digit + 48)) + result // value of optional type 'UnicodeScalar?' (aka 'Optional<Unicode.Scalar>') must be unwrapped to a value of type 'UnicodeScalar' (aka 'Unicode.Scalar')
result = String(UnicodeScalar(digit + 87)) + result // value of optional type 'UnicodeScalar?' (aka 'Optional<Unicode.Scalar>') must be unwrapped to a value of type 'UnicodeScalar' (aka 'Unicode.Scalar')

func changeBase(x: Int, base: Int) -> String {
    // TODO:
    // 1. convert x to string
    // 2. convert base to string
    // 3. replace x with base
    // 4. return x
}
```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 {
    // TODO:
    // 1. convert x to string
    // 2. convert base to string
    // 3. replace x with base
    // 4. return x
}
```
} // missing return in global function expected to return 'String'

func changeBase(x: Int, base: Int) -> String {
    // TODO:
    // return string representation after the conversion.
    // base numbers are less than 10.
    var result = ""
    var temp = x
    var i = 0
    while temp > 0 {
        var remainder = temp % base
        if remainder > 9 {
            remainder = remainder - 10
        }
        result = String(format: "%d%@", remainder, result)
        temp = temp / 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 {
    // TODO:
    // return string representation after the conversion.
    // base numbers are less than 10.
    var result = ""
    var temp = x
    var i = 0
    while temp > 0 {
        var remainder = temp % base
        if remainder > 9 {
            remainder = remainder - 10
        }
        result = String(format: "%d%@", remainder, result)
        temp = temp / base
    }
    return result
}
```
var i = 0 // initialization of variable 'i' was never used; consider replacing with assignment to '_' or removing it

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var remainder = x
    while remainder > 0 {
        let digit = remainder % base
        result = String(format: "%d%@", digit, result)
        remainder = 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 {
        let digit = remainder % base
        result = String(format: "%d%@", digit, result)
        remainder = remainder / base
    }
    return result
}
```

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var number = x
    var baseDigits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
    var baseDigits2 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]
    
    while number > 0 {
        result = baseDigits[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
    var baseDigits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
    var baseDigits2 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]
    
    while number > 0 {
        result = baseDigits[number % base] + result
        number /= base
    }
    
    return result
}
```
var baseDigits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] // variable 'baseDigits' was never mutated; consider changing to 'let' constant
var baseDigits2 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"] // initialization of variable 'baseDigits2' was never used; consider replacing with assignment to '_' or removing it

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var temp = x
    var remainder = 0
    while temp > 0 {
        remainder = temp % base
        temp = temp / base
        result = String(format: "%d%@", remainder, result)
    }
    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 temp = x
    var remainder = 0
    while temp > 0 {
        remainder = temp % base
        temp = temp / base
        result = String(format: "%d%@", remainder, result)
    }
    return result
}
```

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var remainder = x
    var divider = 1
    
    while remainder > 0 {
        let digit = remainder % base
        remainder = remainder / base
        
        result = String(format: "%d%@", digit, result)
        divider = divider * 10
    }
    
    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
    var divider = 1
    
    while remainder > 0 {
        let digit = remainder % base
        remainder = remainder / base
        
        result = String(format: "%d%@", digit, result)
        divider = divider * 10
    }
    
    return result
}
```

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var number = x
    var digit = 0
    while number > 0 {
        digit = number % base
        number = number / base
        result = String(format: "%d%@", digit, result)
    }
    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
    var digit = 0
    while number > 0 {
        digit = number % base
        number = number / base
        result = String(format: "%d%@", digit, result)
    }
    return result
}
```

func triangleArea(a: Int, h: Int) -> Double {
    return 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 a * h / 2
}
```
return a * h / 2 // cannot convert return expression of type 'Int' to return type 'Double'

func triangleArea(a: Int, h: Int) -> Double {
    return 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 a * h / 2
}
```
return a * h / 2 // cannot convert return expression of type 'Int' to return type 'Double'

func triangleArea(a: Int, h: Int) -> Double {
    return 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 a * h / 2
}
```
return a * h / 2 // cannot convert return expression of type 'Int' to return type 'Double'

func triangleArea(a: Int, h: Int) -> Double {
    return 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 a * h / 2
}
```
return a * h / 2 // cannot convert return expression of type 'Int' to return type 'Double'

func triangleArea(a: Int, h: Int) -> Double {
    return 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 a * h / 2
}
```
return a * h / 2 // cannot convert return expression of type 'Int' to return type 'Double'

func triangleArea(a: Int, h: Int) -> Double {
    return 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 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 a * h / 2
}
```
return a * h / 2 // cannot convert return expression of type 'Int' to return type 'Double'

func triangleArea(a: Int, h: Int) -> Double {
    return 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 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 a * h / 2
}
```
return a * h / 2 // cannot convert return expression of type 'Int' to return type 'Double'

func triangleArea(a: Int, h: Int) -> Double {
    return 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 a * h / 2
}
```
return a * h / 2 // cannot convert return expression of type 'Int' to return type 'Double'

func triangleArea(a: Int, h: Int) -> Double {
    return Double(a) * Double(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) * Double(h) / 2
}
```

func triangleArea(a: Int, h: Int) -> Double {
    return Double(a) * Double(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) * Double(h) / 2
}
```

func fib4(n: Int) -> Int {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'Int'

func fib4(n: Int) -> Int {
    
    // TODO: Implement me!
    
}
```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 {
    
    // TODO: Implement me!
    
}
```
} // missing return in global function expected to return 'Int'

func fib4(n: Int) -> Int {
    // TODO: Your implementation goes here
}
```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 {
    // TODO: Your implementation goes here
}
```
} // missing return in global function expected to return 'Int'

func fib4(n: Int) -> Int {
    // TODO: Your implementation goes here
}
```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 {
    // TODO: Your implementation goes here
}
```
} // missing return in global function expected to return 'Int'

func fib4(n: Int) -> Int {
    // TODO: Your implementation goes here
}
```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 {
    // TODO: Your implementation goes here
}
```
} // missing return in global function expected to return 'Int'

func fib4(n: Int) -> Int {
    var a = 0
    var b = 0
    var c = 1
    var d = 1
    for _ in 1...n {
        a = b
        b = c
        c = d
        d = a + b + c
    }
    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 = 1
    var d = 1
    for _ in 1...n {
        a = b
        b = c
        c = d
        d = a + b + c
    }
    return d
}
```
 // XCTAssertTrue failed

func fib4(n: Int) -> Int {
    // TODO: Your implementation goes here.
    return 0
}
```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 {
    // TODO: Your implementation goes here.
    return 0
}
```
 // XCTAssertTrue failed

func fib4(n: Int) -> Int {
    
    // TODO: Your implementation goes here.
    
    return 0
}
```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 {
    
    // TODO: Your implementation goes here.
    
    return 0
}
```
 // XCTAssertTrue failed

func fib4(n: Int) -> Int {
    // TODO: Your implementation goes here
    return 0
}
```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 {
    // TODO: Your implementation goes here
    return 0
}
```
 // XCTAssertTrue failed

func fib4(n: Int) -> Int {
    // TODO: Add your code here
    // fib4(n: 5) == 4
    // fib4(n: 6) == 8
    // fib4(n: 7) == 14
    var fib4 = [Int]()
    fib4.append(0)
    fib4.append(0)
    fib4.append(2)
    fib4.append(0)
    
    for i in 3...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 {
    // TODO: Add your code here
    // fib4(n: 5) == 4
    // fib4(n: 6) == 8
    // fib4(n: 7) == 14
    var fib4 = [Int]()
    fib4.append(0)
    fib4.append(0)
    fib4.append(2)
    fib4.append(0)
    
    for i in 3...n {
        fib4.append(fib4[i-1] + fib4[i-2] + fib4[i-3] + fib4[i-4])
    }
    return fib4[n]
}
```
 // Fatal error: Index out of range

func median(l: [Int]) -> Double {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Double'

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let n = sorted.count
    let m = n / 2
    if n % 2 == 0 {
        return (sorted[m] + sorted[m - 1]) / 2
    } else {
        return sorted[m]
    }
}
```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 n = sorted.count
    let m = n / 2
    if n % 2 == 0 {
        return (sorted[m] + sorted[m - 1]) / 2
    } else {
        return sorted[m]
    }
}
```
return (sorted[m] + sorted[m - 1]) / 2 // cannot convert return expression of type 'Int' to return type 'Double'
return sorted[m] // cannot convert return expression of type 'Int' to return type 'Double'

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]) + Double(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]) + Double(sorted[middle])) / 2
    }
}
```

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)
    }
}
```
 // XCTAssertTrue failed

func median(l: [Int]) -> Double {
    var sorted = l
    sorted.sort()
    let mid = sorted.count / 2
    if sorted.count % 2 == 1 {
        return Double(sorted[mid])
    } else {
        return (Double(sorted[mid - 1]) + Double(sorted[mid])) / 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 {
    var sorted = l
    sorted.sort()
    let mid = sorted.count / 2
    if sorted.count % 2 == 1 {
        return Double(sorted[mid])
    } else {
        return (Double(sorted[mid - 1]) + Double(sorted[mid])) / 2
    }
}
```

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let n = sorted.count
    let i = n / 2
    if n % 2 == 0 {
        return (sorted[i] + sorted[i - 1]) / 2.0
    } else {
        return sorted[i]
    }
}
```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 n = sorted.count
    let i = n / 2
    if n % 2 == 0 {
        return (sorted[i] + sorted[i - 1]) / 2.0
    } else {
        return sorted[i]
    }
}
```
return (sorted[i] + sorted[i - 1]) / 2.0 // cannot convert value of type 'Int' to expected argument type 'Double'
return sorted[i] // cannot convert return expression of type 'Int' to return type 'Double'

func median(l: [Int]) -> Double {
    var sorted = l
    sorted.sort()
    var mid = sorted.count / 2
    if sorted.count % 2 == 0 {
        return (sorted[mid] + sorted[mid - 1]) / 2.0
    } else {
        return sorted[mid]
    }
}
```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 {
    var sorted = l
    sorted.sort()
    var mid = sorted.count / 2
    if sorted.count % 2 == 0 {
        return (sorted[mid] + sorted[mid - 1]) / 2.0
    } else {
        return sorted[mid]
    }
}
```
return (sorted[mid] + sorted[mid - 1]) / 2.0 // cannot convert value of type 'Int' to expected argument type 'Double'
return sorted[mid] // cannot convert return expression of type 'Int' to return type 'Double'

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let n = sorted.count
    if n % 2 == 0 {
        return (sorted[n/2] + sorted[n/2 - 1]) / 2.0
    } else {
        return 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 sorted = l.sorted()
    let n = sorted.count
    if n % 2 == 0 {
        return (sorted[n/2] + sorted[n/2 - 1]) / 2.0
    } else {
        return sorted[n/2]
    }
}
```
return (sorted[n/2] + sorted[n/2 - 1]) / 2.0 // cannot convert value of type 'Int' to expected argument type 'Double'
return sorted[n/2] // cannot convert return expression of type 'Int' to return type 'Double'

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let n = sorted.count
    if n % 2 == 0 {
        return (sorted[n/2 - 1] + sorted[n/2]) / 2.0
    } else {
        return 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 sorted = l.sorted()
    let n = sorted.count
    if n % 2 == 0 {
        return (sorted[n/2 - 1] + sorted[n/2]) / 2.0
    } else {
        return sorted[n/2]
    }
}
```
return (sorted[n/2 - 1] + sorted[n/2]) / 2.0 // cannot convert value of type 'Int' to expected argument type 'Double'
return sorted[n/2] // cannot convert return expression of type 'Int' to return type 'Double'

func median(l: [Int]) -> Double {
    var sorted = l
    sorted.sort()
    let n = sorted.count
    if n % 2 == 0 {
        return (sorted[n/2-1] + sorted[n/2]) / 2.0
    } else {
        return 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 {
    var sorted = l
    sorted.sort()
    let n = sorted.count
    if n % 2 == 0 {
        return (sorted[n/2-1] + sorted[n/2]) / 2.0
    } else {
        return sorted[n/2]
    }
}
```
return (sorted[n/2-1] + sorted[n/2]) / 2.0 // cannot convert value of type 'Int' to expected argument type 'Double'
return sorted[n/2] // cannot convert return expression of type 'Int' to return type 'Double'

func isPalindrome(text: String) -> Bool {
    let reversed = text.reverse()
    return text == reversed
}
```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 reversed = text.reverse()
    return text == reversed
}
```
let reversed = text.reverse() // value of type 'String' has no member 'reverse'

func isPalindrome(text: String) -> Bool {
    let reversedText = text.reverse()
    return text == 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 reversedText = text.reverse()
    return text == reversedText
}
```
let reversedText = text.reverse() // value of type 'String' has no member 'reverse'

func isPalindrome(text: String) -> Bool {
    let reversedText = text.reverse()
    return text == 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 reversedText = text.reverse()
    return text == reversedText
}
```
let reversedText = text.reverse() // value of type 'String' has no member 'reverse'

func isPalindrome(text: String) -> Bool {
    let reversedText = text.reverse()
    return text == 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 reversedText = text.reverse()
    return text == reversedText
}
```
let reversedText = text.reverse() // value of type 'String' has no member 'reverse'

func isPalindrome(text: String) -> Bool {
    let reversedText = text.reverse()
    return text == 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 reversedText = text.reverse()
    return text == reversedText
}
```
let reversedText = text.reverse() // value of type 'String' has no member 'reverse'

func isPalindrome(text: String) -> Bool {
    let reversed = text.reverse()
    return text == reversed
}
```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 reversed = text.reverse()
    return text == reversed
}
```
let reversed = text.reverse() // value of type 'String' has no member 'reverse'

func isPalindrome(text: String) -> Bool {
    let reversed = text.reverse()
    return text == reversed
}
```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 reversed = text.reverse()
    return text == reversed
}
```
let reversed = text.reverse() // value of type 'String' has no member 'reverse'

func isPalindrome(text: String) -> Bool {
    let textLength = text.length
    for i in 0..<textLength/2 {
        if text[i]!= text[textLength-1-i] {
            return false
        }
    }
    return true
}
```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 textLength = text.length
    for i in 0..<textLength/2 {
        if text[i]!= text[textLength-1-i] {
            return false
        }
    }
    return true
}
```
let textLength = text.length // value of type 'String' has no member 'length'
if text[i]!= text[textLength-1-i] { // '=' must have consistent whitespace on both sides

func isPalindrome(text: String) -> Bool {
    var reversedText = ""
    for i in text.reverse() {
        reversedText.append(i)
    }
    return text == 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 {
    var reversedText = ""
    for i in text.reverse() {
        reversedText.append(i)
    }
    return text == reversedText
}
```
for i in text.reverse() { // value of type 'String' has no member 'reverse'

func isPalindrome(text: String) -> Bool {
    let reversedText = text.reverse()
    return text == 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 reversedText = text.reverse()
    return text == reversedText
}
```
let reversedText = text.reverse() // value of type 'String' has no member 'reverse'

func modp(n: Int, p: Int) -> Int {
    var result = n
    for result >= p {
        result = result - 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
    for result >= p {
        result = result - p
    }
    return result
}
```
for result >= p { // unary operator cannot be separated from its operand
for result >= p { // '>=' is not a prefix unary operator
for result >= p { // expected 'in' after for-each pattern

func modp(n: Int, p: Int) -> Int {
    return (n % p + p) % 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 (n % p + p) % p
}
```
 // XCTAssertTrue failed

func modp(n: Int, p: Int) -> Int {
    return (n % p + p) % 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 (n % p + p) % p
}
```
 // XCTAssertTrue failed

func modp(n: Int, p: Int) -> Int {
    var res = n
    var i = 1
    while i < p {
        res = (res * 2) % p
        i = i * 2
    }
    return res
}
```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 res = n
    var i = 1
    while i < p {
        res = (res * 2) % p
        i = i * 2
    }
    return res
}
```
 // XCTAssertTrue failed

func modp(n: Int, p: Int) -> Int {
    return (n % p + p) % 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 (n % p + p) % p
}
```
 // XCTAssertTrue failed

func modp(n: Int, p: Int) -> Int {
    return (n % p + p) % 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 (n % p + p) % p
}
```
 // XCTAssertTrue failed

func modp(n: Int, p: Int) -> Int {
    return 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 n % p
}
```
 // XCTAssertTrue failed

func modp(n: Int, p: Int) -> Int {
    var result = 1
    for i in 0..<n {
        result = (result * n) % 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
    for i in 0..<n {
        result = (result * n) % p
    }
    return result
}
```
for i in 0..<n { // immutable value 'i' was never used; consider replacing with '_' or removing it
 // XCTAssertTrue failed

func modp(n: Int, p: Int) -> Int {
    return (n % p + p) % 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 (n % p + p) % p
}
```
 // XCTAssertTrue failed

func modp(n: Int, p: Int) -> Int {
    return (n % p + p) % 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 (n % p + p) % p
}
```
 // XCTAssertTrue failed

func removeVowels(text: String) -> String {
    let vowels = "aeiou"
    var result = ""
    for character in text {
        if!vowels.contains(character) {
            result.append(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 {
    let vowels = "aeiou"
    var result = ""
    for character in text {
        if!vowels.contains(character) {
            result.append(character)
        }
    }
    return result
}
```
if!vowels.contains(character) { // expected expression, var, or let in 'if' condition

func removeVowels(text: String) -> String {
    // TODO: Implement removeVowels
}
```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 {
    // TODO: Implement removeVowels
}
```
} // missing return in global function expected to return 'String'

func removeVowels(text: String) -> String {
    return text.filter {!$0.isVowel() }
}
```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 {
    return text.filter {!$0.isVowel() }
}
```
return text.filter {!$0.isVowel() } // value of type 'String.Element' (aka 'Character') has no member 'isVowel'

func removeVowels(text: String) -> String {
    // TODO: Implement removeVowels(text: String) -> String
}
```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 {
    // TODO: Implement removeVowels(text: String) -> String
}
```
} // missing return in global function expected to return 'String'

func removeVowels(text: String) -> String {
    let vowels = "aeiouAEIOU"
    var newText = ""
    for character in text {
        if!vowels.contains(character) {
            newText.append(character)
        }
    }
    return newText
}
```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 {
    let vowels = "aeiouAEIOU"
    var newText = ""
    for character in text {
        if!vowels.contains(character) {
            newText.append(character)
        }
    }
    return newText
}
```
if!vowels.contains(character) { // expected expression, var, or let in 'if' condition

func removeVowels(text: String) -> String {
    return text.filter {!$0.isVowel() }
}
```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 {
    return text.filter {!$0.isVowel() }
}
```
return text.filter {!$0.isVowel() } // value of type 'String.Element' (aka 'Character') has no member 'isVowel'

func removeVowels(text: String) -> String {
    var result = ""
    for character in text {
        if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" {
            result.append(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 character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" {
            result.append(character)
        }
    }
    return result
}
```
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot convert value of type 'String' to expected argument type 'Bool'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot force unwrap value of non-optional type 'Character'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot convert value of type 'Character' to expected argument type 'Bool'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot convert value of type 'String' to expected argument type 'Bool'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot convert value of type 'String' to expected argument type 'Bool'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot assign value of type '()' to type 'Character'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // use of '=' in a boolean context, did you mean '=='?
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // '=' must have consistent whitespace on both sides
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot convert value of type 'Character' to expected argument type 'Bool'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot convert value of type 'Character' to expected argument type 'Bool'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot force unwrap value of non-optional type 'Character'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // '=' must have consistent whitespace on both sides
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot convert value of type 'String' to expected argument type 'Bool'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot force unwrap value of non-optional type 'Character'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot force unwrap value of non-optional type 'Character'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // '=' must have consistent whitespace on both sides
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // '=' must have consistent whitespace on both sides
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot force unwrap value of non-optional type 'Character'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // cannot convert value of type 'Character' to expected argument type 'Bool'
if character!= "a" && character!= "e" && character!= "i" && character!= "o" && character!= "u" { // '=' must have consistent whitespace on both sides

func removeVowels(text: String) -> String {
    let vowels = "aeiou"
    var newText = ""
    for character in text {
        if!vowels.contains(character) {
            newText.append(character)
        }
    }
    return newText
}
```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 {
    let vowels = "aeiou"
    var newText = ""
    for character in text {
        if!vowels.contains(character) {
            newText.append(character)
        }
    }
    return newText
}
```
if!vowels.contains(character) { // expected expression, var, or let in 'if' condition

func removeVowels(text: String) -> String {
    let vowels = "aeiou"
    var result = ""
    for character in text {
        if vowels.contains(String(character)) {
            continue
        }
        result.append(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 {
    let vowels = "aeiou"
    var result = ""
    for character in text {
        if vowels.contains(String(character)) {
            continue
        }
        result.append(character)
    }
    return result
}
```
 // XCTAssertTrue failed

func removeVowels(text: String) -> String {
    return text.filter {!$0.isVowel() }
}
```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 {
    return text.filter {!$0.isVowel() }
}
```
return text.filter {!$0.isVowel() } // value of type 'String.Element' (aka 'Character') has no member 'isVowel'

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
}
```

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
}
```

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
}
```

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
}
```

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
}
```

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
}
```

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
}
```

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
}
```

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
}
```

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
}
```

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
}
```

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
}
```

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
}
```

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
}
```

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
}
```

func sameChars(s0: String, s1: String) -> Bool {
    var i0 = s0.startIndex
    var i1 = s1.startIndex
    while i0!= s0.endIndex && i1!= s1.endIndex {
        if s0[i0]!= s1[i1] {
            return false
        }
        i0 += 1
        i1 += 1
    }
    return i0 == s0.endIndex && i1 == s1.endIndex
}
```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 i0 = s0.startIndex
    var i1 = s1.startIndex
    while i0!= s0.endIndex && i1!= s1.endIndex {
        if s0[i0]!= s1[i1] {
            return false
        }
        i0 += 1
        i1 += 1
    }
    return i0 == s0.endIndex && i1 == s1.endIndex
}
```
while i0!= s0.endIndex && i1!= s1.endIndex { // cannot convert value of type 'String.Index' to expected argument type 'Bool'
while i0!= s0.endIndex && i1!= s1.endIndex { // cannot force unwrap value of non-optional type 'String.Index'
while i0!= s0.endIndex && i1!= s1.endIndex { // cannot assign value of type '()' to type 'String.Index'
while i0!= s0.endIndex && i1!= s1.endIndex { // '=' must have consistent whitespace on both sides
while i0!= s0.endIndex && i1!= s1.endIndex { // use of '=' in a boolean context, did you mean '=='?
while i0!= s0.endIndex && i1!= s1.endIndex { // cannot convert value of type 'String.Index' to expected argument type 'Bool'
while i0!= s0.endIndex && i1!= s1.endIndex { // cannot force unwrap value of non-optional type 'String.Index'
while i0!= s0.endIndex && i1!= s1.endIndex { // '=' must have consistent whitespace on both sides
if s0[i0]!= s1[i1] { // cannot force unwrap value of non-optional type 'Character'
if s0[i0]!= s1[i1] { // '=' must have consistent whitespace on both sides
if s0[i0]!= s1[i1] { // use of '=' in a boolean context, did you mean '=='?
i0 += 1 // binary operator '+=' cannot be applied to operands of type 'String.Index' and 'Int'
i1 += 1 // binary operator '+=' cannot be applied to operands of type 'String.Index' and 'Int'

func sameChars(s0: String, s1: String) -> Bool {
    var s0Count = [Character: Int]()
    for c in s0 {
        if let count = s0Count[c] {
            s0Count[c] = count + 1
        } else {
            s0Count[c] = 1
        }
    }
    
    var s1Count = [Character: Int]()
    for c in s1 {
        if let count = s1Count[c] {
            s1Count[c] = count + 1
        } else {
            s1Count[c] = 1
        }
    }
    
    for (c, count) in s0Count {
        if let count = s1Count[c] {
            if count!= count {
                return false
            }
        } else {
            return false
        }
    }
    
    return true
}
```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 s0Count = [Character: Int]()
    for c in s0 {
        if let count = s0Count[c] {
            s0Count[c] = count + 1
        } else {
            s0Count[c] = 1
        }
    }
    
    var s1Count = [Character: Int]()
    for c in s1 {
        if let count = s1Count[c] {
            s1Count[c] = count + 1
        } else {
            s1Count[c] = 1
        }
    }
    
    for (c, count) in s0Count {
        if let count = s1Count[c] {
            if count!= count {
                return false
            }
        } else {
            return false
        }
    }
    
    return true
}
```
if count!= count { // use of '=' in a boolean context, did you mean '=='?
if count!= count { // cannot force unwrap value of non-optional type 'Int'
if count!= count { // '=' must have consistent whitespace on both sides

func sameChars(s0: String, s1: String) -> Bool {
    // Check if the strings are the same length.
    if s0.length!= s1.length {
        return false
    }
    
    // Create a dictionary to store the count of each character.
    var charCounts = [Character: Int]()
    
    // Loop through the first string and increment the count of each character.
    for char in s0 {
        charCounts[char] = charCounts[char] + 1
    }
    
    // Loop through the second string and decrement the count of each character.
    for char in s1 {
        charCounts[char] = charCounts[char] - 1
    }
    
    // Check if any character has a non-zero count.
    for char in charCounts {
        if char.1!= 0 {
            return false
        }
    }
    
    // If we get here, the strings have the same characters.
    return true
}
```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 {
    // Check if the strings are the same length.
    if s0.length!= s1.length {
        return false
    }
    
    // Create a dictionary to store the count of each character.
    var charCounts = [Character: Int]()
    
    // Loop through the first string and increment the count of each character.
    for char in s0 {
        charCounts[char] = charCounts[char] + 1
    }
    
    // Loop through the second string and decrement the count of each character.
    for char in s1 {
        charCounts[char] = charCounts[char] - 1
    }
    
    // Check if any character has a non-zero count.
    for char in charCounts {
        if char.1!= 0 {
            return false
        }
    }
    
    // If we get here, the strings have the same characters.
    return true
}
```
if s0.length!= s1.length { // value of type 'String' has no member 'length'
if s0.length!= s1.length { // value of type 'String' has no member 'length'
if s0.length!= s1.length { // '=' must have consistent whitespace on both sides
if s0.length!= s1.length { // use of '=' in a boolean context, did you mean '=='?
charCounts[char] = charCounts[char] + 1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
charCounts[char] = charCounts[char] - 1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if char.1!= 0 { // use of '=' in a boolean context, did you mean '=='?
if char.1!= 0 { // '=' must have consistent whitespace on both sides
if char.1!= 0 { // cannot force unwrap value of non-optional type 'Int'

func sameChars(s0: String, s1: String) -> Bool {
    var i = 0
    while i < s0.characters.count {
        if s0.characters[i]!= s1.characters[i] {
            return false
        }
        i += 1
    }
    return true
}
```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 i = 0
    while i < s0.characters.count {
        if s0.characters[i]!= s1.characters[i] {
            return false
        }
        i += 1
    }
    return true
}
```
while i < s0.characters.count { // 'characters' is unavailable: Please use String directly
if s0.characters[i]!= s1.characters[i] { // '=' must have consistent whitespace on both sides
if s0.characters[i]!= s1.characters[i] { // cannot force unwrap value of non-optional type 'Character'
if s0.characters[i]!= s1.characters[i] { // use of '=' in a boolean context, did you mean '=='?

func sameChars(s0: String, s1: String) -> Bool {
    let s0Array = s0.characters.map { $0 }
    let s1Array = s1.characters.map { $0 }
    return s0Array.isEqual(to: s1Array)
}
```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 s0Array = s0.characters.map { $0 }
    let s1Array = s1.characters.map { $0 }
    return s0Array.isEqual(to: s1Array)
}
```
let s0Array = s0.characters.map { $0 } // 'characters' is unavailable: Please use String directly
let s1Array = s1.characters.map { $0 } // 'characters' is unavailable: Please use String directly
return s0Array.isEqual(to: s1Array) // value of type '[String.Element]' (aka 'Array<Character>') has no member 'isEqual'

func sameChars(s0: String, s1: String) -> Bool {
    var s0Chars = s0.characters
    var s1Chars = s1.characters
    var s0Count = 0
    var s1Count = 0
    while s0Chars.hasNext {
        if s0Chars.next() == s1Chars.next() {
            s0Count += 1
            s1Count += 1
        } else if s0Chars.hasNext {
            s0Count += 1
        } else if s1Chars.hasNext {
            s1Count += 1
        } else {
            return false
        }
    }
    return s0Count == s1Count
}
```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 s0Chars = s0.characters
    var s1Chars = s1.characters
    var s0Count = 0
    var s1Count = 0
    while s0Chars.hasNext {
        if s0Chars.next() == s1Chars.next() {
            s0Count += 1
            s1Count += 1
        } else if s0Chars.hasNext {
            s0Count += 1
        } else if s1Chars.hasNext {
            s1Count += 1
        } else {
            return false
        }
    }
    return s0Count == s1Count
}
```
var s0Chars = s0.characters // 'characters' is unavailable: Please use String directly
var s1Chars = s1.characters // 'characters' is unavailable: Please use String directly
while s0Chars.hasNext { // value of type 'String' has no member 'hasNext'
if s0Chars.next() == s1Chars.next() { // value of type 'String' has no member 'next'
if s0Chars.next() == s1Chars.next() { // value of type 'String' has no member 'next'
} else if s0Chars.hasNext { // value of type 'String' has no member 'hasNext'
} else if s1Chars.hasNext { // value of type 'String' has no member 'hasNext'

func sameChars(s0: String, s1: String) -> Bool {
    var i0 = s0.startIndex
    var i1 = s1.startIndex
    while i0!= s0.endIndex && i1!= s1.endIndex {
        if s0[i0]!= s1[i1] {
            return false
        }
        i0 += 1
        i1 += 1
    }
    return i0 == s0.endIndex && i1 == s1.endIndex
}
```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 i0 = s0.startIndex
    var i1 = s1.startIndex
    while i0!= s0.endIndex && i1!= s1.endIndex {
        if s0[i0]!= s1[i1] {
            return false
        }
        i0 += 1
        i1 += 1
    }
    return i0 == s0.endIndex && i1 == s1.endIndex
}
```
while i0!= s0.endIndex && i1!= s1.endIndex { // cannot convert value of type 'String.Index' to expected argument type 'Bool'
while i0!= s0.endIndex && i1!= s1.endIndex { // cannot force unwrap value of non-optional type 'String.Index'
while i0!= s0.endIndex && i1!= s1.endIndex { // cannot assign value of type '()' to type 'String.Index'
while i0!= s0.endIndex && i1!= s1.endIndex { // '=' must have consistent whitespace on both sides
while i0!= s0.endIndex && i1!= s1.endIndex { // use of '=' in a boolean context, did you mean '=='?
while i0!= s0.endIndex && i1!= s1.endIndex { // cannot convert value of type 'String.Index' to expected argument type 'Bool'
while i0!= s0.endIndex && i1!= s1.endIndex { // cannot force unwrap value of non-optional type 'String.Index'
while i0!= s0.endIndex && i1!= s1.endIndex { // '=' must have consistent whitespace on both sides
if s0[i0]!= s1[i1] { // cannot force unwrap value of non-optional type 'Character'
if s0[i0]!= s1[i1] { // '=' must have consistent whitespace on both sides
if s0[i0]!= s1[i1] { // use of '=' in a boolean context, did you mean '=='?
i0 += 1 // binary operator '+=' cannot be applied to operands of type 'String.Index' and 'Int'
i1 += 1 // binary operator '+=' cannot be applied to operands of type 'String.Index' and 'Int'

func sameChars(s0: String, s1: String) -> Bool {
    var i = 0
    while i < s0.characters.count {
        if s0.characters[i]!= s1.characters[i] {
            return false
        }
        i += 1
    }
    return true
}
```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 i = 0
    while i < s0.characters.count {
        if s0.characters[i]!= s1.characters[i] {
            return false
        }
        i += 1
    }
    return true
}
```
while i < s0.characters.count { // 'characters' is unavailable: Please use String directly
if s0.characters[i]!= s1.characters[i] { // '=' must have consistent whitespace on both sides
if s0.characters[i]!= s1.characters[i] { // cannot force unwrap value of non-optional type 'Character'
if s0.characters[i]!= s1.characters[i] { // use of '=' in a boolean context, did you mean '=='?

func sameChars(s0: String, s1: String) -> Bool {
    let s0Length = s0.characters.count
    let s1Length = s1.characters.count
    if s0Length!= s1Length {
        return false
    }
    for i in 0..<s0Length {
        if s0.characters[i]!= s1.characters[i] {
            return false
        }
    }
    return true
}
```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 s0Length = s0.characters.count
    let s1Length = s1.characters.count
    if s0Length!= s1Length {
        return false
    }
    for i in 0..<s0Length {
        if s0.characters[i]!= s1.characters[i] {
            return false
        }
    }
    return true
}
```
let s0Length = s0.characters.count // 'characters' is unavailable: Please use String directly
let s1Length = s1.characters.count // 'characters' is unavailable: Please use String directly
if s0Length!= s1Length { // '=' must have consistent whitespace on both sides
if s0Length!= s1Length { // use of '=' in a boolean context, did you mean '=='?
if s0Length!= s1Length { // cannot force unwrap value of non-optional type 'Int'
if s0.characters[i]!= s1.characters[i] { // cannot force unwrap value of non-optional type 'Character'
if s0.characters[i]!= s1.characters[i] { // '=' must have consistent whitespace on both sides
if s0.characters[i]!= s1.characters[i] { // use of '=' in a boolean context, did you mean '=='?

func sameChars(s0: String, s1: String) -> Bool {
    var s0Count = [Character: Int]()
    for c in s0 {
        if let count = s0Count[c] {
            s0Count[c] = count + 1
        } else {
            s0Count[c] = 1
        }
    }
    for c in s1 {
        if let count = s0Count[c] {
            s0Count[c] = count - 1
        } else {
            return false
        }
    }
    return s0Count.count == 0
}
```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 s0Count = [Character: Int]()
    for c in s0 {
        if let count = s0Count[c] {
            s0Count[c] = count + 1
        } else {
            s0Count[c] = 1
        }
    }
    for c in s1 {
        if let count = s0Count[c] {
            s0Count[c] = count - 1
        } else {
            return false
        }
    }
    return s0Count.count == 0
}
```
 // XCTAssertTrue failed

func fib(n: Int) -> Int {
    if n == 1 {
        return 1
    } else if n == 2 {
        return 1
    } else {
        return fib(n - 1) + fib(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 1
    } else if n == 2 {
        return 1
    } else {
        return fib(n - 1) + fib(n - 2)
    }
}
```
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call

func fib(n: Int) -> Int {
    if n == 1 || n == 2 {
        return 1
    }
    return fib(n - 1) + fib(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 || n == 2 {
        return 1
    }
    return fib(n - 1) + fib(n - 2)
}
```
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call

func fib(n: Int) -> Int {
    if n == 1 {
        return 1
    } else if n == 2 {
        return 1
    } else {
        return fib(n - 1) + fib(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 1
    } else if n == 2 {
        return 1
    } else {
        return fib(n - 1) + fib(n - 2)
    }
}
```
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call

func fib(n: Int) -> Int {
    if n == 1 || n == 2 {
        return 1
    }
    return fib(n - 1) + fib(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 || n == 2 {
        return 1
    }
    return fib(n - 1) + fib(n - 2)
}
```
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call

func fib(n: Int) -> Int {
    if n == 1 {
        return 1
    } else if n == 2 {
        return 1
    } else {
        return fib(n - 1) + fib(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 1
    } else if n == 2 {
        return 1
    } else {
        return fib(n - 1) + fib(n - 2)
    }
}
```
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call

func fib(n: Int) -> Int {
    if n == 0 || n == 1 {
        return 1
    }
    return fib(n - 1) + fib(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 || n == 1 {
        return 1
    }
    return fib(n - 1) + fib(n - 2)
}
```
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call

func fib(n: Int) -> Int {
    if n == 1 {
        return 1
    } else if n == 2 {
        return 1
    } else {
        return fib(n - 1) + fib(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 1
    } else if n == 2 {
        return 1
    } else {
        return fib(n - 1) + fib(n - 2)
    }
}
```
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call

func fib(n: Int) -> Int {
    if n <= 1 {
        return 1
    }
    return fib(n - 1) + fib(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 1
    }
    return fib(n - 1) + fib(n - 2)
}
```
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call

func fib(n: Int) -> Int {
    if n <= 1 {
        return 1
    }
    return fib(n - 1) + fib(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 1
    }
    return fib(n - 1) + fib(n - 2)
}
```
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call
return fib(n - 1) + fib(n - 2) // missing argument label 'n:' in call

func fib(n: Int) -> Int {
    if n == 0 || 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 == 0 || n == 1 {
        return n
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for character in brackets.characters {
        if character == "<" {
            stack.append(character)
        } else if character == ">" {
            if stack.isEmpty {
                return false
            }
            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 character in brackets.characters {
        if character == "<" {
            stack.append(character)
        } else if character == ">" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```
for character in brackets.characters { // 'characters' is unavailable: Please use String directly

func correctBracketing(brackets: String) -> Bool {
    var stack: [Character] = []
    for c in brackets.characters {
        if c == "<" {
            stack.append(c)
        } else if c == ">" {
            if stack.count > 0 {
                stack.removeLast()
            } else {
                return false
            }
        }
    }
    return stack.count == 0
}
```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.characters {
        if c == "<" {
            stack.append(c)
        } else if c == ">" {
            if stack.count > 0 {
                stack.removeLast()
            } else {
                return false
            }
        }
    }
    return stack.count == 0
}
```
for c in brackets.characters { // 'characters' is unavailable: Please use String directly

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for c in brackets.characters {
        if c == "<" {
            stack.append(c)
        } else if c == ">" {
            if stack.count == 0 {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.count == 0
}
```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.characters {
        if c == "<" {
            stack.append(c)
        } else if c == ">" {
            if stack.count == 0 {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.count == 0
}
```
for c in brackets.characters { // 'characters' is unavailable: Please use String directly

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for c in brackets.characters {
        if c == "<" {
            stack.append(c)
        } else if c == ">" {
            if stack.isEmpty {
                return false
            }
            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.characters {
        if c == "<" {
            stack.append(c)
        } else if c == ">" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```
for c in brackets.characters { // 'characters' is unavailable: Please use String directly

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for c in brackets {
        if c == "<" {
            stack.append(c)
        } else if c == ">" {
            if stack.count > 0 {
                stack.removeLast()
            } else {
                return false
            }
        }
    }
    return stack.count == 0
}
```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.count > 0 {
                stack.removeLast()
            } else {
                return false
            }
        }
    }
    return stack.count == 0
}
```

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
            }
            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
            }
            stack.removeLast()
        }
    }
    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.count == 0 {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.count == 0
}
```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.count == 0 {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.count == 0
}
```

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
            }
            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
            }
            stack.removeLast()
        }
    }
    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
            }
            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
            }
            stack.removeLast()
        }
    }
    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.count == 0 {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.count == 0
}
```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.count == 0 {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.count == 0
}
```

func monotonic(l: [Int]) -> Bool {
    var i = 0
    while i < l.count - 1 {
        if l[i] > l[i + 1] {
            return false
        }
        i += 1
    }
    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 {
    var i = 0
    while i < l.count - 1 {
        if l[i] > l[i + 1] {
            return false
        }
        i += 1
    }
    return true
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    var i = 0
    while i < l.count - 1 {
        if l[i] > l[i + 1] {
            return false
        }
        i += 1
    }
    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 {
    var i = 0
    while i < l.count - 1 {
        if l[i] > l[i + 1] {
            return false
        }
        i += 1
    }
    return true
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    var i = 0
    while i < l.count - 1 {
        if l[i] > l[i + 1] {
            return false
        }
        i += 1
    }
    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 {
    var i = 0
    while i < l.count - 1 {
        if l[i] > l[i + 1] {
            return false
        }
        i += 1
    }
    return true
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    var i = 0
    while i < l.count - 1 {
        if l[i] > l[i + 1] {
            return false
        }
        i += 1
    }
    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 {
    var i = 0
    while i < l.count - 1 {
        if l[i] > l[i + 1] {
            return false
        }
        i += 1
    }
    return true
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    var increasing = true
    var decreasing = true
    for i in 1..<l.count {
        if l[i] < l[i - 1] {
            increasing = false
        }
        if l[i] > l[i - 1] {
            decreasing = false
        }
    }
    return increasing || decreasing
}
```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 increasing = true
    var decreasing = true
    for i in 1..<l.count {
        if l[i] < l[i - 1] {
            increasing = false
        }
        if l[i] > l[i - 1] {
            decreasing = false
        }
    }
    return increasing || decreasing
}
```

func monotonic(l: [Int]) -> Bool {
    var increasing = true
    var decreasing = true
    for i in 1..<l.count {
        if l[i] < l[i-1] {
            increasing = false
        }
        if l[i] > l[i-1] {
            decreasing = false
        }
    }
    return increasing || decreasing
}
```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 increasing = true
    var decreasing = true
    for i in 1..<l.count {
        if l[i] < l[i-1] {
            increasing = false
        }
        if l[i] > l[i-1] {
            decreasing = false
        }
    }
    return increasing || decreasing
}
```

func monotonic(l: [Int]) -> Bool {
    var i = 0
    var prev = l[0]
    while i < l.count - 1 {
        if l[i] > prev {
            return false
        }
        prev = l[i]
        i += 1
    }
    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 {
    var i = 0
    var prev = l[0]
    while i < l.count - 1 {
        if l[i] > prev {
            return false
        }
        prev = l[i]
        i += 1
    }
    return true
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    var i = 0
    while i < l.count - 1 {
        if l[i] > l[i + 1] {
            return false
        }
        i += 1
    }
    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 {
    var i = 0
    while i < l.count - 1 {
        if l[i] > l[i + 1] {
            return false
        }
        i += 1
    }
    return true
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    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 {
    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 {
    var prev = l[0]
    for i in 1..<l.count {
        if l[i] < prev {
            return false
        }
        prev = 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 {
    var prev = l[0]
    for i in 1..<l.count {
        if l[i] < prev {
            return false
        }
        prev = l[i]
    }
    return true
}
```
 // XCTAssertTrue failed

func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    for i in l1 {
        if l2.contains(i) {
            result.append(i)
        }
    }
    return result.sort()
}
```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]()
    for i in l1 {
        if l2.contains(i) {
            result.append(i)
        }
    }
    return result.sort()
}
```
return result.sort() // cannot convert return expression of type '()' to return type '[Int]'

func common(l1: [Int], l2: [Int]) -> [Int] {
    var result: [Int] = []
    var i1 = 0
    var i2 = 0
    while i1 < l1.count && i2 < l2.count {
        if l1[i1] < l2[i2] {
            i1 += 1
        } else if l1[i1] > l2[i2] {
            i2 += 1
        } else {
            result.append(l1[i1])
            i1 += 1
            i2 += 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 result: [Int] = []
    var i1 = 0
    var i2 = 0
    while i1 < l1.count && i2 < l2.count {
        if l1[i1] < l2[i2] {
            i1 += 1
        } else if l1[i1] > l2[i2] {
            i2 += 1
        } else {
            result.append(l1[i1])
            i1 += 1
            i2 += 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] < l2[j] {
            i += 1
        } else if l1[i] > l2[j] {
            j += 1
        } else {
            result.append(l1[i])
            i += 1
            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 result = [Int]()
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] < l2[j] {
            i += 1
        } else if l1[i] > l2[j] {
            j += 1
        } else {
            result.append(l1[i])
            i += 1
            j += 1
        }
    }
    return result
}
```
 // 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] {
            i += 1
        } else if l1[i] > l2[j] {
            j += 1
        } else {
            result.append(l1[i])
            i += 1
            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] {
            i += 1
        } else if l1[i] > l2[j] {
            j += 1
        } else {
            result.append(l1[i])
            i += 1
            j += 1
        }
    }
    return result
}
```

func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] < l2[j] {
            i += 1
        } else if l1[i] > l2[j] {
            j += 1
        } else {
            result.append(l1[i])
            i += 1
            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 result = [Int]()
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] < l2[j] {
            i += 1
        } else if l1[i] > l2[j] {
            j += 1
        } else {
            result.append(l1[i])
            i += 1
            j += 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    for i in l1 {
        if l2.contains(i) {
            result.append(i)
        }
    }
    return result.sorted()
}
```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]()
    for i in l1 {
        if l2.contains(i) {
            result.append(i)
        }
    }
    return result.sorted()
}
```

func common(l1: [Int], l2: [Int]) -> [Int] {
    var l1 = l1
    var l2 = l2
    var result = [Int]()
    
    l1.sort()
    l2.sort()
    
    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
    var result = [Int]()
    
    l1.sort()
    l2.sort()
    
    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 l1 = l1
    var l2 = l2
    var result: [Int] = []
    
    // Sort the arrays
    l1.sort()
    l2.sort()
    
    // Find the first common element
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] < l2[j] {
            i += 1
        } else if l1[i] > l2[j] {
            j += 1
        } else {
            result.append(l1[i])
            i += 1
            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
    var result: [Int] = []
    
    // Sort the arrays
    l1.sort()
    l2.sort()
    
    // Find the first common element
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] < l2[j] {
            i += 1
        } else if l1[i] > l2[j] {
            j += 1
        } else {
            result.append(l1[i])
            i += 1
            j += 1
        }
    }
    
    return result
}
```

func common(l1: [Int], l2: [Int]) -> [Int] {
    var result: [Int] = []
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] < l2[j] {
            i += 1
        } else if l1[i] > l2[j] {
            j += 1
        } else {
            result.append(l1[i])
            i += 1
            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 result: [Int] = []
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] < l2[j] {
            i += 1
        } else if l1[i] > l2[j] {
            j += 1
        } else {
            result.append(l1[i])
            i += 1
            j += 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func common(l1: [Int], l2: [Int]) -> [Int] {
    var result: [Int] = []
    for i in l1 {
        if l2.contains(i) {
            result.append(i)
        }
    }
    return result.sorted()
}
```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] = []
    for i in l1 {
        if l2.contains(i) {
            result.append(i)
        }
    }
    return result.sorted()
}
```

func largestPrimeFactor(n: Int) -> Int {
    // TODO: implement
}
```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 {
    // TODO: implement
}
```
} // missing return in global function expected to return 'Int'

func largestPrimeFactor(n: Int) -> Int {
    // TODO: implement
}
```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 {
    // TODO: implement
}
```
} // missing return in global function expected to return 'Int'

func largestPrimeFactor(n: Int) -> Int {
    // TODO: implement
}
```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 {
    // TODO: implement
}
```
} // missing return in global function expected to return 'Int'

func largestPrimeFactor(n: Int) -> Int {
    // TODO: Implement
}
```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 {
    // TODO: Implement
}
```
} // missing return in global function expected to return 'Int'

func largestPrimeFactor(n: Int) -> Int {
    // TODO: implement
}
```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 {
    // TODO: implement
}
```
} // missing return in global function expected to return 'Int'

func largestPrimeFactor(n: Int) -> Int {
    // TODO: implement
}
```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 {
    // TODO: implement
}
```
} // missing return in global function expected to return 'Int'

func largestPrimeFactor(n: Int) -> Int {
    // TODO: implement
}
```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 {
    // TODO: implement
}
```
} // missing return in global function expected to return 'Int'

func largestPrimeFactor(n: Int) -> Int {
    var largest = 1
    for i in 2...n {
        if n % i == 0 {
            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 largest = 1
    for i in 2...n {
        if n % i == 0 {
            largest = i
        }
    }
    return largest
}
```
 // XCTAssertTrue failed

func largestPrimeFactor(n: Int) -> Int {
    // TODO: implement
}
```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 {
    // TODO: implement
}
```
} // missing return in global function expected to return 'Int'

func largestPrimeFactor(n: Int) -> Int {
    var largest = 1
    for i in 2...n {
        if n % i == 0 {
            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 largest = 1
    for i in 2...n {
        if n % i == 0 {
            largest = i
        }
    }
    return largest
}
```
 // XCTAssertTrue failed

func sumToN(n: Int) -> Int {
    var total = 0
    for i in 1...n {
        total += i
    }
    return total
}
```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 total = 0
    for i in 1...n {
        total += i
    }
    return total
}
```

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 total = 0
    for i in 1...n {
        total += i
    }
    return total
}
```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 total = 0
    for i in 1...n {
        total += i
    }
    return total
}
```

func sumToN(n: Int) -> Int {
    var total = 0
    for i in 1...n {
        total += i
    }
    return total
}
```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 total = 0
    for i in 1...n {
        total += i
    }
    return total
}
```

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 total = 0
    for i in 1...n {
        total += i
    }
    return total
}
```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 total = 0
    for i in 1...n {
        total += i
    }
    return total
}
```

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 correctBracketing(brackets: String) -> Bool {
    var stack: [Character] = []
    for c in brackets.characters {
        if c == "(" {
            stack.append(c)
        } else if c == ")" {
            if stack.isEmpty {
                return false
            }
            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.characters {
        if c == "(" {
            stack.append(c)
        } else if c == ")" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```
for c in brackets.characters { // 'characters' is unavailable: Please use String directly

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for c in brackets.characters {
        if c == "(" {
            stack.append(c)
        } else if c == ")" {
            if stack.isEmpty {
                return false
            }
            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.characters {
        if c == "(" {
            stack.append(c)
        } else if c == ")" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```
for c in brackets.characters { // 'characters' is unavailable: Please use String directly

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for c in brackets {
        if c == "(" {
            stack.append(c)
        } else {
            if stack.isEmpty {
                return false
            }
            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 stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for c in brackets {
        if c == "(" {
            stack.append(c)
        } else {
            if stack.isEmpty {
                return false
            }
            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 stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for c in brackets {
        if c == "(" {
            stack.append(c)
        } else {
            if stack.isEmpty {
                return false
            }
            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 stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    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
            }
            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
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for c in brackets {
        if c == "(" {
            stack.append(c)
        } else {
            if stack.isEmpty {
                return false
            }
            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 stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    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
            }
            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
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for c in brackets {
        if c == "(" {
            stack.append(c)
        } else {
            if stack.isEmpty {
                return false
            }
            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 stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for c in brackets {
        if c == "(" {
            stack.append(c)
        } else {
            if stack.isEmpty {
                return false
            }
            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 stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```

func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 1...xs.count-1 {
        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 1...xs.count-1 {
        result.append(xs[i] * i)
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func derivative(xs: [Int]) -> [Int] {
    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] {
    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[i] * (i as Int))
        }
    }
    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] * (i as Int))
        }
    }
    return result
}
```

func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<xs.count - 1 {
        result.append(xs[i] * (i + 1))
    }
    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 - 1 {
        result.append(xs[i] * (i + 1))
    }
    return result
}
```
 // XCTAssertTrue failed

func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<xs.count {
        if i > 0 {
            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] * 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] {
    var result = [Int]()
    for i in 0..<xs.count {
        if i == 0 {
            result.append(xs[i])
        } else {
            result.append(xs[i] * (i as Int))
        }
    }
    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 as Int))
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<xs.count {
        if i > 0 {
            result.append(xs[i] * (i as Int))
        } else {
            result.append(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] {
    var result = [Int]()
    for i in 0..<xs.count {
        if i > 0 {
            result.append(xs[i] * (i as Int))
        } else {
            result.append(xs[i])
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<xs.count - 1 {
        result.append(xs[i] * (i + 1))
    }
    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 - 1 {
        result.append(xs[i] * (i + 1))
    }
    return result
}
```
 // XCTAssertTrue failed

func derivative(xs: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0..<xs.count - 1 {
        result.append(xs[i] * (i + 1))
    }
    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 - 1 {
        result.append(xs[i] * (i + 1))
    }
    return result
}
```
 // XCTAssertTrue failed

func fibfib(n: Int) -> Int {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'Int'

func fibfib(n: Int) -> Int {
    if n == 0 {
        return 0
    }
    if n == 1 {
        return 0
    }
    if n == 2 {
        return 1
    }
    return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3)
}
```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 {
    if n == 0 {
        return 0
    }
    if n == 1 {
        return 0
    }
    if n == 2 {
        return 1
    }
    return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3)
}
```
return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3) // missing argument label 'n:' in call
return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3) // missing argument label 'n:' in call
return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3) // missing argument label 'n:' in call

func fibfib(n: Int) -> Int {
    if n == 0 {
        return 0
    } else if n == 1 {
        return 0
    } else if n == 2 {
        return 1
    } else {
        return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3)
    }
}
```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 {
    if n == 0 {
        return 0
    } else if n == 1 {
        return 0
    } else if n == 2 {
        return 1
    } else {
        return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3)
    }
}
```
return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3) // missing argument label 'n:' in call
return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3) // missing argument label 'n:' in call
return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3) // missing argument label 'n:' in call

func fibfib(n: Int) -> Int {
    var fibfib = [Int]()
    fibfib.append(0)
    fibfib.append(0)
    fibfib.append(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 {
    var fibfib = [Int]()
    fibfib.append(0)
    fibfib.append(0)
    fibfib.append(1)
    for i in 3...n {
        fibfib.append(fibfib[i-1] + fibfib[i-2] + fibfib[i-3])
    }
    return fibfib[n]
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func fibfib(n: Int) -> Int {
    if n == 0 {
        return 0
    }
    if n == 1 {
        return 0
    }
    if n == 2 {
        return 1
    }
    return fibfib(n-1) + fibfib(n-2) + fibfib(n-3)
}
```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 {
    if n == 0 {
        return 0
    }
    if n == 1 {
        return 0
    }
    if n == 2 {
        return 1
    }
    return fibfib(n-1) + fibfib(n-2) + fibfib(n-3)
}
```
return fibfib(n-1) + fibfib(n-2) + fibfib(n-3) // missing argument label 'n:' in call
return fibfib(n-1) + fibfib(n-2) + fibfib(n-3) // missing argument label 'n:' in call
return fibfib(n-1) + fibfib(n-2) + fibfib(n-3) // missing argument label 'n:' in call

func fibfib(n: Int) -> Int {
    if n == 0 {
        return 0
    }
    if n == 1 {
        return 0
    }
    if n == 2 {
        return 1
    }
    return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3)
}
```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 {
    if n == 0 {
        return 0
    }
    if n == 1 {
        return 0
    }
    if n == 2 {
        return 1
    }
    return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3)
}
```
return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3) // missing argument label 'n:' in call
return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3) // missing argument label 'n:' in call
return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3) // missing argument label 'n:' in call

func fibfib(n: Int) -> Int {
    if n == 0 {
        return 0
    }
    if n == 1 {
        return 0
    }
    if n == 2 {
        return 1
    }
    return fibfib(n-1) + fibfib(n-2) + fibfib(n-3)
}
```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 {
    if n == 0 {
        return 0
    }
    if n == 1 {
        return 0
    }
    if n == 2 {
        return 1
    }
    return fibfib(n-1) + fibfib(n-2) + fibfib(n-3)
}
```
return fibfib(n-1) + fibfib(n-2) + fibfib(n-3) // missing argument label 'n:' in call
return fibfib(n-1) + fibfib(n-2) + fibfib(n-3) // missing argument label 'n:' in call
return fibfib(n-1) + fibfib(n-2) + fibfib(n-3) // missing argument label 'n:' in call

func fibfib(n: Int) -> Int {
    if n == 0 {
        return 0
    }
    if n == 1 {
        return 0
    }
    if n == 2 {
        return 1
    }
    return fibfib(n-1) + fibfib(n-2) + fibfib(n-3)
}
```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 {
    if n == 0 {
        return 0
    }
    if n == 1 {
        return 0
    }
    if n == 2 {
        return 1
    }
    return fibfib(n-1) + fibfib(n-2) + fibfib(n-3)
}
```
return fibfib(n-1) + fibfib(n-2) + fibfib(n-3) // missing argument label 'n:' in call
return fibfib(n-1) + fibfib(n-2) + fibfib(n-3) // missing argument label 'n:' in call
return fibfib(n-1) + fibfib(n-2) + fibfib(n-3) // missing argument label 'n:' in call

func fibfib(n: Int) -> Int {
    if n == 0 {
        return 0
    } else if n == 1 {
        return 0
    } else if n == 2 {
        return 1
    } else {
        return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3)
    }
}
```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 {
    if n == 0 {
        return 0
    } else if n == 1 {
        return 0
    } else if n == 2 {
        return 1
    } else {
        return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3)
    }
}
```
return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3) // missing argument label 'n:' in call
return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3) // missing argument label 'n:' in call
return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3) // missing argument label 'n:' in call

func fibfib(n: Int) -> Int {
    var fibfib = [Int]()
    fibfib.append(0)
    fibfib.append(0)
    fibfib.append(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 {
    var fibfib = [Int]()
    fibfib.append(0)
    fibfib.append(0)
    fibfib.append(1)
    for i in 3...n {
        fibfib.append(fibfib[i-1] + fibfib[i-2] + fibfib[i-3])
    }
    return fibfib[n]
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func vowelsCount(s: String) -> Int {
    // Your code here
}
```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 {
    // Your code here
}
```
} // missing return in global function expected to return 'Int'

func vowelsCount(s: String) -> Int {
    // TODO: Implement this function.
    var vowelsCount = 0
    for i in 0..<s.characters.count {
        if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" {
            vowelsCount += 1
        }
    }
    return vowelsCount
}
```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 {
    // TODO: Implement this function.
    var vowelsCount = 0
    for i in 0..<s.characters.count {
        if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" {
            vowelsCount += 1
        }
    }
    return vowelsCount
}
```
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'characters' is unavailable: Please use String directly
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'characters' is unavailable: Please use String directly
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'characters' is unavailable: Please use String directly
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'characters' is unavailable: Please use String directly
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'characters' is unavailable: Please use String directly
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func vowelsCount(s: String) -> Int {
    // TODO: Implement this function.
    var vowels = 0
    for i in 0..<s.characters.count {
        if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" {
            vowels += 1
        }
    }
    return vowels
}
```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 {
    // TODO: Implement this function.
    var vowels = 0
    for i in 0..<s.characters.count {
        if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" {
            vowels += 1
        }
    }
    return vowels
}
```
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'characters' is unavailable: Please use String directly
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'characters' is unavailable: Please use String directly
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'characters' is unavailable: Please use String directly
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'characters' is unavailable: Please use String directly
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'characters' is unavailable: Please use String directly
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s.characters[i] == "a" || s.characters[i] == "e" || s.characters[i] == "i" || s.characters[i] == "o" || s.characters[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func vowelsCount(s: String) -> Int {
    var vowels = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            vowels += 1
        }
        if c == "y" && s.count > 1 && s[s.count - 1] == "y" {
            vowels += 1
        }
    }
    return vowels
}
```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 vowels = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            vowels += 1
        }
        if c == "y" && s.count > 1 && s[s.count - 1] == "y" {
            vowels += 1
        }
    }
    return vowels
}
```
if c == "y" && s.count > 1 && s[s.count - 1] == "y" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func vowelsCount(s: String) -> Int {
    var vowelsCount = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            vowelsCount += 1
        }
    }
    return vowelsCount
}
```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 vowelsCount = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            vowelsCount += 1
        }
    }
    return vowelsCount
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    var vowels = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            vowels += 1
        }
        if c == "y" && s.count > 1 && s[s.count-1] == "y" {
            vowels += 1
        }
    }
    return vowels
}
```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 vowels = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            vowels += 1
        }
        if c == "y" && s.count > 1 && s[s.count-1] == "y" {
            vowels += 1
        }
    }
    return vowels
}
```
if c == "y" && s.count > 1 && s[s.count-1] == "y" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func vowelsCount(s: String) -> Int {
    var count = 0
    for c in s.characters {
        if c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' {
            count += 1
        } else if c == 'y' && s.characters.count > 0 && s.characters.last == '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.characters {
        if c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' {
            count += 1
        } else if c == 'y' && s.characters.count > 0 && s.characters.last == 'y' {
            count += 1
        }
    }
    return count
}
```
for c in s.characters { // 'characters' is unavailable: Please use String directly
if c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' { // single-quoted string literal found, use '"'
if c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' { // single-quoted string literal found, use '"'
if c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' { // single-quoted string literal found, use '"'
if c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' { // single-quoted string literal found, use '"'
if c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' { // single-quoted string literal found, use '"'
} else if c == 'y' && s.characters.count > 0 && s.characters.last == 'y' { // single-quoted string literal found, use '"'
} else if c == 'y' && s.characters.count > 0 && s.characters.last == 'y' { // single-quoted string literal found, use '"'
} else if c == 'y' && s.characters.count > 0 && s.characters.last == 'y' { // 'characters' is unavailable: Please use String directly
} else if c == 'y' && s.characters.count > 0 && s.characters.last == 'y' { // 'characters' is unavailable: Please use String directly

func vowelsCount(s: String) -> Int {
    var vowels = 0
    for c in s.characters {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            vowels += 1
        } else if c == "y" && s.characters.count > 0 && s.characters.last == "y" {
            vowels += 1
        }
    }
    return vowels
}
```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 vowels = 0
    for c in s.characters {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            vowels += 1
        } else if c == "y" && s.characters.count > 0 && s.characters.last == "y" {
            vowels += 1
        }
    }
    return vowels
}
```
for c in s.characters { // 'characters' is unavailable: Please use String directly
} else if c == "y" && s.characters.count > 0 && s.characters.last == "y" { // 'characters' is unavailable: Please use String directly
} else if c == "y" && s.characters.count > 0 && s.characters.last == "y" { // 'characters' is unavailable: Please use String directly

func vowelsCount(s: String) -> Int {
    var vowelsCount = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            vowelsCount += 1
        }
    }
    return vowelsCount
}
```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 vowelsCount = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            vowelsCount += 1
        }
    }
    return vowelsCount
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    var vowels = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            vowels += 1
        }
    }
    return vowels
}
```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 vowels = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            vowels += 1
        }
    }
    return vowels
}
```
 // XCTAssertTrue failed

func circularShift(x: Int, shift: Int) -> String {
    var result = ""
    var digits = String(x)
    var reversed = ""
    
    for i in digits.characters.reverse() {
        reversed.append(i)
    }
    
    if shift > digits.characters.count {
        return reversed
    }
    
    for i in 0..<digits.characters.count {
        if i < shift {
            result.append(digits[i])
        } else {
            result.append(reversed[i - shift])
        }
    }
    
    return result
}
```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 result = ""
    var digits = String(x)
    var reversed = ""
    
    for i in digits.characters.reverse() {
        reversed.append(i)
    }
    
    if shift > digits.characters.count {
        return reversed
    }
    
    for i in 0..<digits.characters.count {
        if i < shift {
            result.append(digits[i])
        } else {
            result.append(reversed[i - shift])
        }
    }
    
    return result
}
```
for i in digits.characters.reverse() { // value of type 'String' has no member 'reverse'
if shift > digits.characters.count { // 'characters' is unavailable: Please use String directly
for i in 0..<digits.characters.count { // 'characters' is unavailable: Please use String directly
result.append(digits[i]) // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
result.append(reversed[i - shift]) // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func circularShift(x: Int, shift: Int) -> String {
    var digits = String(x)
    var reversed = ""
    for i in digits.characters.reverse() {
        reversed.append(i)
    }
    var result = ""
    for i in 0..<shift {
        result.append(reversed[i])
    }
    for i in shift..<digits.characters.count {
        result.append(digits[i])
    }
    return result
}
```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 digits = String(x)
    var reversed = ""
    for i in digits.characters.reverse() {
        reversed.append(i)
    }
    var result = ""
    for i in 0..<shift {
        result.append(reversed[i])
    }
    for i in shift..<digits.characters.count {
        result.append(digits[i])
    }
    return result
}
```
for i in digits.characters.reverse() { // value of type 'String' has no member 'reverse'
result.append(reversed[i]) // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
for i in shift..<digits.characters.count { // 'characters' is unavailable: Please use String directly
result.append(digits[i]) // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func circularShift(x: Int, shift: Int) -> String {
    var result = String(x)
    var digits = result.characters.map { Int($0) }
    var reversed = digits.reversed()
    var shifted = reversed.dropFirst(shift) + reversed.dropLast(shift)
    return String(shifted.map { String($0) })
}
```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 result = String(x)
    var digits = result.characters.map { Int($0) }
    var reversed = digits.reversed()
    var shifted = reversed.dropFirst(shift) + reversed.dropLast(shift)
    return String(shifted.map { String($0) })
}
```
var digits = result.characters.map { Int($0) } // no exact matches in call to initializer

func circularShift(x: Int, shift: Int) -> String {
    // TODO: Implement
}
```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 {
    // TODO: Implement
}
```
} // missing return in global function expected to return 'String'

func circularShift(x: Int, shift: Int) -> String {
    let xString = String(x)
    let xLength = xString.characters.count
    let shiftLength = shift % xLength
    let xStringReversed = xString.characters.reverse().joinWithSeparator("")
    let xStringShifted = xStringReversed.substringWithRange(NSMakeRange(shiftLength, xLength - shiftLength)) + xStringReversed.substringWithRange(NSMakeRange(0, shiftLength))
    return xStringShifted
}
```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 xString = String(x)
    let xLength = xString.characters.count
    let shiftLength = shift % xLength
    let xStringReversed = xString.characters.reverse().joinWithSeparator("")
    let xStringShifted = xStringReversed.substringWithRange(NSMakeRange(shiftLength, xLength - shiftLength)) + xStringReversed.substringWithRange(NSMakeRange(0, shiftLength))
    return xStringShifted
}
```
let xLength = xString.characters.count // 'characters' is unavailable: Please use String directly
let xStringReversed = xString.characters.reverse().joinWithSeparator("") // value of type 'String' has no member 'reverse'

func circularShift(x: Int, shift: Int) -> String {
    // TODO: Finish this function
    let string = String(x)
    let length = string.characters.count
    let newString = string.substringWithRange(NSMakeRange(length - shift, shift)) + string.substringWithRange(NSMakeRange(0, length - shift))
    return newString
}
```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 {
    // TODO: Finish this function
    let string = String(x)
    let length = string.characters.count
    let newString = string.substringWithRange(NSMakeRange(length - shift, shift)) + string.substringWithRange(NSMakeRange(0, length - shift))
    return newString
}
```
let length = string.characters.count // 'characters' is unavailable: Please use String directly
let newString = string.substringWithRange(NSMakeRange(length - shift, shift)) + string.substringWithRange(NSMakeRange(0, length - shift)) // value of type 'String' has no member 'substringWithRange'
let newString = string.substringWithRange(NSMakeRange(length - shift, shift)) + string.substringWithRange(NSMakeRange(0, length - shift)) // value of type 'String' has no member 'substringWithRange'

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let reversed = digits.characters.reverse().reduce("") { $0 + String($1) }
    let shifted = reversed.characters.dropFirst(shift).append(reversed.characters.prefix(shift)).reduce("") { $0 + String($1) }
    return 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)
    let reversed = digits.characters.reverse().reduce("") { $0 + String($1) }
    let shifted = reversed.characters.dropFirst(shift).append(reversed.characters.prefix(shift)).reduce("") { $0 + String($1) }
    return shifted
}
```
let reversed = digits.characters.reverse().reduce("") { $0 + String($1) } // value of type 'String' has no member 'reverse'

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let reversedDigits = digits.characters.reverse().reduce("") { (result, character) -> String in
        return result + String(character)
    }
    let shiftedDigits = reversedDigits.characters.dropFirst(shift).append(reversedDigits.characters.prefix(shift)).reduce("") { (result, character) -> String in
        return result + String(character)
    }
    return shiftedDigits
}
```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 reversedDigits = digits.characters.reverse().reduce("") { (result, character) -> String in
        return result + String(character)
    }
    let shiftedDigits = reversedDigits.characters.dropFirst(shift).append(reversedDigits.characters.prefix(shift)).reduce("") { (result, character) -> String in
        return result + String(character)
    }
    return shiftedDigits
}
```
let reversedDigits = digits.characters.reverse().reduce("") { (result, character) -> String in // value of type 'String' has no member 'reverse'

func circularShift(x: Int, shift: Int) -> String {
    // TODO: Finish this function
    let xString = String(x)
    let xStringLength = xString.characters.count
    let xStringReversed = xString.characters.reverse().reduce("") { (partialResult, character) -> String in
        return partialResult + String(character)
    }
    let xStringReversedLength = xStringReversed.characters.count
    let xStringReversedShifted = xStringReversed.characters.dropFirst(xStringReversedLength - shift).map { String($0) }.reduce("") { (partialResult, character) -> String in
        return partialResult + String(character)
    }
    return xStringReversedShifted
}
```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 {
    // TODO: Finish this function
    let xString = String(x)
    let xStringLength = xString.characters.count
    let xStringReversed = xString.characters.reverse().reduce("") { (partialResult, character) -> String in
        return partialResult + String(character)
    }
    let xStringReversedLength = xStringReversed.characters.count
    let xStringReversedShifted = xStringReversed.characters.dropFirst(xStringReversedLength - shift).map { String($0) }.reduce("") { (partialResult, character) -> String in
        return partialResult + String(character)
    }
    return xStringReversedShifted
}
```
let xStringLength = xString.characters.count // 'characters' is unavailable: Please use String directly
let xStringReversed = xString.characters.reverse().reduce("") { (partialResult, character) -> String in // value of type 'String' has no member 'reverse'

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let reversed = digits.characters.reverse().reduce("") { (result, char) -> String in
        return result + String(char)
    }
    let shifted = reversed.characters.dropFirst(shift).prefix(digits.characters.count).map { String($0) }.reduce("") { (result, char) -> String in
        return result + String(char)
    }
    return 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)
    let reversed = digits.characters.reverse().reduce("") { (result, char) -> String in
        return result + String(char)
    }
    let shifted = reversed.characters.dropFirst(shift).prefix(digits.characters.count).map { String($0) }.reduce("") { (result, char) -> String in
        return result + String(char)
    }
    return shifted
}
```
let reversed = digits.characters.reverse().reduce("") { (result, char) -> String in // value of type 'String' has no member 'reverse'

func digitSum(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isUpper() {
            sum += Int(c)
        }
    }
    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.unicodeScalars {
        if c.isUpper() {
            sum += Int(c)
        }
    }
    return sum
}
```
if c.isUpper() { // value of type 'Unicode.Scalar' has no member 'isUpper'
sum += Int(c) // no exact matches in call to initializer

func digitSum(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isUpper {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    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.isUpper {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}
```
if c.isUpper { // value of type 'Character' has no member 'isUpper'
sum += Int(c.unicodeScalars.first!) // no exact matches in call to initializer

func digitSum(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII {
            sum += c.value
        }
    }
    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.unicodeScalars {
        if c.isASCII {
            sum += c.value
        }
    }
    return sum
}
```
sum += c.value // cannot convert value of type 'UInt32' to expected argument type 'Int'

func digitSum(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII {
            sum += Int(c)
        }
    }
    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.unicodeScalars {
        if c.isASCII {
            sum += Int(c)
        }
    }
    return sum
}
```
sum += Int(c) // no exact matches in call to initializer

func digitSum(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII {
            sum += c.value
        }
    }
    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.unicodeScalars {
        if c.isASCII {
            sum += c.value
        }
    }
    return sum
}
```
sum += c.value // cannot convert value of type 'UInt32' to expected argument type 'Int'

func digitSum(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isUpper() {
            sum += Int(c)
        }
    }
    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.unicodeScalars {
        if c.isUpper() {
            sum += Int(c)
        }
    }
    return sum
}
```
if c.isUpper() { // value of type 'Unicode.Scalar' has no member 'isUpper'
sum += Int(c) // no exact matches in call to initializer

func digitSum(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII {
            sum += Int(c)
        }
    }
    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.unicodeScalars {
        if c.isASCII {
            sum += Int(c)
        }
    }
    return sum
}
```
sum += Int(c) // no exact matches in call to initializer

func digitSum(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isUpper {
            sum += Int(c)
        }
    }
    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.isUpper {
            sum += Int(c)
        }
    }
    return sum
}
```
if c.isUpper { // value of type 'Character' has no member 'isUpper'
sum += Int(c) // no exact matches in call to initializer

func digitSum(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isUpper {
            sum += Int(c.rawValue)
        }
    }
    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.isUpper {
            sum += Int(c.rawValue)
        }
    }
    return sum
}
```
if c.isUpper { // value of type 'Character' has no member 'isUpper'
sum += Int(c.rawValue) // value of type 'Character' has no member 'rawValue'

func digitSum(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isUpper {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    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.isUpper {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}
```
if c.isUpper { // value of type 'Character' has no member 'isUpper'
sum += Int(c.unicodeScalars.first!) // no exact matches in call to initializer

func fruitDistribution(s: String, n: Int) -> Int {
    // your code goes here
}
```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 {
    // your code goes here
}
```
} // missing return in global function expected to return 'Int'

func fruitDistribution(s: String, n: Int) -> Int {
    // TODO: Complete this function
}
```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 {
    // TODO: Complete this function
}
```
} // missing return in global function expected to return 'Int'

func fruitDistribution(s: String, n: Int) -> Int {
    // your code goes here
}
```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 {
    // your code goes here
}
```
} // missing return in global function expected to return 'Int'

func fruitDistribution(s: String, n: Int) -> Int {
    // your code here
}
```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 {
    // your code here
}
```
} // missing return in global function expected to return 'Int'

func fruitDistribution(s: String, n: Int) -> Int {
    // your code goes here
}
```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 {
    // your code goes here
}
```
} // missing return in global function expected to return 'Int'

```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 {
    // TODO: Complete this function
    // Hint: You can use the String.components(separatedBy:) method to split the string
    // into an array of strings.
    // Hint: You can use the String.split(separator:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:maxSplits:omittingEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:maxSplits:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.components(separatedBy:maxSplits:omittingEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.components(separatedBy:maxSplits:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:maxSplits:omittingEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:maxSplits:allowEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:omittingEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:allowEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:omittingEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:allowEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:omittingEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:omittingEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:omittingEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:omittingEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:omittingEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:) method to split the string into an array of strings.
    // Hint: You can use the String.split(separator:omittingEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:allowEmptySubsequences:
XCTAssertTrue(fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "5 apples and 6 oranges", n: 21) == 10) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "1 apples and 0 oranges", n: 3) == 2) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "2 apples and 3 oranges", n: 5) == 0) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "1 apples and 100 oranges", n: 120) == 19) // cannot find 'fruitDistribution' in scope

```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 {
    // TODO: Complete this function
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // Hint: Use the String's split() function to split the string into an array of strings
    // H
XCTAssertTrue(fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "5 apples and 6 oranges", n: 21) == 10) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "1 apples and 0 oranges", n: 3) == 2) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "2 apples and 3 oranges", n: 5) == 0) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "1 apples and 100 oranges", n: 120) == 19) // cannot find 'fruitDistribution' in scope

```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 {
    // TODO: Complete this function
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // Hint: Use String.split(separator: String) -> [String] to split the string
    // H
XCTAssertTrue(fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "5 apples and 6 oranges", n: 21) == 10) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "1 apples and 0 oranges", n: 3) == 2) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "2 apples and 3 oranges", n: 5) == 0) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "1 apples and 100 oranges", n: 120) == 19) // cannot find 'fruitDistribution' in scope

```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 {
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO: Complete this function
    // Hint: Use the String's built-in methods to extract the number of apples and oranges
    // from the string and use the modulo operator to determine the number of mangos
    
    // TODO
XCTAssertTrue(fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "5 apples and 6 oranges", n: 21) == 10) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "1 apples and 0 oranges", n: 3) == 2) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "2 apples and 3 oranges", n: 5) == 0) // cannot find 'fruitDistribution' in scope
XCTAssertTrue(fruitDistribution(s: "1 apples and 100 oranges", n: 120) == 19) // cannot find 'fruitDistribution' in scope

func fruitDistribution(s: String, n: Int) -> Int {
    // TODO: Implement this method
    return 0
}
```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 {
    // TODO: Implement this method
    return 0
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    // write your code in Swift 4.0
    var result: [Int] = []
    var min: Int = Int.max
    var minIndex: Int = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min == Int.max {
        return result
    }
    result.append(min)
    result.append(minIndex)
    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] {
    // write your code in Swift 4.0
    var result: [Int] = []
    var min: Int = Int.max
    var minIndex: Int = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min == Int.max {
        return result
    }
    result.append(min)
    result.append(minIndex)
    return result
}
```

func pluck(arr: [Int]) -> [Int] {
    var minEvenValue = Int.max
    var minEvenIndex = Int.max
    var minEvenValueIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEvenValue {
            minEvenValue = value
            minEvenIndex = index
            minEvenValueIndex = 0
        } else if value % 2 == 0 && value == minEvenValue {
            minEvenValueIndex += 1
        }
    }
    if minEvenValueIndex > 0 {
        return [minEvenValue, minEvenIndex]
    } else {
        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] {
    var minEvenValue = Int.max
    var minEvenIndex = Int.max
    var minEvenValueIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEvenValue {
            minEvenValue = value
            minEvenIndex = index
            minEvenValueIndex = 0
        } else if value % 2 == 0 && value == minEvenValue {
            minEvenValueIndex += 1
        }
    }
    if minEvenValueIndex > 0 {
        return [minEvenValue, minEvenIndex]
    } else {
        return []
    }
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    // Write your solution here
    var minValue = Int.max
    var minIndex = 0
    var minEvenValue = Int.max
    var minEvenIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEvenValue {
            minEvenValue = value
            minEvenIndex = index
        }
        if value < minValue {
            minValue = value
            minIndex = index
        }
    }
    return [minEvenValue, minEvenIndex]
}
```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] {
    // Write your solution here
    var minValue = Int.max
    var minIndex = 0
    var minEvenValue = Int.max
    var minEvenIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEvenValue {
            minEvenValue = value
            minEvenIndex = index
        }
        if value < minValue {
            minValue = value
            minIndex = index
        }
    }
    return [minEvenValue, minEvenIndex]
}
```
var minIndex = 0 // variable 'minIndex' was written to, but never read
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    var min = arr.first!
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    return [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] {
    var min = arr.first!
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    return [min, minIndex]
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    var min = arr.first!
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    return [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] {
    var min = arr.first!
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    return [min, minIndex]
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    var minEven = Int.max
    var minEvenIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEven {
            minEven = value
            minEvenIndex = index
        }
    }
    return [minEven, minEvenIndex]
}
```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 minEven = Int.max
    var minEvenIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEven {
            minEven = value
            minEvenIndex = index
        }
    }
    return [minEven, minEvenIndex]
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    var smallestEvenValue = Int.max
    var smallestEvenValueIndex = 0
    var smallestEvenValueCount = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 {
            if value < smallestEvenValue {
                smallestEvenValue = value
                smallestEvenValueIndex = index
                smallestEvenValueCount = 1
            } else if value == smallestEvenValue {
                smallestEvenValueCount += 1
            }
        }
    }
    if smallestEvenValueCount > 0 {
        return [smallestEvenValue, smallestEvenValueIndex]
    } else {
        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] {
    var smallestEvenValue = Int.max
    var smallestEvenValueIndex = 0
    var smallestEvenValueCount = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 {
            if value < smallestEvenValue {
                smallestEvenValue = value
                smallestEvenValueIndex = index
                smallestEvenValueCount = 1
            } else if value == smallestEvenValue {
                smallestEvenValueCount += 1
            }
        }
    }
    if smallestEvenValueCount > 0 {
        return [smallestEvenValue, smallestEvenValueIndex]
    } else {
        return []
    }
}
```

func pluck(arr: [Int]) -> [Int] {
    var min = arr.first!
    var minIndex = 0
    var minEven = Int.max
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEven {
            minEven = value
            min = value
            minIndex = index
        }
    }
    return [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] {
    var min = arr.first!
    var minIndex = 0
    var minEven = Int.max
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEven {
            minEven = value
            min = value
            minIndex = index
        }
    }
    return [min, minIndex]
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func pluck(arr: [Int]) -> [Int] {
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    return [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] {
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    return [min, minIndex]
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    var minEven = Int.max
    var minEvenIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEven {
            minEven = value
            minEvenIndex = index
        }
    }
    return [minEven, minEvenIndex]
}
```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 minEven = Int.max
    var minEvenIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEven {
            minEven = value
            minEvenIndex = index
        }
    }
    return [minEven, minEvenIndex]
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var max: Int = -1
    var count: Int = 0
    for i in 0..<lst.count {
        if lst[i] > max && lst[i] > count {
            max = lst[i]
            count = 1
        } else if lst[i] == max {
            count += 1
        }
    }
    return max > 0? max : -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 max: Int = -1
    var count: Int = 0
    for i in 0..<lst.count {
        if lst[i] > max && lst[i] > count {
            max = lst[i]
            count = 1
        } else if lst[i] == max {
            count += 1
        }
    }
    return max > 0? max : -1
}
```
return max > 0? max : -1 // consecutive statements on a line must be separated by ';'
return max > 0? max : -1 // expected expression
return max > 0? max : -1 // consecutive statements on a line must be separated by ';'
return max > 0? max : -1 // cannot use optional chaining on non-optional value of type 'Int'
return max > 0? max : -1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return max > 0? max : -1 // cannot convert return expression of type 'Bool' to return type 'Int'
return max > 0? max : -1 // variable is unused

func search(lst: [Int]) -> Int {
    var max = -1
    var count = 0
    for i in lst {
        if i > max && i > count {
            max = i
            count = 1
        } else if i == max {
            count += 1
        }
    }
    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 max = -1
    var count = 0
    for i in lst {
        if i > max && i > count {
            max = i
            count = 1
        } else if i == max {
            count += 1
        }
    }
    return max
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var max = 0
    var count = 0
    for i in lst {
        if i > max {
            max = i
            count = 1
        } else if i == max {
            count += 1
        }
    }
    if count >= max {
        return max
    } else {
        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 max = 0
    var count = 0
    for i in lst {
        if i > max {
            max = i
            count = 1
        } else if i == max {
            count += 1
        }
    }
    if count >= max {
        return max
    } else {
        return -1
    }
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var max = -1
    var count = 0
    for i in lst {
        if i > max && i > count {
            max = i
            count = 1
        } else if i == max {
            count += 1
        }
    }
    if max == -1 {
        return -1
    } else {
        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 max = -1
    var count = 0
    for i in lst {
        if i > max && i > count {
            max = i
            count = 1
        } else if i == max {
            count += 1
        }
    }
    if max == -1 {
        return -1
    } else {
        return max
    }
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var max = -1
    var count = 0
    for i in lst {
        if i > max && i > count {
            max = i
            count = 1
        } else if i == max {
            count += 1
        }
    }
    if count >= max {
        return max
    } else {
        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 max = -1
    var count = 0
    for i in lst {
        if i > max && i > count {
            max = i
            count = 1
        } else if i == max {
            count += 1
        }
    }
    if count >= max {
        return max
    } else {
        return -1
    }
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var max = -1
    var count = 0
    for i in lst {
        count += 1
        if count >= i {
            max = i
        }
    }
    return max
}

func find(lst: [Int]) -> Int {
    var count = [Int]()
    for i in lst {
        if count[i] == nil {
            count[i] = 1
        } else {
            count[i] += 1
        }
    }
    for i in count {
        if i == 1 {
            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 max = -1
    var count = 0
    for i in lst {
        count += 1
        if count >= i {
            max = i
        }
    }
    return max
}

// You are given a non-empty array of positive integers.
// One element appears exactly once, with every other element appearing at least twice, perhaps 
// multiple times. 
// Return the element that appears exactly once.
// Example:
// find(lst: [4, 1, 2, 2, 3, 1]) == 2
// find(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 1
// find(lst: [5, 5, 4, 4, 4]) == 5
func find(lst: [Int]) -> Int {
    var count = [Int]()
    for i in lst {
        if count[i] == nil {
            count[i] = 1
        } else {
            count[i] += 1
        }
    }
    for i in count {
        if i == 1 {
            return i
        }
    }
    return -1
}

// You are given a non-empty array of positive integers.
// One element appears exactly once, with every other element appearing at least twice, perhaps 
// multiple times. 
// Return the element that appears exactly once.
// Example:
// find(lst: [4, 1, 2, 2, 3, 1]) == 2
// find(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 1
// find(lst: [5, 5, 4, 4, 4]) == 5
func find(lst: [Int]) -> Int {
    var count = [Int]()
    for i in lst {
        if count[i] == nil {
            count[i] = 1
        } else {
            count[i] += 1
        }
    }
    for i in count {
        if i == 1 {
            return i
        }
    }
    return -1
}

// You are given a non-empty array of integers.
// One element appears exactly once, with every other element appearing at least twice, perhaps 
// multiple times. 
// Return the element that appears exactly once.
// Example:
// find(lst: [4, 1, 2, 2, 3, 1]) == 2
// find(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 1
// find(lst: [5, 5, 4, 4, 4]) == 5
func find(lst: [Int]) -> Int {
    var count = [Int]()
    for i in lst {
        if count[i] == nil {
            count[i] = 1
        } else {
            count[i] += 1
        }
    }
    for i in count {
        if i == 1 {
            return i
        }
    }
    return -1
}

// You are given a non-empty array of integers.
// One element appears exactly once, with every other element appearing at least twice, perhaps 
// multiple times. 
// Return the element that appears exactly once.
// Example:
// find(lst: [4, 1, 2, 2, 3, 1]) == 2
// find(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 1
// find(lst: [5, 5, 4, 4, 4]) == 5
func find(lst: [Int]) -> Int {
    var count = [Int]()
    for i in lst {
        if count[i] == nil {
            count[i] = 1
        } else {
            count[i] += 1
        }
    }
    for i in count {
        if i == 1 {
            return i
        }
    }
    return -1
}

// You are given a non-empty array of integers.
// One element appears exactly once, with every other element appearing at least twice, perhaps 
// multiple times. 
// Return the element that appears exactly once.
// Example:
// find(lst: [4, 1, 2, 2, 3, 1]) == 2
// find(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 1
// find
if count[i] == nil { // comparing non-optional value of type 'Int' to 'nil' always returns false
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var max = -1
    var count = 0
    for i in lst {
        if i > max && count >= i {
            max = i
        } else if i > max {
            count = 1
        } else {
            count += 1
        }
    }
    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 max = -1
    var count = 0
    for i in lst {
        if i > max && count >= i {
            max = i
        } else if i > max {
            count = 1
        } else {
            count += 1
        }
    }
    return max
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var max = 0
    var maxCount = 0
    var count = 0
    for i in 0..<lst.count {
        count = 0
        for j in 0..<lst.count {
            if lst[i] == lst[j] {
                count += 1
            }
        }
        if count >= lst[i] && count > maxCount {
            max = lst[i]
            maxCount = count
        }
    }
    if maxCount == 0 {
        return -1
    } else {
        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 max = 0
    var maxCount = 0
    var count = 0
    for i in 0..<lst.count {
        count = 0
        for j in 0..<lst.count {
            if lst[i] == lst[j] {
                count += 1
            }
        }
        if count >= lst[i] && count > maxCount {
            max = lst[i]
            maxCount = count
        }
    }
    if maxCount == 0 {
        return -1
    } else {
        return max
    }
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var max = -1
    var count = 0
    for i in 0..<lst.count {
        count = 0
        for j in 0..<lst.count {
            if lst[i] == lst[j] {
                count += 1
            }
        }
        if count >= lst[i] && lst[i] > max {
            max = lst[i]
        }
    }
    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 max = -1
    var count = 0
    for i in 0..<lst.count {
        count = 0
        for j in 0..<lst.count {
            if lst[i] == lst[j] {
                count += 1
            }
        }
        if count >= lst[i] && lst[i] > max {
            max = lst[i]
        }
    }
    return max
}
```

func search(lst: [Int]) -> Int {
    var max: Int = -1
    var count: Int = 0
    for i in 0..<lst.count {
        count = 0
        for j in 0..<lst.count {
            if lst[i] == lst[j] {
                count += 1
            }
        }
        if count >= lst[i] && count > max {
            max = count
        }
    }
    return max
}

func maxUnique(lst: [Int]) -> Int {
    var max: Int = 0
    var count: Int = 0
    var temp: Int = 0
    for i in 0..<lst.count {
        count = 0
        for j in 0..<lst.count {
            if lst[i] == lst[j] {
                count += 1
            }
        }
        if count > temp {
            temp = count
        }
    }
    max = temp
    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 max: Int = -1
    var count: Int = 0
    for i in 0..<lst.count {
        count = 0
        for j in 0..<lst.count {
            if lst[i] == lst[j] {
                count += 1
            }
        }
        if count >= lst[i] && count > max {
            max = count
        }
    }
    return max
}

// You are given a non-empty array of positive integers. Return the maximum number of elements such that 
// no two elements are equal.
// Example:
// maxUnique(lst: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 9
// maxUnique(lst: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1
// maxUnique(lst: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20
func maxUnique(lst: [Int]) -> Int {
    var max: Int = 0
    var count: Int = 0
    var temp: Int = 0
    for i in 0..<lst.count {
        count = 0
        for j in 0..<lst.count {
            if lst[i] == lst[j] {
                count += 1
            }
        }
        if count > temp {
            temp = count
        }
    }
    max = temp
    return max
}

// You are given a non-empty array of positive integers. Return the maximum number of elements such that 
// no two elements are equal.
// Example:
// maxUnique(lst: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 9
// maxUnique(lst: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1
// maxUnique(lst: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20
func maxUnique(lst: [Int]) -> Int {
    var max: Int = 0
    var count: Int = 0
    var temp: Int = 0
    for i in 0..<lst.count {
        count = 0
        for j in 0..<lst.count {
            if lst[i] == lst[j] {
                count += 1
            }
        }
        if count > temp {
            temp = count
        }
    }
    max = temp
    return max
}

// You are given a non-empty array of positive integers. Return the maximum number of elements such that 
// no two elements are equal.
// Example:
// maxUnique(lst: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 9
// maxUnique(lst: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1
// maxUnique(lst: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) == 20
func maxUnique(lst: [Int]) -> Int {
    var max: Int = 0
    var count: Int = 0
    var temp: Int = 0
    for i in 0..<lst.count {
        count = 0
        for j in 0..<lst.count {
            if lst[i] == lst[j] {
                count += 1
            }
        }
        if count > temp {
            temp = count
        }
    }
    max = temp
    return max
}

// You are given a non-empty array of positive integers. Return the maximum number of elements such that 
// no two elements are equal.
// Example:
// maxUnique(lst: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 9
// maxUnique(lst: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 1
// maxUnique(lst: [1, 2, 3, 4, 5, 6, 7, 8
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    var result: [Int] = []
    var min: Int = lst.minElement()!
    var max: Int = lst.maxElement()!
    var i: Int = 0
    while i < lst.count {
        result.append(min)
        i += 1
    }
    while i < lst.count {
        result.append(max)
        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] {
    var result: [Int] = []
    var min: Int = lst.minElement()!
    var max: Int = lst.maxElement()!
    var i: Int = 0
    while i < lst.count {
        result.append(min)
        i += 1
    }
    while i < lst.count {
        result.append(max)
        i += 1
    }
    return result
}
```
var min: Int = lst.minElement()! // value of type '[Int]' has no member 'minElement'
var max: Int = lst.maxElement()! // value of type '[Int]' has no member 'maxElement'

func strangeSortList(lst: [Int]) -> [Int] {
    var sorted = lst
    var i = 0
    while i < lst.count {
        var min = sorted[0]
        var minIndex = 0
        for j in 0..<sorted.count {
            if sorted[j] < min {
                min = sorted[j]
                minIndex = j
            }
        }
        sorted.removeAtIndex(minIndex)
        sorted.insertAtIndex(min, i)
        i += 1
    }
    return sorted
}
```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] {
    var sorted = lst
    var i = 0
    while i < lst.count {
        var min = sorted[0]
        var minIndex = 0
        for j in 0..<sorted.count {
            if sorted[j] < min {
                min = sorted[j]
                minIndex = j
            }
        }
        sorted.removeAtIndex(minIndex)
        sorted.insertAtIndex(min, i)
        i += 1
    }
    return sorted
}
```
sorted.removeAtIndex(minIndex) // value of type '[Int]' has no member 'removeAtIndex'
sorted.insertAtIndex(min, i) // value of type '[Int]' has no member 'insertAtIndex'

func strangeSortList(lst: [Int]) -> [Int] {
    var result = [Int]()
    var i = 0
    var j = lst.count - 1
    while i < j {
        result.append(lst[i])
        result.append(lst[j])
        i += 1
        j -= 1
    }
    if i == j {
        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] {
    var result = [Int]()
    var i = 0
    var j = lst.count - 1
    while i < j {
        result.append(lst[i])
        result.append(lst[j])
        i += 1
        j -= 1
    }
    if i == j {
        result.append(lst[i])
    }
    return result
}
```
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    var result = [Int]()
    var i = 0
    while i < lst.count {
        result.append(lst[i])
        i = 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] {
    var result = [Int]()
    var i = 0
    while i < lst.count {
        result.append(lst[i])
        i = i + 1
    }
    return result
}
```
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    var sorted = lst
    var i = 0
    while i < lst.count {
        var min = lst[i]
        var minIndex = i
        for j in i+1..<lst.count {
            if lst[j] < min {
                min = lst[j]
                minIndex = j
            }
        }
        sorted.removeAtIndex(minIndex)
        sorted.insert(min, atIndex: i)
        i += 1
    }
    return sorted
}
```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] {
    var sorted = lst
    var i = 0
    while i < lst.count {
        var min = lst[i]
        var minIndex = i
        for j in i+1..<lst.count {
            if lst[j] < min {
                min = lst[j]
                minIndex = j
            }
        }
        sorted.removeAtIndex(minIndex)
        sorted.insert(min, atIndex: i)
        i += 1
    }
    return sorted
}
```
sorted.removeAtIndex(minIndex) // value of type '[Int]' has no member 'removeAtIndex'
sorted.insert(min, atIndex: i) // no exact matches in call to instance method 'insert'

func strangeSortList(lst: [Int]) -> [Int] {
    var sorted = lst
    var min = sorted.minElement()!
    var max = sorted.maxElement()!
    var index = sorted.indexOf(min)!
    sorted.removeAtIndex(index)
    sorted.insertAtIndex(max, atIndex: 0)
    var index = sorted.indexOf(max)!
    sorted.removeAtIndex(index)
    sorted.insertAtIndex(min, atIndex: 0)
    return sorted
}
```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] {
    var sorted = lst
    var min = sorted.minElement()!
    var max = sorted.maxElement()!
    var index = sorted.indexOf(min)!
    sorted.removeAtIndex(index)
    sorted.insertAtIndex(max, atIndex: 0)
    var index = sorted.indexOf(max)!
    sorted.removeAtIndex(index)
    sorted.insertAtIndex(min, atIndex: 0)
    return sorted
}
```
var min = sorted.minElement()! // value of type '[Int]' has no member 'minElement'
var max = sorted.maxElement()! // value of type '[Int]' has no member 'maxElement'
var index = sorted.indexOf(min)! // value of type '[Int]' has no member 'indexOf'
sorted.removeAtIndex(index) // value of type '[Int]' has no member 'removeAtIndex'
sorted.insertAtIndex(max, atIndex: 0) // value of type '[Int]' has no member 'insertAtIndex'
var index = sorted.indexOf(max)! // value of type '[Int]' has no member 'indexOf'
sorted.removeAtIndex(index) // value of type '[Int]' has no member 'removeAtIndex'
sorted.insertAtIndex(min, atIndex: 0) // value of type '[Int]' has no member 'insertAtIndex'

func strangeSortList(lst: [Int]) -> [Int] {
    var result: [Int] = []
    var i = 0
    var j = lst.count - 1
    while i < j {
        result.append(lst[i])
        result.append(lst[j])
        i += 1
        j -= 1
    }
    if i == j {
        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] {
    var result: [Int] = []
    var i = 0
    var j = lst.count - 1
    while i < j {
        result.append(lst[i])
        result.append(lst[j])
        i += 1
        j -= 1
    }
    if i == j {
        result.append(lst[i])
    }
    return result
}
```
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    var sorted = lst
    var min = sorted.minElement()!
    var max = sorted.maxElement()!
    sorted.removeAll(where: { $0 == min })
    sorted.removeAll(where: { $0 == max })
    sorted.insert(max, atIndex: 0)
    sorted.insert(min, atIndex: sorted.count)
    return sorted
}
```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] {
    var sorted = lst
    var min = sorted.minElement()!
    var max = sorted.maxElement()!
    sorted.removeAll(where: { $0 == min })
    sorted.removeAll(where: { $0 == max })
    sorted.insert(max, atIndex: 0)
    sorted.insert(min, atIndex: sorted.count)
    return sorted
}
```
var min = sorted.minElement()! // value of type '[Int]' has no member 'minElement'
var max = sorted.maxElement()! // value of type '[Int]' has no member 'maxElement'
sorted.insert(max, atIndex: 0) // no exact matches in call to instance method 'insert'
sorted.insert(min, atIndex: sorted.count) // no exact matches in call to instance method 'insert'

func strangeSortList(lst: [Int]) -> [Int] {
    var sorted = lst
    var min = sorted.first!
    var max = sorted.last!
    sorted.removeFirst()
    sorted.removeLast()
    while sorted.count > 0 {
        sorted.append(max)
        sorted.append(min)
        max = sorted.removeFirst()
        min = sorted.removeLast()
    }
    return sorted
}
```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] {
    var sorted = lst
    var min = sorted.first!
    var max = sorted.last!
    sorted.removeFirst()
    sorted.removeLast()
    while sorted.count > 0 {
        sorted.append(max)
        sorted.append(min)
        max = sorted.removeFirst()
        min = sorted.removeLast()
    }
    return sorted
}
```

func strangeSortList(lst: [Int]) -> [Int] {
    var result = [Int]()
    var index = 0
    while index < lst.count {
        result.append(lst[index])
        index = lst.count - 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] {
    var result = [Int]()
    var index = 0
    while index < lst.count {
        result.append(lst[index])
        index = lst.count - index - 1
    }
    return result
}
```

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    // Your code here
}
```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 {
    // Your code here
}
```
} // missing return in global function expected to return 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    // Your code here
}
```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 {
    // Your code here
}
```
} // missing return in global function expected to return 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    // TODO: Implement this function
    return -1
}
```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 {
    // TODO: Implement this function
    return -1
}
```
 // XCTAssertTrue failed

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    if a + b > c && a + c > b && b + c > a {
        return Double(a * b) / 2
    }
    return -1
}
```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 {
    if a + b > c && a + c > b && b + c > a {
        return Double(a * b) / 2
    }
    return -1
}
```
 // XCTAssertTrue failed

```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 {
    // TODO: Implement this function
    // Hint: Use the Heron's formula
    // https://en.wikipedia.org/wiki/Heron%27s_formula
    // https://en.wikipedia.org/wiki/Triangle
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Pythagorean_theorem
    // https://en.wikipedia.org/wiki/Heron%27s_formula
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/
XCTAssertTrue(triangleArea(a: 3, b: 4, c: 5) == 6.0) // cannot find 'triangleArea' in scope
XCTAssertTrue(triangleArea(a: 1, b: 2, c: 10) == -1) // cannot find 'triangleArea' in scope
XCTAssertTrue(triangleArea(a: 4, b: 8, c: 5) == 8.18) // cannot find 'triangleArea' in scope
XCTAssertTrue(triangleArea(a: 2, b: 2, c: 2) == 1.73) // cannot find 'triangleArea' in scope
XCTAssertTrue(triangleArea(a: 1, b: 2, c: 3) == -1) // cannot find 'triangleArea' in scope
XCTAssertTrue(triangleArea(a: 10, b: 5, c: 7) == 16.25) // cannot find 'triangleArea' in scope
XCTAssertTrue(triangleArea(a: 2, b: 6, c: 3) == -1) // cannot find 'triangleArea' in scope
XCTAssertTrue(triangleArea(a: 1, b: 1, c: 1) == 0.43) // cannot find 'triangleArea' in scope
XCTAssertTrue(triangleArea(a: 2, b: 2, c: 10) == -1) // cannot find 'triangleArea' in scope

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    // TODO: Implement this function
    if a + b > c && a + c > b && b + c > a {
        return Double(a * b) / 2
    } else {
        return -1
    }
}
```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 {
    // TODO: Implement this function
    if a + b > c && a + c > b && b + c > a {
        return Double(a * b) / 2
    } else {
        return -1
    }
}
```
 // XCTAssertTrue failed

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    if a + b > c && a + c > b && b + c > a {
        let s = (a + b + c) / 2
        return sqrt(s * (s - a) * (s - b) * (s - c))
    }
    return -1
}
```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 {
    if a + b > c && a + c > b && b + c > a {
        let s = (a + b + c) / 2
        return sqrt(s * (s - a) * (s - b) * (s - c))
    }
    return -1
}
```
return 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 {
    // Write your code here.
    return q.isBalanced() && q.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 {
    // Write your code here.
    return q.isBalanced() && q.sum() <= w
}
```
return q.isBalanced() && q.sum() <= w // value of type '[Int]' has no member 'sum'
return q.isBalanced() && q.sum() <= w // value of type '[Int]' has no member 'isBalanced'

func willItFly(q: [Int], w: Int) -> Bool {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Bool'

func willItFly(q: [Int], w: Int) -> Bool {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Bool'

func willItFly(q: [Int], w: Int) -> Bool {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Bool'

func willItFly(q: [Int], w: Int) -> Bool {
    return q.isBalanced() && q.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 {
    return q.isBalanced() && q.sum() <= w
}
```
return q.isBalanced() && q.sum() <= w // value of type '[Int]' has no member 'sum'
return q.isBalanced() && q.sum() <= w // value of type '[Int]' has no member 'isBalanced'

func willItFly(q: [Int], w: Int) -> Bool {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Bool'

func willItFly(q: [Int], w: Int) -> Bool {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Bool'

func willItFly(q: [Int], w: Int) -> Bool {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func willItFly(q: [Int], w: Int) -> Bool {
    return isBalanced(q) && sum(q) <= 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 {
    return isBalanced(q) && sum(q) <= w
}
```
return isBalanced(q) && sum(q) <= w // cannot find 'sum' in scope
return isBalanced(q) && sum(q) <= w // cannot find 'isBalanced' in scope

func willItFly(q: [Int], w: Int) -> Bool {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func smallestChange(arr: [Int]) -> Int {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'Int'

func smallestChange(arr: [Int]) -> Int {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func smallestChange(arr: [Int]) -> Int {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Int'

func smallestChange(arr: [Int]) -> Int {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func smallestChange(arr: [Int]) -> Int {
    var count = 0
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i]!= arr[j] {
            count += abs(arr[i] - arr[j])
            if arr[i] > arr[j] {
                arr[i] = arr[j]
            } else {
                arr[j] = arr[i]
            }
        }
        i += 1
        j -= 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 {
    var count = 0
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i]!= arr[j] {
            count += abs(arr[i] - arr[j])
            if arr[i] > arr[j] {
                arr[i] = arr[j]
            } else {
                arr[j] = arr[i]
            }
        }
        i += 1
        j -= 1
    }
    return count
}
```
if arr[i]!= arr[j] { // cannot force unwrap value of non-optional type 'Int'
if arr[i]!= arr[j] { // use of '=' in a boolean context, did you mean '=='?
if arr[i]!= arr[j] { // '=' must have consistent whitespace on both sides
arr[i] = arr[j] // cannot assign through subscript: 'arr' is a 'let' constant
arr[j] = arr[i] // cannot assign through subscript: 'arr' is a 'let' constant

func smallestChange(arr: [Int]) -> Int {
    // Write your solution 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 solution here
    return 0
}
```
 // XCTAssertTrue failed

func smallestChange(arr: [Int]) -> Int {
    // TODO: implement
}
```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 {
    // TODO: implement
}
```
} // missing return in global function expected to return 'Int'

func smallestChange(arr: [Int]) -> Int {
    // Write your solution 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 solution here
    return 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 {
    // TODO: Implement this function
    // Hint: Use a dictionary to store the frequency of each number
    // Hint: Use a set to store the numbers that are already in the correct position
    // Hint: Use a queue to store the numbers that need to be moved
    // Hint: Use a while loop to iterate over the queue
    // Hint: Use a for loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
    // Hint: Use a while loop to iterate over the array
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 {
    // TODO: Implement this function
    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 {
    // TODO: Implement this function
    return 0
}
```
 // XCTAssertTrue failed

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    // TODO: Implement this function
}
```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] {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return '[String]'

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    // TODO: 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] {
    // TODO: Your code here
}
```
} // missing return in global function expected to return '[String]'

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result: [String] = []
    for str in lst1 {
        if str.count < lst2.reduce(0, combine: +) {
            result.append(str)
        }
    }
    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] = []
    for str in lst1 {
        if str.count < lst2.reduce(0, combine: +) {
            result.append(str)
        }
    }
    return result
}
```
if str.count < lst2.reduce(0, combine: +) { // extraneous argument label 'combine:' in call
if str.count < lst2.reduce(0, combine: +) { // cannot convert value of type '(Int) -> Int' to expected argument type '(Int, String) throws -> Int'

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result: [String] = []
    var lst1Count = 0
    var lst2Count = 0
    for str in lst1 {
        lst1Count += str.count
    }
    for str in lst2 {
        lst2Count += str.count
    }
    if lst1Count < lst2Count {
        result = lst1
    } else if lst1Count == lst2Count {
        result = lst1
    } else {
        result = lst2
    }
    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 lst1Count = 0
    var lst2Count = 0
    for str in lst1 {
        lst1Count += str.count
    }
    for str in lst2 {
        lst2Count += str.count
    }
    if lst1Count < lst2Count {
        result = lst1
    } else if lst1Count == lst2Count {
        result = lst1
    } else {
        result = lst2
    }
    return result
}
```

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result = [String]()
    var lst1_count = 0
    var lst2_count = 0
    for i in 0..<lst1.count {
        lst1_count += lst1[i].count
    }
    for i in 0..<lst2.count {
        lst2_count += lst2[i].count
    }
    if lst1_count < lst2_count {
        result = lst1
    } else if lst1_count > lst2_count {
        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 lst1_count = 0
    var lst2_count = 0
    for i in 0..<lst1.count {
        lst1_count += lst1[i].count
    }
    for i in 0..<lst2.count {
        lst2_count += lst2[i].count
    }
    if lst1_count < lst2_count {
        result = lst1
    } else if lst1_count > lst2_count {
        result = lst2
    } else {
        result = lst1
    }
    return result
}
```

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    let lst1Count = lst1.reduce(0, combine: +)
    let lst2Count = lst2.reduce(0, combine: +)
    
    if lst1Count < lst2Count {
        return lst1
    } else if lst1Count == lst2Count {
        return lst1.sorted(by: >)
    } 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] {
    let lst1Count = lst1.reduce(0, combine: +)
    let lst2Count = lst2.reduce(0, combine: +)
    
    if lst1Count < lst2Count {
        return lst1
    } else if lst1Count == lst2Count {
        return lst1.sorted(by: >)
    } else {
        return lst2
    }
}
```
let lst1Count = lst1.reduce(0, combine: +) // cannot convert value of type '(Int) -> Int' to expected argument type '(Int, String) throws -> Int'
let lst1Count = lst1.reduce(0, combine: +) // extraneous argument label 'combine:' in call
let lst2Count = lst2.reduce(0, combine: +) // cannot convert value of type '(Int) -> Int' to expected argument type '(Int, String) throws -> Int'
let lst2Count = lst2.reduce(0, combine: +) // extraneous argument label 'combine:' in call

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result: [String] = []
    var lst1Count = 0
    var lst2Count = 0
    for i in 0..<lst1.count {
        lst1Count += lst1[i].count
    }
    for i in 0..<lst2.count {
        lst2Count += lst2[i].count
    }
    if lst1Count < lst2Count {
        result = lst1
    } else if lst1Count > lst2Count {
        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 lst1Count = 0
    var lst2Count = 0
    for i in 0..<lst1.count {
        lst1Count += lst1[i].count
    }
    for i in 0..<lst2.count {
        lst2Count += lst2[i].count
    }
    if lst1Count < lst2Count {
        result = lst1
    } else if lst1Count > lst2Count {
        result = lst2
    } else {
        result = lst1
    }
    return result
}
```

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result: [String] = []
    var lst1_count = 0
    var lst2_count = 0
    for i in 0..<lst1.count {
        lst1_count += lst1[i].count
        lst2_count += lst2[i].count
    }
    if lst1_count < lst2_count {
        result = lst1
    } else if lst1_count > lst2_count {
        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 lst1_count = 0
    var lst2_count = 0
    for i in 0..<lst1.count {
        lst1_count += lst1[i].count
        lst2_count += lst2[i].count
    }
    if lst1_count < lst2_count {
        result = lst1
    } else if lst1_count > lst2_count {
        result = lst2
    } else {
        result = lst1
    }
    return result
}
```
 // XCTAssertTrue failed

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result: [String] = []
    for i in 0..<lst1.count {
        if lst1[i].count < lst2[i].count {
            result.append(lst1[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] = []
    for i in 0..<lst1.count {
        if lst1[i].count < lst2[i].count {
            result.append(lst1[i])
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result: [String] = []
    var lst1Count = 0
    var lst2Count = 0
    for i in 0..<lst1.count {
        lst1Count += lst1[i].count
        for j in 0..<lst2.count {
            lst2Count += lst2[j].count
            if lst1Count == lst2Count {
                result.append(contentsOf: lst1)
                return result
            }
        }
        lst2Count = 0
    }
    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 lst1Count = 0
    var lst2Count = 0
    for i in 0..<lst1.count {
        lst1Count += lst1[i].count
        for j in 0..<lst2.count {
            lst2Count += lst2[j].count
            if lst1Count == lst2Count {
                result.append(contentsOf: lst1)
                return result
            }
        }
        lst2Count = 0
    }
    return result
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Bool'

func isMultiplyPrime(a: Int) -> Bool {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Bool'

func isMultiplyPrime(a: Int) -> Bool {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Bool'

func isMultiplyPrime(a: Int) -> Bool {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Bool'

func isMultiplyPrime(a: Int) -> Bool {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Bool'

func isMultiplyPrime(a: Int) -> Bool {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Bool'

func isMultiplyPrime(a: Int) -> Bool {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Bool'

func isMultiplyPrime(a: Int) -> Bool {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'Bool'

func isMultiplyPrime(a: Int) -> Bool {
    // your code goes 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 {
    // your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func isMultiplyPrime(a: Int) -> Bool {
    // 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 {
    // Your code here
}
```
} // missing return in global function expected to return 'Bool'

func isSimplePower(x: Int, n: Int) -> Bool {
    // your code goes here
}
```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 {
    // your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func isSimplePower(x: Int, n: Int) -> Bool {
    // Your code here
}
```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 {
    // Your code here
}
```
} // missing return in global function expected to return 'Bool'

func isSimplePower(x: Int, n: Int) -> Bool {
    // Your code here
}
```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 {
    // Your code here
}
```
} // missing return in global function expected to return 'Bool'

func isSimplePower(x: Int, n: Int) -> Bool {
    // your code here
}
```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 {
    // your code here
}
```
} // missing return in global function expected to return 'Bool'

func isSimplePower(x: Int, n: Int) -> Bool {
    return x == n ** Int(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 x == n ** Int(x)
}
```
return x == n ** Int(x) // no operator '**' is defined; did you mean 'pow(_:_:)'?

func isSimplePower(x: Int, n: Int) -> Bool {
    return x == n ** Int(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 x == n ** Int(x)
}
```
return x == n ** Int(x) // no operator '**' is defined; did you mean 'pow(_:_:)'?

func isSimplePower(x: Int, n: Int) -> Bool {
    // TODO: Your code goes here
}
```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 {
    // TODO: Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func isSimplePower(x: Int, n: Int) -> Bool {
    // your code goes here
}
```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 {
    // your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func isSimplePower(x: Int, n: Int) -> Bool {
    // your code goes here
}
```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 {
    // your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func isSimplePower(x: Int, n: Int) -> Bool {
    // your code here
}
```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 {
    // your code here
}
```
} // missing return in global function expected to return 'Bool'

func iscube(a: Int) -> Bool {
    // TODO: implement this function
}
```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 {
    // TODO: implement this function
}
```
} // missing return in global function expected to return 'Bool'

func iscube(a: Int) -> Bool {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'Bool'

func iscube(a: Int) -> Bool {
    // your code here
}
```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 {
    // your code here
}
```
} // missing return in global function expected to return 'Bool'

func iscube(a: Int) -> Bool {
    return a == Int(Int(a) ** 3)
}
```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 {
    return a == Int(Int(a) ** 3)
}
```
return a == Int(Int(a) ** 3) // no operator '**' is defined; did you mean 'pow(_:_:)'?

func iscube(a: Int) -> Bool {
    return a == Int(Int(a) ** 3)
}
```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 {
    return a == Int(Int(a) ** 3)
}
```
return a == Int(Int(a) ** 3) // no operator '**' is defined; did you mean 'pow(_:_:)'?

func iscube(a: Int) -> Bool {
    // your code here
}
```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 {
    // your code here
}
```
} // missing return in global function expected to return 'Bool'

func iscube(a: Int) -> Bool {
    return Int(Int(a).sqrt()) * Int(Int(a).sqrt()) * Int(Int(a).sqrt()) == 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 {
    return Int(Int(a).sqrt()) * Int(Int(a).sqrt()) * Int(Int(a).sqrt()) == a
}
```

func iscube(a: Int) -> Bool {
    return a == Int(Int(a).sqrt() * Int(a).sqrt() * Int(a).sqrt())
}
```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 {
    return a == Int(Int(a).sqrt() * Int(a).sqrt() * Int(a).sqrt())
}
```

func iscube(a: Int) -> Bool {
    return a == Int(Int(a).sqrt() * Int(a).sqrt() * Int(a).sqrt())
}
```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 {
    return a == Int(Int(a).sqrt() * Int(a).sqrt() * Int(a).sqrt())
}
```

func iscube(a: Int) -> Bool {
    return a == Int(Int(a).sqrt() * Int(a).sqrt() * Int(a).sqrt())
}
```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 {
    return a == Int(Int(a).sqrt() * Int(a).sqrt() * Int(a).sqrt())
}
```

func hexKey(num: String) -> Int {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Int'

func hexKey(num: String) -> Int {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Int'

func hexKey(num: String) -> Int {
    // your implementation 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 {
    // your implementation here
}
```
} // missing return in global function expected to return 'Int'

func hexKey(num: String) -> Int {
    // your code goes 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 {
    // your code goes here
}
```
} // missing return in global function expected to return 'Int'

func hexKey(num: String) -> Int {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Int'

func hexKey(num: String) -> Int {
    let hexDigits = "0123456789ABCDEF"
    var count = 0
    for char in num {
        if hexDigits.contains(char) && isPrime(Int(char, radix: 16)) {
            count += 1
        }
    }
    return count
}
```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"
    var count = 0
    for char in num {
        if hexDigits.contains(char) && isPrime(Int(char, radix: 16)) {
            count += 1
        }
    }
    return count
}
```
if hexDigits.contains(char) && isPrime(Int(char, radix: 16)) { // initializer 'init(_:radix:)' requires that 'Character' conform to 'StringProtocol'
if hexDigits.contains(char) && isPrime(Int(char, radix: 16)) { // cannot find 'isPrime' in scope

func hexKey(num: String) -> Int {
    var count = 0
    for digit in num.unicodeScalars {
        if digit.value >= 2 && digit.value <= 9 {
            if isPrime(digit.value) {
                count += 1
            }
        } else if digit.value >= 10 && digit.value <= 15 {
            if isPrime(digit.value - 10) {
                count += 1
            }
        }
    }
    return count
}

func isPrime(number: Int) -> Bool {
    if number < 2 {
        return false
    }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```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 count = 0
    for digit in num.unicodeScalars {
        if digit.value >= 2 && digit.value <= 9 {
            if isPrime(digit.value) {
                count += 1
            }
        } else if digit.value >= 10 && digit.value <= 15 {
            if isPrime(digit.value - 10) {
                count += 1
            }
        }
    }
    return count
}

// MARK: - Helper functions

func isPrime(number: Int) -> Bool {
    if number < 2 {
        return false
    }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
if isPrime(digit.value) { // cannot convert value of type 'UInt32' to expected argument type 'Int'
if isPrime(digit.value) { // missing argument label 'number:' in call
if isPrime(digit.value - 10) { // cannot convert value of type 'UInt32' to expected argument type 'Int'
if isPrime(digit.value - 10) { // missing argument label 'number:' in call

func hexKey(num: String) -> Int {
    var count = 0
    for i in num.utf8.indices {
        let c = num[i]
        if c == "2"[c] || c == "3"[c] || c == "5"[c] || c == "7"[c] || c == "B"[c] || c == "D"[c] {
            count += 1
        }
    }
    return count
}
```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 count = 0
    for i in num.utf8.indices {
        let c = num[i]
        if c == "2"[c] || c == "3"[c] || c == "5"[c] || c == "7"[c] || c == "B"[c] || c == "D"[c] {
            count += 1
        }
    }
    return count
}
```
if c == "2"[c] || c == "3"[c] || c == "5"[c] || c == "7"[c] || c == "B"[c] || c == "D"[c] { // cannot convert value of type 'Character' to expected argument type 'String.Index'
if c == "2"[c] || c == "3"[c] || c == "5"[c] || c == "7"[c] || c == "B"[c] || c == "D"[c] { // cannot convert value of type 'Character' to expected argument type 'String.Index'
if c == "2"[c] || c == "3"[c] || c == "5"[c] || c == "7"[c] || c == "B"[c] || c == "D"[c] { // cannot convert value of type 'Character' to expected argument type 'String.Index'
if c == "2"[c] || c == "3"[c] || c == "5"[c] || c == "7"[c] || c == "B"[c] || c == "D"[c] { // cannot convert value of type 'Character' to expected argument type 'String.Index'
if c == "2"[c] || c == "3"[c] || c == "5"[c] || c == "7"[c] || c == "B"[c] || c == "D"[c] { // cannot convert value of type 'Character' to expected argument type 'String.Index'
if c == "2"[c] || c == "3"[c] || c == "5"[c] || c == "7"[c] || c == "B"[c] || c == "D"[c] { // cannot convert value of type 'Character' to expected argument type 'String.Index'

func hexKey(num: String) -> Int {
    var count = 0
    for digit in num.unicodeScalars {
        if digit.value >= 2 && digit.value <= 9 {
            if digit.value == 2 || digit.value == 3 || digit.value == 5 || digit.value == 7 || digit.value == 11 || digit.value == 13 {
                count += 1
            }
        } else if digit.value >= 10 && digit.value <= 15 {
            if digit.value == 10 || digit.value == 12 || digit.value == 14 || digit.value == 15 {
                count += 1
            }
        }
    }
    return count
}
```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 count = 0
    for digit in num.unicodeScalars {
        if digit.value >= 2 && digit.value <= 9 {
            if digit.value == 2 || digit.value == 3 || digit.value == 5 || digit.value == 7 || digit.value == 11 || digit.value == 13 {
                count += 1
            }
        } else if digit.value >= 10 && digit.value <= 15 {
            if digit.value == 10 || digit.value == 12 || digit.value == 14 || digit.value == 15 {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func hexKey(num: String) -> Int {
    var count = 0
    for digit in num.unicodeScalars {
        if digit.value >= 2 && digit.value <= 9 {
            if digit.value == 2 || digit.value == 3 || digit.value == 5 || digit.value == 7 {
                count += 1
            }
        } else if digit.value >= 10 && digit.value <= 15 {
            if digit.value == 11 || digit.value == 13 {
                count += 1
            }
        }
    }
    return count
}
```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 count = 0
    for digit in num.unicodeScalars {
        if digit.value >= 2 && digit.value <= 9 {
            if digit.value == 2 || digit.value == 3 || digit.value == 5 || digit.value == 7 {
                count += 1
            }
        } else if digit.value >= 10 && digit.value <= 15 {
            if digit.value == 11 || digit.value == 13 {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var remainder = 0
    var quotient = 0
    
    // Convert the decimal number to binary
    while decimal > 0 {
        quotient = decimal / 2
        remainder = decimal % 2
        
        if remainder == 1 {
            binary = "1" + binary
        } else {
            binary = "0" + binary
        }
        
        decimal = quotient
    }
    
    // Add the extra characters
    binary = "db" + binary + "db"
    
    return binary
}
```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 remainder = 0
    var quotient = 0
    
    // Convert the decimal number to binary
    while decimal > 0 {
        quotient = decimal / 2
        remainder = decimal % 2
        
        if remainder == 1 {
            binary = "1" + binary
        } else {
            binary = "0" + binary
        }
        
        decimal = quotient
    }
    
    // Add the extra characters
    binary = "db" + binary + "db"
    
    return binary
}
```
decimal = quotient // cannot assign to value: 'decimal' is a 'let' constant

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var remainder = decimal
    while remainder > 0 {
        let remainder = remainder % 2
        binary = String(remainder) + binary
        remainder = Int(remainder)
    }
    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 remainder = decimal
    while remainder > 0 {
        let remainder = remainder % 2
        binary = String(remainder) + binary
        remainder = Int(remainder)
    }
    return "db" + binary + "db"
}
```
remainder = Int(remainder) // cannot assign to value: 'remainder' is a 'let' constant

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var remainder = decimal
    while remainder > 0 {
        let remainder = decimal % 2
        binary = String(remainder) + binary
        decimal = 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 remainder = decimal
    while remainder > 0 {
        let remainder = decimal % 2
        binary = String(remainder) + binary
        decimal = decimal / 2
    }
    return "db" + binary + "db"
}
```
decimal = decimal / 2 // cannot assign to value: 'decimal' is a 'let' constant

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var remainder = decimal
    var power = 1
    while remainder > 0 {
        let remainder = remainder % 2
        binary.insert(String(remainder), at: 0)
        remainder = Int(remainder)
        power = power * 10
        remainder = Int(remainder)
    }
    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 remainder = decimal
    var power = 1
    while remainder > 0 {
        let remainder = remainder % 2
        binary.insert(String(remainder), at: 0)
        remainder = Int(remainder)
        power = power * 10
        remainder = Int(remainder)
    }
    return "db\(binary)db"
}
```
binary.insert(String(remainder), at: 0) // no exact matches in call to instance method 'insert'
remainder = Int(remainder) // cannot assign to value: 'remainder' is a 'let' constant
remainder = Int(remainder) // cannot assign to value: 'remainder' is a 'let' constant

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var remainder = decimal
    while remainder > 0 {
        let remainder = remainder % 2
        binary = String(remainder) + binary
        remainder = Int(remainder)
    }
    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 remainder = decimal
    while remainder > 0 {
        let remainder = remainder % 2
        binary = String(remainder) + binary
        remainder = Int(remainder)
    }
    return "db" + binary + "db"
}
```
remainder = Int(remainder) // cannot assign to value: 'remainder' is a 'let' constant

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var remainder = decimal
    while remainder > 0 {
        let remainder = remainder % 2
        binary.append(String(remainder))
        remainder = Int(remainder)
    }
    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 remainder = decimal
    while remainder > 0 {
        let remainder = remainder % 2
        binary.append(String(remainder))
        remainder = Int(remainder)
    }
    return "db" + binary + "db"
}
```
remainder = Int(remainder) // cannot assign to value: 'remainder' is a 'let' constant

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var remainder = 0
    var base = 2
    var decimal = decimal
    
    while decimal > 0 {
        remainder = decimal % base
        binary = String(format: "%c", remainder) + binary
        decimal = decimal / base
    }
    
    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 remainder = 0
    var base = 2
    var decimal = decimal
    
    while decimal > 0 {
        remainder = decimal % base
        binary = String(format: "%c", remainder) + binary
        decimal = decimal / base
    }
    
    return "db" + binary + "db"
}
```
var base = 2 // variable 'base' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var remainder = decimal
    while remainder > 0 {
        let remainder = decimal % 2
        binary = String(remainder) + binary
        decimal = 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 remainder = decimal
    while remainder > 0 {
        let remainder = decimal % 2
        binary = String(remainder) + binary
        decimal = decimal / 2
    }
    return "db" + binary + "db"
}
```
decimal = decimal / 2 // cannot assign to value: 'decimal' is a 'let' constant

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var remainder = decimal
    while remainder > 0 {
        let remainder = remainder % 2
        binary = String(remainder) + binary
        remainder = Int(remainder)
    }
    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 remainder = decimal
    while remainder > 0 {
        let remainder = remainder % 2
        binary = String(remainder) + binary
        remainder = Int(remainder)
    }
    return "db" + binary + "db"
}
```
remainder = Int(remainder) // cannot assign to value: 'remainder' is a 'let' constant

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    
    while decimal > 0 {
        let remainder = decimal % 2
        binary.insert(String(remainder), at: 0)
        decimal = 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 = ""
    
    while decimal > 0 {
        let remainder = decimal % 2
        binary.insert(String(remainder), at: 0)
        decimal = decimal / 2
    }
    
    return "db\(binary)db"
}
```
binary.insert(String(remainder), at: 0) // no exact matches in call to instance method 'insert'
decimal = decimal / 2 // cannot assign to value: 'decimal' is a 'let' constant

func isHappy(s: String) -> Bool {
    // TODO: Implement isHappy
}
```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 {
    // TODO: Implement isHappy
}
```
} // missing return in global function expected to return 'Bool'

func isHappy(s: String) -> Bool {
    var result = s
    var isHappy = false
    var i = 0
    while i < s.length {
        var c = s[i]
        var j = i + 1
        while j < s.length {
            var c2 = s[j]
            if c == c2 {
                isHappy = true
                break
            }
            j += 1
        }
        if isHappy {
            break
        }
        i += 1
    }
    return isHappy
}
```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 {
    var result = s
    var isHappy = false
    var i = 0
    while i < s.length {
        var c = s[i]
        var j = i + 1
        while j < s.length {
            var c2 = s[j]
            if c == c2 {
                isHappy = true
                break
            }
            j += 1
        }
        if isHappy {
            break
        }
        i += 1
    }
    return isHappy
}
```
while i < s.length { // value of type 'String' has no member 'length'
var c = s[i] // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
while j < s.length { // value of type 'String' has no member 'length'
var c2 = s[j] // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func isHappy(s: String) -> Bool {
    let s = s.unicodeScalars.map { String($0).unicodeScalars }
    let s = s.reduce(into: []) { $0.append(contentsOf: $1) }
    let s = s.reduce(into: []) { $0.append(contentsOf: $1) }
    return s.count >= 3 && s.count % 3 == 0
}
```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 {
    let s = s.unicodeScalars.map { String($0).unicodeScalars }
    let s = s.reduce(into: []) { $0.append(contentsOf: $1) }
    let s = s.reduce(into: []) { $0.append(contentsOf: $1) }
    return s.count >= 3 && s.count % 3 == 0
}
```
let s = s.reduce(into: []) { $0.append(contentsOf: $1) } // invalid redeclaration of 's'

func isHappy(s: String) -> Bool {
    // write your code in Swift 4.0
    return false
}
```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 {
    // write your code in Swift 4.0
    return false
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    let s = s.characters.map { Int($0) }
    let s = s.reduce(0, combine: { $0 + $1 * $1 })
    return s == 1
}
```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 {
    let s = s.characters.map { Int($0) }
    let s = s.reduce(0, combine: { $0 + $1 * $1 })
    return s == 1
}
```
let s = s.characters.map { Int($0) } // no exact matches in call to initializer

func isHappy(s: String) -> Bool {
    return s.characters.reduce("", combine: { (partial, c) -> String in
        return partial + String(c)
    }) == "a"
}
```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 {
    return s.characters.reduce("", combine: { (partial, c) -> String in
        return partial + String(c)
    }) == "a"
}
```
return s.characters.reduce("", combine: { (partial, c) -> String in // extraneous argument label 'combine:' in call

func isHappy(s: String) -> Bool {
    // TODO: Implement isHappy
    return false
}
```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 {
    // TODO: Implement isHappy
    return false
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    // TODO: implement isHappy
    return false
}
```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 {
    // TODO: implement isHappy
    return false
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    // TODO: Implement isHappy
    return false
}
```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 {
    // TODO: Implement isHappy
    return false
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    return s.count >= 3 && s.characters.reduce("", combine: { (partial, character) -> String in
        return partial + character
    }) == s.characters.reduce("", combine: { (partial, character) -> String in
        return partial + character
    })
}
```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 {
    return s.count >= 3 && s.characters.reduce("", combine: { (partial, character) -> String in
        return partial + character
    }) == s.characters.reduce("", combine: { (partial, character) -> String in
        return partial + character
    })
}
```

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for gpa in grades {
        if gpa >= 4.0 {
            letterGrades.append("A+")
        } else if gpa >= 3.7 {
            letterGrades.append("A")
        } else if gpa >= 3.3 {
            letterGrades.append("A-")
        } else if gpa >= 3.0 {
            letterGrades.append("B+")
        } else if gpa >= 2.7 {
            letterGrades.append("B")
        } else if gpa >= 2.3 {
            letterGrades.append("B-")
        } else if gpa >= 2.0 {
            letterGrades.append("C+")
        } else if gpa >= 1.7 {
            letterGrades.append("C")
        } else if gpa >= 1.3 {
            letterGrades.append("C-")
        } else if gpa >= 1.0 {
            letterGrades.append("D+")
        } else if gpa >= 0.7 {
            letterGrades.append("D")
        } else {
            letterGrades.append("D-")
        }
    }
    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 gpa in grades {
        if gpa >= 4.0 {
            letterGrades.append("A+")
        } else if gpa >= 3.7 {
            letterGrades.append("A")
        } else if gpa >= 3.3 {
            letterGrades.append("A-")
        } else if gpa >= 3.0 {
            letterGrades.append("B+")
        } else if gpa >= 2.7 {
            letterGrades.append("B")
        } else if gpa >= 2.3 {
            letterGrades.append("B-")
        } else if gpa >= 2.0 {
            letterGrades.append("C+")
        } else if gpa >= 1.7 {
            letterGrades.append("C")
        } else if gpa >= 1.3 {
            letterGrades.append("C-")
        } else if gpa >= 1.0 {
            letterGrades.append("D+")
        } else if gpa >= 0.7 {
            letterGrades.append("D")
        } else {
            letterGrades.append("D-")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for gpa in grades {
        if gpa >= 4.0 {
            letterGrades.append("A+")
        } else if gpa >= 3.7 {
            letterGrades.append("A")
        } else if gpa >= 3.3 {
            letterGrades.append("A-")
        } else if gpa >= 3.0 {
            letterGrades.append("B+")
        } else if gpa >= 2.7 {
            letterGrades.append("B")
        } else if gpa >= 2.3 {
            letterGrades.append("B-")
        } else if gpa >= 2.0 {
            letterGrades.append("C+")
        } else if gpa >= 1.7 {
            letterGrades.append("C")
        } else if gpa >= 1.3 {
            letterGrades.append("C-")
        } else if gpa >= 1.0 {
            letterGrades.append("D+")
        } else if gpa >= 0.7 {
            letterGrades.append("D")
        } else if gpa >= 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 gpa in grades {
        if gpa >= 4.0 {
            letterGrades.append("A+")
        } else if gpa >= 3.7 {
            letterGrades.append("A")
        } else if gpa >= 3.3 {
            letterGrades.append("A-")
        } else if gpa >= 3.0 {
            letterGrades.append("B+")
        } else if gpa >= 2.7 {
            letterGrades.append("B")
        } else if gpa >= 2.3 {
            letterGrades.append("B-")
        } else if gpa >= 2.0 {
            letterGrades.append("C+")
        } else if gpa >= 1.7 {
            letterGrades.append("C")
        } else if gpa >= 1.3 {
            letterGrades.append("C-")
        } else if gpa >= 1.0 {
            letterGrades.append("D+")
        } else if gpa >= 0.7 {
            letterGrades.append("D")
        } else if gpa >= 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 {
            letterGrades.append("D-")
        }
    }
    
    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 {
            letterGrades.append("D-")
        }
    }
    
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for gpa in grades {
        if gpa >= 4.0 {
            letterGrades.append("A+")
        } else if gpa >= 3.7 {
            letterGrades.append("A")
        } else if gpa >= 3.3 {
            letterGrades.append("A-")
        } else if gpa >= 3.0 {
            letterGrades.append("B+")
        } else if gpa >= 2.7 {
            letterGrades.append("B")
        } else if gpa >= 2.3 {
            letterGrades.append("B-")
        } else if gpa >= 2.0 {
            letterGrades.append("C+")
        } else if gpa >= 1.7 {
            letterGrades.append("C")
        } else if gpa >= 1.3 {
            letterGrades.append("C-")
        } else if gpa >= 1.0 {
            letterGrades.append("D+")
        } else if gpa >= 0.7 {
            letterGrades.append("D")
        } else {
            letterGrades.append("D-")
        }
    }
    return letterGrades
}

func capitalizeFirstLetter(names: [String]) -> [String] {
    var capitalizedNames = [String]()
    for name in names {
        capitalizedNames.append(String(name.characters.dropFirst()).capitalized)
    }
    return capitalizedNames
}
```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 gpa in grades {
        if gpa >= 4.0 {
            letterGrades.append("A+")
        } else if gpa >= 3.7 {
            letterGrades.append("A")
        } else if gpa >= 3.3 {
            letterGrades.append("A-")
        } else if gpa >= 3.0 {
            letterGrades.append("B+")
        } else if gpa >= 2.7 {
            letterGrades.append("B")
        } else if gpa >= 2.3 {
            letterGrades.append("B-")
        } else if gpa >= 2.0 {
            letterGrades.append("C+")
        } else if gpa >= 1.7 {
            letterGrades.append("C")
        } else if gpa >= 1.3 {
            letterGrades.append("C-")
        } else if gpa >= 1.0 {
            letterGrades.append("D+")
        } else if gpa >= 0.7 {
            letterGrades.append("D")
        } else {
            letterGrades.append("D-")
        }
    }
    return letterGrades
}

// Write a function that takes an array of strings and returns an array of 
// strings with the first character of each string capitalized.
// Example:
// capitalizeFirstLetter(names: ["joe", "jim", "joe"]) == ["Joe", "Jim", "Joe"]
func capitalizeFirstLetter(names: [String]) -> [String] {
    var capitalizedNames = [String]()
    for name in names {
        capitalizedNames.append(String(name.characters.dropFirst()).capitalized)
    }
    return capitalizedNames
}

// Write a function that takes an array of strings and returns an array of 
// strings with the first character of each string capitalized.
// Example:
// capitalizeFirstLetter(names: ["joe", "jim", "joe"]) == ["Joe", "Jim", "Joe"]
func capitalizeFirstLetter(names: [String]) -> [String] {
    var capitalizedNames = [String]()
    for name in names {
        capitalizedNames.append(String(name.characters.dropFirst()).capitalized)
    }
    return capitalizedNames
}

// Write a function that takes an array of strings and returns an array of 
// strings with the first character of each string capitalized.
// Example:
// capitalizeFirstLetter(names: ["joe", "jim", "joe"]) == ["Joe", "Jim", "Joe"]
func capitalizeFirstLetter(names: [String]) -> [String] {
    var capitalizedNames = [String]()
    for name in names {
        capitalizedNames.append(String(name.characters.dropFirst()).capitalized)
    }
    return capitalizedNames
}

// Write a function that takes an array of strings and returns an array of 
// strings with the first character of each string capitalized.
// Example:
// capitalizeFirstLetter(names: ["joe", "jim", "joe"]) == ["Joe", "Jim", "Joe"]
func capitalizeFirstLetter(names: [String]) -> [String] {
    var capitalizedNames = [String]()
    for name in names {
        capitalizedNames.append(String(name.characters.dropFirst()).capitalized)
    }
    return capitalizedNames
}

// Write a function that takes an array of strings and returns an array of 
// strings with the first character of each string capitalized.
// Example:
// capitalizeFirstLetter(names: ["joe", "jim", "joe"]) == ["Joe", "Jim", "Joe"]
func capitalizeFirstLetter(names: [String]) -> [String] {
    var capitalizedNames = [String]()
    for name in names {
        capitalizedNames.append(String(name.characters.dropFirst()).capitalized)
    }
    return capitalizedNames
}

// Write a function that takes an array of strings and returns an array of 
// strings with the first character of each string capitalized.
// Example:
// capitalizeFirstLetter(names: ["joe", "jim", "joe"]) == ["Joe", "Jim",
capitalizedNames.append(String(name.characters.dropFirst()).capitalized) // 'characters' is unavailable: Please use String directly

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 {
            letterGrades.append("D-")
        }
    }
    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 {
            letterGrades.append("D-")
        }
    }
    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 {
            letterGrades.append("D-")
        }
    }
    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 {
            letterGrades.append("D-")
        }
    }
    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 {
            letterGrades.append("D-")
        }
    }
    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 {
            letterGrades.append("D-")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for gpa in grades {
        if gpa >= 4.0 {
            letterGrades.append("A+")
        } else if gpa >= 3.7 {
            letterGrades.append("A")
        } else if gpa >= 3.3 {
            letterGrades.append("A-")
        } else if gpa >= 3.0 {
            letterGrades.append("B+")
        } else if gpa >= 2.7 {
            letterGrades.append("B")
        } else if gpa >= 2.3 {
            letterGrades.append("B-")
        } else if gpa >= 2.0 {
            letterGrades.append("C+")
        } else if gpa >= 1.7 {
            letterGrades.append("C")
        } else if gpa >= 1.3 {
            letterGrades.append("C-")
        } else if gpa >= 1.0 {
            letterGrades.append("D+")
        } else if gpa >= 0.7 {
            letterGrades.append("D")
        } else {
            letterGrades.append("D-")
        }
    }
    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 gpa in grades {
        if gpa >= 4.0 {
            letterGrades.append("A+")
        } else if gpa >= 3.7 {
            letterGrades.append("A")
        } else if gpa >= 3.3 {
            letterGrades.append("A-")
        } else if gpa >= 3.0 {
            letterGrades.append("B+")
        } else if gpa >= 2.7 {
            letterGrades.append("B")
        } else if gpa >= 2.3 {
            letterGrades.append("B-")
        } else if gpa >= 2.0 {
            letterGrades.append("C+")
        } else if gpa >= 1.7 {
            letterGrades.append("C")
        } else if gpa >= 1.3 {
            letterGrades.append("C-")
        } else if gpa >= 1.0 {
            letterGrades.append("D+")
        } else if gpa >= 0.7 {
            letterGrades.append("D")
        } else {
            letterGrades.append("D-")
        }
    }
    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 {
            letterGrades.append("D-")
        }
    }
    
    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 {
            letterGrades.append("D-")
        }
    }
    
    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 {
            letterGrades.append("D-")
        }
    }
    
    return letterGrades
}

func capitalizeFirstLetter(names: [String]) -> [String] {
    var capitalizedNames = [String]()
    
    for name in names {
        capitalizedNames.append(String(name.characters.dropFirst()).uppercaseString)
    }
    
    return capitalizedNames
}

func capitalizeFirstLetterAndLowercaseRest(names: [String]) -> [String] {
    var capitalizedNames = [String]()
    
    for name in names {
        capitalizedNames.append(String(name.characters.dropFirst()).uppercaseString + String(name.characters.dropLast()))
    }
    
    return capitalizedNames
}
```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 {
            letterGrades.append("D-")
        }
    }
    
    return letterGrades
}

// Write a function that takes in an array of strings and returns an array of 
// strings with the first letter of each string capitalized.
// Example:
// capitalizeFirstLetter(names: ["joe", "jane", "jim"]) == ["Joe", "Jane", "Jim"]
func capitalizeFirstLetter(names: [String]) -> [String] {
    var capitalizedNames = [String]()
    
    for name in names {
        capitalizedNames.append(String(name.characters.dropFirst()).uppercaseString)
    }
    
    return capitalizedNames
}

// Write a function that takes in an array of strings and returns an array of 
// strings with the first letter of each string capitalized and the rest of the 
// string lowercased.
// Example:
// capitalizeFirstLetterAndLowercaseRest(names: ["joe", "jane", "jim"]) == ["Joe", "jane", "jim"]
func capitalizeFirstLetterAndLowercaseRest(names: [String]) -> [String] {
    var capitalizedNames = [String]()
    
    for name in names {
        capitalizedNames.append(String(name.characters.dropFirst()).uppercaseString + String(name.characters.dropLast()))
    }
    
    return capitalizedNames
}

// Write a function that takes in an array of strings and returns an array of 
// strings with the first letter of each string capitalized and the rest of the 
// string lowercased.
// Example:
// capitalizeFirstLetterAndLowercaseRest(names: ["joe", "jane", "jim"]) == ["Joe", "jane", "jim"]
func capitalizeFirstLetterAndLowercaseRest(names: [String]) -> [String] {
    var capitalizedNames = [String]()
    
    for name in names {
        capitalizedNames.append(String(name.characters.dropFirst()).uppercaseString + String(name.characters.dropLast()))
    }
    
    return capitalizedNames
}

// Write a function that takes in an array of strings and returns an array of 
// strings with the first letter of each string capitalized and the rest of the 
// string lowercased.
// Example:
// capitalizeFirstLetterAndLowercaseRest(names: ["joe", "jane", "jim"]) == ["Joe", "jane", "jim"]
func capitalizeFirstLetterAndLowercaseRest(names: [String]) -> [String] {
    var capitalizedNames = [String]()
    
    for name in names {
        capitalizedNames.append(String(name.characters.dropFirst()).uppercaseString + String(name.characters.dropLast()))
    }
    
    return capitalizedNames
}

// Write a function that takes in an array of strings and returns an array of 
// strings with the first letter of each string capitalized and the rest of the 
// string lowercased.
// Example:
// capitalizeFirstLetterAndLowercaseRest(names: ["joe", "jane", "jim"]) == ["Joe", "jane", "jim
capitalizedNames.append(String(name.characters.dropFirst()).uppercaseString) // value of type 'String' has no member 'uppercaseString'
capitalizedNames.append(String(name.characters.dropFirst()).uppercaseString + String(name.characters.dropLast())) // value of type 'String' has no member 'uppercaseString'

func primeLength(string: String) -> Bool {
    // TODO: 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 {
    // TODO: Your code here
}
```
} // missing return in global function expected to return 'Bool'

func primeLength(string: String) -> Bool {
    // TODO: 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 {
    // TODO: Your code here
}
```
} // missing return in global function expected to return 'Bool'

func primeLength(string: String) -> Bool {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Bool'

func primeLength(string: String) -> Bool {
    // TODO: 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 {
    // TODO: Your code here
}
```
} // missing return in global function expected to return 'Bool'

func primeLength(string: String) -> Bool {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Bool'

func primeLength(string: String) -> Bool {
    // TODO: 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 {
    // TODO: Your code here
}
```
} // missing return in global function expected to return 'Bool'

func primeLength(string: String) -> Bool {
    // TODO: 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 {
    // TODO: Your code here
}
```
} // missing return in global function expected to return 'Bool'

func primeLength(string: String) -> Bool {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Bool'

func primeLength(string: String) -> Bool {
    // TODO: 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 {
    // TODO: Your code here
}
```
} // missing return in global function expected to return 'Bool'

func primeLength(string: String) -> Bool {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Bool'

func startsOneEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsTwoEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsThreeEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsFourEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsFiveEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsSixEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsSevenEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsEightEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsNineEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsZeroEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsEnds(n: Int) -> Int {
    return startsOneEnds(n) + startsTwoEnds(n) + startsThreeEnds(n) +
        startsFourEnds(n) + startsFiveEnds(n) + startsSixEnds(n) +
        startsSevenEnds(n) + startsEightEnds(n) + startsNineEnds(n)
}

func startsOrEnds(n: Int) -> Int {
    return startsZeroEnds(n) + startsOneEnds(n) + startsTwoEnds(n) +
        startsThreeEnds(n) + startsFourEnds(n) + startsFiveEnds(n) +
        startsSixEnds(n) + startsSevenEnds(n) + startsEightEnds(n) +
        startsNineEnds(n)
}

func startsOrEndsPlus(n: Int) -> Int {
    return startsOrEnds(n) + startsOneEnds(n)
}

func startsOrEndsMinus(n: Int) -> Int {
    return startsOrEnds(n) + startsZeroEnds(n)
}
```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 {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 2.
func startsTwoEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 3.
func startsThreeEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 4.
func startsFourEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 5.
func startsFiveEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 6.
func startsSixEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 7.
func startsSevenEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 8.
func startsEightEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 9.
func startsNineEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0.
func startsZeroEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1, 2, 3, 4, 5, 6, 7, 8, or 9.
func startsEnds(n: Int) -> Int {
    return startsOneEnds(n) + startsTwoEnds(n) + startsThreeEnds(n) +
        startsFourEnds(n) + startsFiveEnds(n) + startsSixEnds(n) +
        startsSevenEnds(n) + startsEightEnds(n) + startsNineEnds(n)
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9.
func startsOrEnds(n: Int) -> Int {
    return startsZeroEnds(n) + startsOneEnds(n) + startsTwoEnds(n) +
        startsThreeEnds(n) + startsFourEnds(n) + startsFiveEnds(n) +
        startsSixEnds(n) + startsSevenEnds(n) + startsEightEnds(n) +
        startsNineEnds(n)
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, or 10.
func startsOrEndsPlus(n: Int) -> Int {
    return startsOrEnds(n) + startsOneEnds(n)
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, or 10.
func startsOrEndsMinus(n: Int) -> Int {
    return startsOrEnds(n) + startsZeroEnds(n)
}

// Given a positive integer n, return the count of the
return startsOneEnds(n) + startsTwoEnds(n) + startsThreeEnds(n) + // missing argument label 'n:' in call
return startsOneEnds(n) + startsTwoEnds(n) + startsThreeEnds(n) + // missing argument label 'n:' in call
return startsOneEnds(n) + startsTwoEnds(n) + startsThreeEnds(n) + // missing argument label 'n:' in call
startsFourEnds(n) + startsFiveEnds(n) + startsSixEnds(n) + // missing argument label 'n:' in call
startsFourEnds(n) + startsFiveEnds(n) + startsSixEnds(n) + // missing argument label 'n:' in call
startsFourEnds(n) + startsFiveEnds(n) + startsSixEnds(n) + // missing argument label 'n:' in call
startsSevenEnds(n) + startsEightEnds(n) + startsNineEnds(n) // missing argument label 'n:' in call
startsSevenEnds(n) + startsEightEnds(n) + startsNineEnds(n) // missing argument label 'n:' in call
startsSevenEnds(n) + startsEightEnds(n) + startsNineEnds(n) // missing argument label 'n:' in call
return startsZeroEnds(n) + startsOneEnds(n) + startsTwoEnds(n) + // missing argument label 'n:' in call
return startsZeroEnds(n) + startsOneEnds(n) + startsTwoEnds(n) + // missing argument label 'n:' in call
return startsZeroEnds(n) + startsOneEnds(n) + startsTwoEnds(n) + // missing argument label 'n:' in call
startsThreeEnds(n) + startsFourEnds(n) + startsFiveEnds(n) + // missing argument label 'n:' in call
startsThreeEnds(n) + startsFourEnds(n) + startsFiveEnds(n) + // missing argument label 'n:' in call
startsThreeEnds(n) + startsFourEnds(n) + startsFiveEnds(n) + // missing argument label 'n:' in call
startsSixEnds(n) + startsSevenEnds(n) + startsEightEnds(n) + // missing argument label 'n:' in call
startsSixEnds(n) + startsSevenEnds(n) + startsEightEnds(n) + // missing argument label 'n:' in call
startsSixEnds(n) + startsSevenEnds(n) + startsEightEnds(n) + // missing argument label 'n:' in call
startsNineEnds(n) // missing argument label 'n:' in call
return startsOrEnds(n) + startsOneEnds(n) // missing argument label 'n:' in call
return startsOrEnds(n) + startsOneEnds(n) // missing argument label 'n:' in call
return startsOrEnds(n) + startsZeroEnds(n) // missing argument label 'n:' in call
return startsOrEnds(n) + startsZeroEnds(n) // missing argument label 'n:' in call

func startsOneEnds(n: Int) -> Int {
    // The number of n-digit numbers that start with 1 is n-1.
    // The number of n-digit numbers that end with 1 is n-1.
    return n - 1
}
```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 {
    // The number of n-digit numbers that start with 1 is n-1.
    // The number of n-digit numbers that end with 1 is n-1.
    return n - 1
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}
```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 {
    return n * (n - 1) / 2
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsTwoEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsThreeEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsFourEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsFiveEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsSixEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsSevenEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsEightEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsNineEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

func startsZeroEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}
```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 {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 2.
func startsTwoEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 3.
func startsThreeEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 4.
func startsFourEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 5.
func startsFiveEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 6.
func startsSixEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 7.
func startsSevenEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 8.
func startsEightEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 9.
func startsNineEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0.
func startsZeroEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0.
func startsZeroEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0.
func startsZeroEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0.
func startsZeroEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0.
func startsZeroEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0.
func startsZeroEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0.
func startsZeroEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0.
func startsZeroEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0.
func startsZeroEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    // The number of n-digit numbers that start with 1 is n-1.
    // The number of n-digit numbers that end with 1 is n-1.
    return n - 1
}
```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 {
    // The number of n-digit numbers that start with 1 is n-1.
    // The number of n-digit numbers that end with 1 is n-1.
    return n - 1
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    // The number of n-digit numbers that start with 1 is n-1.
    // The number of n-digit numbers that end with 1 is n-1.
    // The number of n-digit numbers that start or end with 1 is 2n-2.
    return 2 * n - 2
}
```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 {
    // The number of n-digit numbers that start with 1 is n-1.
    // The number of n-digit numbers that end with 1 is n-1.
    // The number of n-digit numbers that start or end with 1 is 2n-2.
    return 2 * n - 2
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += (n - i) * i
    }
    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 += (n - i) * i
    }
    return count
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    // The number of n-digit numbers that start with 1 is n - 1.
    // The number of n-digit numbers that end with 1 is n - 1.
    // The number of n-digit numbers that start or end with 1 is 2 * (n - 1).
    return 2 * (n - 1)
}
```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 {
    // The number of n-digit numbers that start with 1 is n - 1.
    // The number of n-digit numbers that end with 1 is n - 1.
    // The number of n-digit numbers that start or end with 1 is 2 * (n - 1).
    return 2 * (n - 1)
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    return n * (n - 1) / 2
}
```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 {
    return n * (n - 1) / 2
}

// 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 {
    return n * (n - 1) / 2
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    return pow(10, n - 1) + pow(10, n - 1) * 9
}

func startsTwoEnds(n: Int) -> Int {
    return pow(10, n - 1) * 9 + pow(10, n - 1)
}

func startsThreeEnds(n: Int) -> Int {
    return pow(10, n - 1) * 8 + pow(10, n - 1) * 9
}

func startsFourEnds(n: Int) -> Int {
    return pow(10, n - 1) * 7 + pow(10, n - 1) * 8
}

func startsFiveEnds(n: Int) -> Int {
    return pow(10, n - 1) * 6 + pow(10, n - 1) * 7
}

func startsSixEnds(n: Int) -> Int {
    return pow(10, n - 1) * 5 + pow(10, n - 1) * 6
}

func startsSevenEnds(n: Int) -> Int {
    return pow(10, n - 1) * 4 + pow(10, n - 1) * 5
}

func startsEightEnds(n: Int) -> Int {
    return pow(10, n - 1) * 3 + pow(10, n - 1) * 4
}

func startsNineEnds(n: Int) -> Int {
    return pow(10, n - 1) * 2 + pow(10, n - 1) * 3
}

func startsZeroEnds(n: Int) -> Int {
    return pow(10, n - 1) * 1 + pow(10, n - 1) * 2
}
```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 {
    return pow(10, n - 1) + pow(10, n - 1) * 9
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 2.
func startsTwoEnds(n: Int) -> Int {
    return pow(10, n - 1) * 9 + pow(10, n - 1)
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 3.
func startsThreeEnds(n: Int) -> Int {
    return pow(10, n - 1) * 8 + pow(10, n - 1) * 9
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 4.
func startsFourEnds(n: Int) -> Int {
    return pow(10, n - 1) * 7 + pow(10, n - 1) * 8
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 5.
func startsFiveEnds(n: Int) -> Int {
    return pow(10, n - 1) * 6 + pow(10, n - 1) * 7
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 6.
func startsSixEnds(n: Int) -> Int {
    return pow(10, n - 1) * 5 + pow(10, n - 1) * 6
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 7.
func startsSevenEnds(n: Int) -> Int {
    return pow(10, n - 1) * 4 + pow(10, n - 1) * 5
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 8.
func startsEightEnds(n: Int) -> Int {
    return pow(10, n - 1) * 3 + pow(10, n - 1) * 4
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 9.
func startsNineEnds(n: Int) -> Int {
    return pow(10, n - 1) * 2 + pow(10, n - 1) * 3
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 0.
func startsZeroEnds(n: Int) -> Int {
    return pow(10, n - 1) * 1 + pow(10, n - 1) * 2
}

// 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 {
    return pow(10, n - 1) + pow(10, n - 1) * 9
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 2.
func startsTwoEnds(n: Int) -> Int {
    return pow(10, n - 1) * 9 + pow(10, n - 1)
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 3.
func startsThreeEnds(n: Int) -> Int {
    return pow(10, n - 1) * 8 + pow(10, n - 1) * 9
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 4.
func startsFourEnds(n: Int) -> Int {
    return pow(10, n - 1) * 7 + pow(10, n - 1) * 8
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 5.
func startsFiveEnds(n: Int) -> Int {
    return pow(10, n - 1) * 6 + pow(10, n - 1) * 7
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start
return pow(10, n - 1) + pow(10, n - 1) * 9 // cannot convert return expression of type 'Decimal' to return type 'Int'
return pow(10, n - 1) * 9 + pow(10, n - 1) // cannot convert return expression of type 'Decimal' to return type 'Int'
return pow(10, n - 1) * 8 + pow(10, n - 1) * 9 // cannot convert return expression of type 'Decimal' to return type 'Int'
return pow(10, n - 1) * 7 + pow(10, n - 1) * 8 // cannot convert return expression of type 'Decimal' to return type 'Int'
return pow(10, n - 1) * 6 + pow(10, n - 1) * 7 // cannot convert return expression of type 'Decimal' to return type 'Int'
return pow(10, n - 1) * 5 + pow(10, n - 1) * 6 // cannot convert return expression of type 'Decimal' to return type 'Int'
return pow(10, n - 1) * 4 + pow(10, n - 1) * 5 // cannot convert return expression of type 'Decimal' to return type 'Int'
return pow(10, n - 1) * 3 + pow(10, n - 1) * 4 // cannot convert return expression of type 'Decimal' to return type 'Int'
return pow(10, n - 1) * 2 + pow(10, n - 1) * 3 // cannot convert return expression of type 'Decimal' to return type 'Int'
return pow(10, n - 1) * 1 + pow(10, n - 1) * 2 // cannot convert return expression of type 'Decimal' to return type 'Int'

func solve(N: Int) -> String {
    // Write your code here
    var result = ""
    var temp = N
    while temp > 0 {
        result = String(format: "%d%@", temp % 2, result)
        temp = temp / 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 {
    // Write your code here
    var result = ""
    var temp = N
    while temp > 0 {
        result = String(format: "%d%@", temp % 2, result)
        temp = temp / 2
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var binary = ""
    var remainder = N
    var temp = 0
    while remainder > 0 {
        temp = remainder % 2
        binary = String(format: "%d%@", temp, binary)
        remainder = 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
    var temp = 0
    while remainder > 0 {
        temp = remainder % 2
        binary = String(format: "%d%@", temp, binary)
        remainder = remainder / 2
    }
    return binary
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var binary = ""
    var number = N
    while number > 0 {
        binary = String(format: "%d%@", number % 2, 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 {
        binary = String(format: "%d%@", number % 2, binary)
        number = number / 2
    }
    return binary
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    // Write your code in Swift 4.0 below.
    var result = ""
    var n = N
    while n > 0 {
        result = String(n % 2) + result
        n = n / 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 {
    // Write your code in Swift 4.0 below.
    var result = ""
    var n = N
    while n > 0 {
        result = String(n % 2) + result
        n = n / 2
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var result = ""
    var binary = N.toBinary()
    for i in 0..<binary.count {
        result += String(binary[i])
    }
    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 binary = N.toBinary()
    for i in 0..<binary.count {
        result += String(binary[i])
    }
    return result
}
```
var binary = N.toBinary() // value of type 'Int' has no member 'toBinary'

func solve(N: Int) -> String {
    var result = ""
    var n = N
    while n > 0 {
        result = String(format: "%d%@", n % 2, result)
        n = n / 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 n = N
    while n > 0 {
        result = String(format: "%d%@", n % 2, result)
        n = n / 2
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var binary = ""
    var remainder = N
    while remainder > 0 {
        let digit = remainder % 2
        binary = String(format: "%d%@", digit, binary)
        remainder = 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 {
        let digit = remainder % 2
        binary = String(format: "%d%@", digit, binary)
        remainder = remainder / 2
    }
    return binary
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var result = ""
    var n = N
    while n > 0 {
        result = String(format: "%d%@", n % 2, result)
        n = n / 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 n = N
    while n > 0 {
        result = String(format: "%d%@", n % 2, result)
        n = n / 2
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var binary = ""
    var remainder = N
    while remainder > 0 {
        let remainder = remainder % 2
        binary = String(format: "%d%@", remainder, binary)
        remainder = 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 {
        let remainder = remainder % 2
        binary = String(format: "%d%@", remainder, binary)
        remainder = remainder / 2
    }
    return binary
}
```
remainder = remainder / 2 // cannot assign to value: 'remainder' is a 'let' constant

func solve(N: Int) -> String {
    var result = ""
    var n = N
    while n > 0 {
        result = String(format: "%d%@", n % 2, result)
        n = n / 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 n = N
    while n > 0 {
        result = String(format: "%d%@", n % 2, result)
        n = n / 2
    }
    return result
}
```
 // XCTAssertTrue failed

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerate() {
        if index % 2 == 1 {
            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.enumerate() {
        if index % 2 == 1 {
            sum += value
        }
    }
    return sum
}
```
for (index, value) in lst.enumerate() { // value of type '[Int]' has no member 'enumerate'

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerate() {
        if index % 2 == 1 {
            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.enumerate() {
        if index % 2 == 1 {
            sum += value
        }
    }
    return sum
}
```
for (index, value) in lst.enumerate() { // value of type '[Int]' has no member 'enumerate'

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerate() {
        if index % 2 == 1 {
            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.enumerate() {
        if index % 2 == 1 {
            sum += value
        }
    }
    return sum
}
```
for (index, value) in lst.enumerate() { // value of type '[Int]' has no member 'enumerate'

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerate() {
        if index % 2 == 1 {
            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.enumerate() {
        if index % 2 == 1 {
            sum += value
        }
    }
    return sum
}
```
for (index, value) in lst.enumerate() { // value of type '[Int]' has no member 'enumerate'

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerate() {
        if index % 2 == 1 {
            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.enumerate() {
        if index % 2 == 1 {
            sum += value
        }
    }
    return sum
}
```
for (index, value) in lst.enumerate() { // value of type '[Int]' has no member 'enumerate'

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
}
```
 // 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
}
```
 // 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
}
```
 // 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
}
```
 // 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 antiShuffle(s: String) -> String {
    // TODO: Implement antiShuffle
}
```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 {
    // TODO: Implement antiShuffle
}
```
} // missing return in global function expected to return 'String'

func antiShuffle(s: String) -> String {
    // TODO: Implement antiShuffle
    return s
}
```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 {
    // TODO: Implement antiShuffle
    return s
}
```
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    // TODO:
    return ""
}
```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 {
    // TODO:
    return ""
}
```
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    // TODO: Implement antiShuffle
}
```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 {
    // TODO: Implement antiShuffle
}
```
} // missing return in global function expected to return 'String'

func antiShuffle(s: String) -> String {
    // TODO:
    return ""
}
```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 {
    // TODO:
    return ""
}
```
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    // TODO: Implement antiShuffle
    return s
}
```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 {
    // TODO: Implement antiShuffle
    return s
}
```
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    // Write your code here.
    return s.components(separatedBy: " ").map { $0.sorted().reduce("") { $0 + String($0.utf8.last!) } }.joined(separator: " ")
}
```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 {
    // Write your code here.
    return s.components(separatedBy: " ").map { $0.sorted().reduce("") { $0 + String($0.utf8.last!) } }.joined(separator: " ")
}
```
return s.components(separatedBy: " ").map { $0.sorted().reduce("") { $0 + String($0.utf8.last!) } }.joined(separator: " ") // contextual closure type '(String, String.Element) throws -> String' (aka '(String, Character) throws -> String') expects 2 arguments, but 1 was used in closure body

func antiShuffle(s: String) -> String {
    // TODO: Implement antiShuffle
}
```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 {
    // TODO: Implement antiShuffle
}
```
} // missing return in global function expected to return 'String'

func antiShuffle(s: String) -> String {
    // TODO: Implement antiShuffle
}
```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 {
    // TODO: Implement antiShuffle
}
```
} // missing return in global function expected to return 'String'

func antiShuffle(s: String) -> String {
    // Write your code here.
}
```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 {
    // Write your code here.
}
```
} // missing return in global function expected to return 'String'

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        for (index, element) in row.enumerated() {
            if element == x {
                result.append((index, row.count - index - 1))
            }
        }
    }
    result.sort()
    return result
}
```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 (index, element) in row.enumerated() {
            if element == x {
                result.append((index, row.count - index - 1))
            }
        }
    }
    result.sort()
    return result
}
```
result.sort() // type '(Int, Int)' cannot conform to 'Comparable'

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (row, rowLst) in lst.enumerated() {
        for (col, colLst) in rowLst.enumerated() {
            if colLst == x {
                result.append((row, col))
            }
        }
    }
    result.sort()
    return result
}
```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, rowLst) in lst.enumerated() {
        for (col, colLst) in rowLst.enumerated() {
            if colLst == x {
                result.append((row, col))
            }
        }
    }
    result.sort()
    return result
}
```
result.sort() // type '(Int, Int)' cannot conform to 'Comparable'

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    var rows = [Int]()
    var columns = [Int]()
    
    for row in lst {
        for (index, value) in row.enumerated() {
            if value == x {
                rows.append(index)
                columns.append(row.count - 1 - index)
            }
        }
    }
    
    rows.sort()
    columns.sort()
    
    for i in 0..<rows.count {
        result.append((rows[i], columns[i]))
    }
    
    return result
}
```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)]()
    var rows = [Int]()
    var columns = [Int]()
    
    for row in lst {
        for (index, value) in row.enumerated() {
            if value == x {
                rows.append(index)
                columns.append(row.count - 1 - index)
            }
        }
    }
    
    rows.sort()
    columns.sort()
    
    for i in 0..<rows.count {
        result.append((rows[i], columns[i]))
    }
    
    return result
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    
    for (index, row) in lst.enumerated() {
        for (columnIndex, column) in row.enumerated() {
            if column == x {
                result.append((index, columnIndex))
            }
        }
    }
    
    result.sort {
        $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1)
    }
    
    return result
}
```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 (columnIndex, column) in row.enumerated() {
            if column == x {
                result.append((index, columnIndex))
            }
        }
    }
    
    result.sort {
        $0.0 < $1.0 || ($0.0 == $1.0 && $0.1 > $1.1)
    }
    
    return result
}
```

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        for (index, column) in row.enumerated() {
            if column == x {
                result.append((index, index))
            }
        }
    }
    result.sort()
    return result
}
```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 (index, column) in row.enumerated() {
            if column == x {
                result.append((index, index))
            }
        }
    }
    result.sort()
    return result
}
```
result.sort() // type '(Int, Int)' cannot conform to 'Comparable'

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    var rowIndex = 0
    for row in lst {
        if row.count > 0 {
            var columnIndex = row.count - 1
            for column in row {
                if column == x {
                    result.append((rowIndex, columnIndex))
                }
                columnIndex -= 1
            }
        }
        rowIndex += 1
    }
    result.sort()
    return result
}
```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)] = []
    var rowIndex = 0
    for row in lst {
        if row.count > 0 {
            var columnIndex = row.count - 1
            for column in row {
                if column == x {
                    result.append((rowIndex, columnIndex))
                }
                columnIndex -= 1
            }
        }
        rowIndex += 1
    }
    result.sort()
    return result
}
```
result.sort() // type '(Int, Int)' cannot conform to 'Comparable'

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    var rows: [(Int, [Int])] = lst.map { (row, cols) -> (Int, [Int]) in
        (row, cols.filter { $0 == x })
    }
    
    // Sort rows by row number
    rows.sort { $0.0 < $1.0 }
    
    // Sort rows by column number
    for row in rows {
        row.1.sort { $0 > $1 }
    }
    
    // Add rows to result
    for row in rows {
        result.append(row)
    }
    
    return result
}
```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)] = []
    var rows: [(Int, [Int])] = lst.map { (row, cols) -> (Int, [Int]) in
        (row, cols.filter { $0 == x })
    }
    
    // Sort rows by row number
    rows.sort { $0.0 < $1.0 }
    
    // Sort rows by column number
    for row in rows {
        row.1.sort { $0 > $1 }
    }
    
    // Add rows to result
    for row in rows {
        result.append(row)
    }
    
    return result
}
```
var rows: [(Int, [Int])] = lst.map { (row, cols) -> (Int, [Int]) in // contextual closure type '([Int]) throws -> (Int, [Int])' expects 1 argument, but 2 were used in closure body
row.1.sort { $0 > $1 } // cannot use mutating member on immutable value: 'row' is a 'let' constant
result.append(row) // tuple type '(Int, [Int])' is not convertible to tuple type '(Int, Int)'

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    var rows = lst.count
    var cols = lst[0].count
    var row = 0
    var col = cols - 1
    
    while row < rows && col >= 0 {
        if lst[row][col] == x {
            result.append((row, col))
        }
        
        if lst[row][col] < x {
            row += 1
        } else {
            col -= 1
        }
    }
    
    return result
}
```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)] = []
    var rows = lst.count
    var cols = lst[0].count
    var row = 0
    var col = cols - 1
    
    while row < rows && col >= 0 {
        if lst[row][col] == x {
            result.append((row, col))
        }
        
        if lst[row][col] < x {
            row += 1
        } else {
            col -= 1
        }
    }
    
    return result
}
```
var rows = lst.count // variable 'rows' was never mutated; consider changing to 'let' constant
var cols = lst[0].count // variable 'cols' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    var rows: [Int] = []
    for row in lst {
        rows.append(row.count)
    }
    var rowIndex: Int = 0
    var colIndex: Int = 0
    var row: Int = 0
    var col: Int = 0
    while rowIndex < lst.count && colIndex < rows[rowIndex] {
        if lst[rowIndex][colIndex] == x {
            result.append((rowIndex, colIndex))
        }
        colIndex += 1
        if colIndex == rows[rowIndex] {
            rowIndex += 1
            colIndex = 0
        }
    }
    return result
}
```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)] = []
    var rows: [Int] = []
    for row in lst {
        rows.append(row.count)
    }
    var rowIndex: Int = 0
    var colIndex: Int = 0
    var row: Int = 0
    var col: Int = 0
    while rowIndex < lst.count && colIndex < rows[rowIndex] {
        if lst[rowIndex][colIndex] == x {
            result.append((rowIndex, colIndex))
        }
        colIndex += 1
        if colIndex == rows[rowIndex] {
            rowIndex += 1
            colIndex = 0
        }
    }
    return result
}
```
var row: Int = 0 // variable 'row' was never used; consider replacing with '_' or removing it
var col: Int = 0 // variable 'col' was never used; consider replacing with '_' or removing it
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    var rows: [Int] = []
    for row in lst {
        if row.count > 0 {
            rows.append(row.count)
        }
    }
    var rowsCount = rows.count
    var rowIndex = 0
    var columnIndex = 0
    for i in 0..<rowsCount {
        if rows[i] > x {
            rowIndex = i - 1
            break
        }
    }
    for i in 0..<rows[rowIndex] {
        if i == x {
            result.append((rowIndex, columnIndex))
            break
        }
        columnIndex += 1
    }
    return result
}
```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)] = []
    var rows: [Int] = []
    for row in lst {
        if row.count > 0 {
            rows.append(row.count)
        }
    }
    var rowsCount = rows.count
    var rowIndex = 0
    var columnIndex = 0
    for i in 0..<rowsCount {
        if rows[i] > x {
            rowIndex = i - 1
            break
        }
    }
    for i in 0..<rows[rowIndex] {
        if i == x {
            result.append((rowIndex, columnIndex))
            break
        }
        columnIndex += 1
    }
    return result
}
```
var rowsCount = rows.count // variable 'rowsCount' was never mutated; consider changing to 'let' constant
 // Fatal error: Index out of range

func sortArray(array: [Int]) -> [Int] {
    if array.count == 0 {
        return []
    }
    
    var sortedArray = array
    
    for i in 0..<sortedArray.count {
        for j in 0..<sortedArray.count - 1 - i {
            if sortedArray[j] + sortedArray[sortedArray.count - 1 - i] % 2 == 0 {
                swap(&sortedArray, j, j + 1)
            }
        }
    }
    
    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] {
    if array.count == 0 {
        return []
    }
    
    var sortedArray = array
    
    for i in 0..<sortedArray.count {
        for j in 0..<sortedArray.count - 1 - i {
            if sortedArray[j] + sortedArray[sortedArray.count - 1 - i] % 2 == 0 {
                swap(&sortedArray, j, j + 1)
            }
        }
    }
    
    return sortedArray
}
```
swap(&sortedArray, j, j + 1) // cannot convert value of type 'Int' to expected argument type '[Int]'
swap(&sortedArray, j, j + 1) // extra argument in call

func sortArray(array: [Int]) -> [Int] {
    var sortedArray = array
    var firstIndex = 0
    var lastIndex = array.count - 1
    
    while firstIndex < lastIndex {
        if (array[firstIndex] + array[lastIndex]) % 2 == 0 {
            swap(&sortedArray, firstIndex, lastIndex)
            lastIndex -= 1
        } else {
            firstIndex += 1
        }
    }
    
    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] {
    var sortedArray = array
    var firstIndex = 0
    var lastIndex = array.count - 1
    
    while firstIndex < lastIndex {
        if (array[firstIndex] + array[lastIndex]) % 2 == 0 {
            swap(&sortedArray, firstIndex, lastIndex)
            lastIndex -= 1
        } else {
            firstIndex += 1
        }
    }
    
    return sortedArray
}
```
swap(&sortedArray, firstIndex, lastIndex) // extra argument in call
swap(&sortedArray, firstIndex, lastIndex) // cannot convert value of type 'Int' to expected argument type '[Int]'

func sortArray(array: [Int]) -> [Int] {
    var sortedArray = array
    var firstIndex = 0
    var lastIndex = array.count - 1
    var sum = sortedArray[firstIndex] + sortedArray[lastIndex]
    if sum % 2 == 0 {
        sortedArray.sort(>)
    } else {
        sortedArray.sort(<)
    }
    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] {
    var sortedArray = array
    var firstIndex = 0
    var lastIndex = array.count - 1
    var sum = sortedArray[firstIndex] + sortedArray[lastIndex]
    if sum % 2 == 0 {
        sortedArray.sort(>)
    } else {
        sortedArray.sort(<)
    }
    return sortedArray
}
```
sortedArray.sort(>) // missing argument label 'by:' in call
sortedArray.sort(<) // missing argument label 'by:' in call

func sortArray(array: [Int]) -> [Int] {
    var sortedArray = array
    var sum = sortedArray[0] + sortedArray[sortedArray.count - 1]
    if sum % 2 == 0 {
        sortedArray.sort()
    } else {
        sortedArray.sort().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] {
    var sortedArray = array
    var sum = sortedArray[0] + sortedArray[sortedArray.count - 1]
    if sum % 2 == 0 {
        sortedArray.sort()
    } else {
        sortedArray.sort().reverse()
    }
    return sortedArray
}
```
sortedArray.sort().reverse() // value of tuple type '()' has no member 'reverse'

func sortArray(array: [Int]) -> [Int] {
    var sortedArray = array
    var firstIndex = 0
    var lastIndex = array.count - 1
    var sum = sortedArray[firstIndex] + sortedArray[lastIndex]
    while firstIndex < lastIndex {
        if sum % 2 == 0 {
            sortedArray.swapAt(firstIndex, lastIndex)
        }
        firstIndex += 1
        lastIndex -= 1
        sum = sortedArray[firstIndex] + sortedArray[lastIndex]
    }
    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] {
    var sortedArray = array
    var firstIndex = 0
    var lastIndex = array.count - 1
    var sum = sortedArray[firstIndex] + sortedArray[lastIndex]
    while firstIndex < lastIndex {
        if sum % 2 == 0 {
            sortedArray.swapAt(firstIndex, lastIndex)
        }
        firstIndex += 1
        lastIndex -= 1
        sum = sortedArray[firstIndex] + sortedArray[lastIndex]
    }
    return sortedArray
}
```
 // Fatal error: Index out of range

func sortArray(array: [Int]) -> [Int] {
    // TODO: implement sortArray
    return array
}
```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] {
    // TODO: implement sortArray
    return array
}
```
 // XCTAssertTrue failed

func sortArray(array: [Int]) -> [Int] {
    // TODO: Write your code here
    var sortedArray = array
    var sum = sortedArray[0] + sortedArray[sortedArray.count - 1]
    if sum % 2 == 0 {
        sortedArray.sort()
    } else {
        sortedArray.sort()
        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] {
    // TODO: Write your code here
    var sortedArray = array
    var sum = sortedArray[0] + sortedArray[sortedArray.count - 1]
    if sum % 2 == 0 {
        sortedArray.sort()
    } else {
        sortedArray.sort()
        sortedArray.reverse()
    }
    return sortedArray
}
```
var sum = sortedArray[0] + sortedArray[sortedArray.count - 1] // variable 'sum' was never mutated; consider changing to 'let' constant
 // Fatal error: Index out of range

func sortArray(array: [Int]) -> [Int] {
    // TODO:
    return array
}
```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] {
    // TODO:
    return array
}
```
 // XCTAssertTrue failed

func sortArray(array: [Int]) -> [Int] {
    var sortedArray = array
    var sum = sortedArray[0] + sortedArray[sortedArray.count - 1]
    if sum % 2 == 0 {
        sortedArray.sort()
    } else {
        sortedArray.sort()
        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] {
    var sortedArray = array
    var sum = sortedArray[0] + sortedArray[sortedArray.count - 1]
    if sum % 2 == 0 {
        sortedArray.sort()
    } else {
        sortedArray.sort()
        sortedArray.reverse()
    }
    return sortedArray
}
```
var sum = sortedArray[0] + sortedArray[sortedArray.count - 1] // variable 'sum' was never mutated; consider changing to 'let' constant
 // Fatal error: Index out of range

func sortArray(array: [Int]) -> [Int] {
    var sortedArray = array
    var firstIndex = 0
    var lastIndex = array.count - 1
    var sum = sortedArray[firstIndex] + sortedArray[lastIndex]
    if sum % 2 == 0 {
        sortedArray.sort()
    } else {
        sortedArray.sort()
        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] {
    var sortedArray = array
    var firstIndex = 0
    var lastIndex = array.count - 1
    var sum = sortedArray[firstIndex] + sortedArray[lastIndex]
    if sum % 2 == 0 {
        sortedArray.sort()
    } else {
        sortedArray.sort()
        sortedArray.reverse()
    }
    return sortedArray
}
```
var firstIndex = 0 // variable 'firstIndex' was never mutated; consider changing to 'let' constant
var lastIndex = array.count - 1 // variable 'lastIndex' was never mutated; consider changing to 'let' constant
var sum = sortedArray[firstIndex] + sortedArray[lastIndex] // variable 'sum' was never mutated; consider changing to 'let' constant
 // Fatal error: Index out of range

func encrypt(s: String) -> String {
    // Your code here
}
```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 {
    // Your code here
}
```
} // missing return in global function expected to return 'String'

func encrypt(s: String) -> String {
    // TODO: Your code here
}

func decrypt(s: String) -> String {
    // TODO: Your code here
}
```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 {
    // TODO: Your code here
}

// Create a function decrypt that takes a string as an argument and
// returns a string decrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift up by two multiplied to two places.
// For example:
// decrypt(s: "lm") == "hi"
// decrypt(s: "ewhjklnop") == "asdfghjkl"
// decrypt(s: "kj") == "gf"
// decrypt(s: "ix") == "et"
func decrypt(s: String) -> String {
    // TODO: Your code here
}

// 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 {
    // TODO: Your code here
}

// Create a function decrypt that takes a string as an argument and
// returns a string decrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift up by two multiplied to two places.
// For example:
// decrypt(s: "lm") == "hi"
// decrypt(s: "ewhjklnop") == "asdfghjkl"
// decrypt(s: "kj") == "gf"
// decrypt(s: "ix") == "et"
func decrypt(s: String) -> String {
    // TODO: Your code here
}

// 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 {
    // TODO: Your code here
}

// Create a function decrypt that takes a string as an argument and
// returns a string decrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift up by two multiplied to two places.
// For example:
// decrypt(s: "lm") == "hi"
// decrypt(s: "ewhjklnop") == "asdfghjkl"
// decrypt(s: "kj") == "gf"
// decrypt(s: "ix") == "et"
func decrypt(s: String) -> String {
    // TODO: Your code here
}

// 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 {
    // TODO: Your code here
}

// Create a function decrypt that takes a string as an argument and
// returns a string decrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift up by two multiplied to two places.
// For example:
// decrypt(s: "lm") == "hi"
// decrypt(s: "ewhjklnop") == "asdfghjkl"
// decrypt(s: "kj") == "gf"
// decrypt(s: "ix") == "et"
func decrypt(s: String) -> String {
    // TODO: Your code here
}

// Create a function
} // missing return in global function expected to return 'String'
} // missing return in global function expected to return 'String'

func encrypt(s: String) -> String {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func encrypt(s: String) -> String {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'String'

func encrypt(s: String) -> String {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func encrypt(s: String) -> String {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'String'

func encrypt(s: String) -> String {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'String'

func encrypt(s: String) -> String {
    // Your code here
}
```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 {
    // Your code here
}
```
} // missing return in global function expected to return 'String'

func encrypt(s: String) -> String {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func encrypt(s: String) -> String {
    return ""
}

func decrypt(s: String) -> String {
    return ""
}

func rotate(s: String) -> String {
    return ""
}

func rotateBack(s: String) -> String {
    return ""
}

func rotate2(s: String) -> String {
    return ""
}

func rotateBack2(s: String) -> String {
    return ""
}

func rotate3(s: String) -> String {
    return ""
}

func rotateBack3(s: String) -> String {
    return ""
}

func rotate4(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 ""
}

// Create a function decrypt that takes a string as an argument and
// returns a string decrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift up by two multiplied to two places.
// For example:
// decrypt(s: "lm") == "hi"
// decrypt(s: "ewhjklnop") == "asdfghjkl"
// decrypt(s: "kj") == "gf"
// decrypt(s: "ix") == "et"
func decrypt(s: String) -> String {
    return ""
}

// Create a function rotate that takes a string as an argument and
// returns a string rotated by two places.
// For example:
// rotate(s: "hi") == "lm"
// rotate(s: "asdfghjkl") == "ewhjklnop"
// rotate(s: "gf") == "kj"
// rotate(s: "et") == "ix"
func rotate(s: String) -> String {
    return ""
}

// Create a function rotateBack that takes a string as an argument and
// returns a string rotated by two places in the opposite direction.
// For example:
// rotateBack(s: "lm") == "hi"
// rotateBack(s: "ewhjklnop") == "asdfghjkl"
// rotateBack(s: "kj") == "gf"
// rotateBack(s: "ix") == "et"
func rotateBack(s: String) -> String {
    return ""
}

// Create a function rotate2 that takes a string as an argument and
// returns a string rotated by two places in the opposite direction.
// For example:
// rotate2(s: "lm") == "hi"
// rotate2(s: "ewhjklnop") == "asdfghjkl"
// rotate2(s: "kj") == "gf"
// rotate2(s: "ix") == "et"
func rotate2(s: String) -> String {
    return ""
}

// Create a function rotateBack2 that takes a string as an argument and
// returns a string rotated by two places.
// For example:
// rotateBack2(s: "lm") == "hi"
// rotateBack2(s: "ewhjklnop") == "asdfghjkl"
// rotateBack2(s: "kj") == "gf"
// rotateBack2(s: "ix") == "et"
func rotateBack2(s: String) -> String {
    return ""
}

// Create a function rotate3 that takes a string as an argument and
// returns a string rotated by two places in the opposite direction.
// For example:
// rotate3(s: "lm") == "hi"
// rotate3(s: "ewhjklnop") == "asdfghjkl"
// rotate3(s: "kj") == "gf"
// rotate3(s: "ix") == "et"
func rotate3(s: String) -> String {
    return ""
}

// Create a function rotateBack3 that takes a string as an argument and
// returns a string rotated by two places.
// For example:
// rotateBack3(s: "lm") == "hi"
// rotateBack3(s: "ewhjklnop") == "asdfghjkl"
// rotateBack3(s: "kj") == "gf"
// rotateBack3(s: "ix") == "et"
func rotateBack3(s: String) -> String {
    return ""
}

// Create a function rotate4 that takes a string as an argument and
// returns a string rotated by two places in the opposite direction.
// For example:
// rotate4(s: "lm") == "hi"
// rotate4(s: "ewhjklnop") == "asdfghjkl"
// rotate4(s: "kj") == "gf"
// rotate4(s: "ix") == "et"
func rotate4(s: String) -> String {
    return ""
}

// Create a function rotateBack4 that takes a string as an argument and
// returns a string rotated by two places.
// For example:
// rotateBack4(s: "lm") == "hi"
// rotateBack4(s: "ewhjklnop")
 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    var smallest = lst[0]
    var secondSmallest = lst[0]
    for i in 1..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest && lst[i]!= smallest {
            secondSmallest = lst[i]
        }
    }
    if secondSmallest == smallest {
        return nil
    }
    return secondSmallest
}
```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 smallest = lst[0]
    var secondSmallest = lst[0]
    for i in 1..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest && lst[i]!= smallest {
            secondSmallest = lst[i]
        }
    }
    if secondSmallest == smallest {
        return nil
    }
    return secondSmallest
}
```
} else if lst[i] < secondSmallest && lst[i]!= smallest { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
} else if lst[i] < secondSmallest && lst[i]!= smallest { // use of '=' in a boolean context, did you mean '=='?
} else if lst[i] < secondSmallest && lst[i]!= smallest { // cannot force unwrap value of non-optional type 'Int'
} else if lst[i] < secondSmallest && lst[i]!= smallest { // expression is not assignable: '&&' returns immutable value
} else if lst[i] < secondSmallest && lst[i]!= smallest { // '=' must have consistent whitespace on both sides

func nextSmallest(lst: [Int]) -> Int? {
    var smallest = lst.first
    var secondSmallest: Int?
    for i in 1...lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```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 smallest = lst.first
    var secondSmallest: Int?
    for i in 1...lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```
if lst[i] < smallest { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
} else if lst[i] < secondSmallest { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func nextSmallest(lst: [Int]) -> Int? {
    var smallest = lst.first
    var secondSmallest = nil
    for i in 1...lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```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 smallest = lst.first
    var secondSmallest = nil
    for i in 1...lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```
var secondSmallest = nil // 'nil' requires a contextual type
if lst[i] < smallest { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func nextSmallest(lst: [Int]) -> Int? {
    if lst.count == 0 {
        return nil
    }
    
    var smallest = lst[0]
    var secondSmallest = Int.max
    
    for i in 1..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    
    return secondSmallest
}
```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? {
    if lst.count == 0 {
        return nil
    }
    
    var smallest = lst[0]
    var secondSmallest = Int.max
    
    for i in 1..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    
    return secondSmallest
}
```
 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    if lst.count == 0 {
        return nil
    }
    
    var smallest = lst[0]
    var secondSmallest = lst[0]
    
    for i in 1..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest && lst[i]!= smallest {
            secondSmallest = lst[i]
        }
    }
    
    if secondSmallest == smallest {
        return nil
    }
    
    return secondSmallest
}
```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? {
    if lst.count == 0 {
        return nil
    }
    
    var smallest = lst[0]
    var secondSmallest = lst[0]
    
    for i in 1..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest && lst[i]!= smallest {
            secondSmallest = lst[i]
        }
    }
    
    if secondSmallest == smallest {
        return nil
    }
    
    return secondSmallest
}
```
} else if lst[i] < secondSmallest && lst[i]!= smallest { // expression is not assignable: '&&' returns immutable value
} else if lst[i] < secondSmallest && lst[i]!= smallest { // use of '=' in a boolean context, did you mean '=='?
} else if lst[i] < secondSmallest && lst[i]!= smallest { // cannot force unwrap value of non-optional type 'Int'
} else if lst[i] < secondSmallest && lst[i]!= smallest { // '=' must have consistent whitespace on both sides
} else if lst[i] < secondSmallest && lst[i]!= smallest { // type 'Int' cannot be used as a boolean; test for '!= 0' instead

func nextSmallest(lst: [Int]) -> Int? {
    if lst.count == 0 {
        return nil
    }
    
    var smallest = lst[0]
    var secondSmallest = lst[0]
    
    for i in 1..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest && lst[i]!= smallest {
            secondSmallest = lst[i]
        }
    }
    
    return secondSmallest
}
```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? {
    if lst.count == 0 {
        return nil
    }
    
    var smallest = lst[0]
    var secondSmallest = lst[0]
    
    for i in 1..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest && lst[i]!= smallest {
            secondSmallest = lst[i]
        }
    }
    
    return secondSmallest
}
```
} else if lst[i] < secondSmallest && lst[i]!= smallest { // expression is not assignable: '&&' returns immutable value
} else if lst[i] < secondSmallest && lst[i]!= smallest { // use of '=' in a boolean context, did you mean '=='?
} else if lst[i] < secondSmallest && lst[i]!= smallest { // cannot force unwrap value of non-optional type 'Int'
} else if lst[i] < secondSmallest && lst[i]!= smallest { // '=' must have consistent whitespace on both sides
} else if lst[i] < secondSmallest && lst[i]!= smallest { // type 'Int' cannot be used as a boolean; test for '!= 0' instead

func nextSmallest(lst: [Int]) -> Int? {
    if lst.count == 0 {
        return nil
    }
    var smallest = lst[0]
    var secondSmallest = lst[0]
    for i in 1...lst.count-1 {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest && lst[i]!= smallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```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? {
    if lst.count == 0 {
        return nil
    }
    var smallest = lst[0]
    var secondSmallest = lst[0]
    for i in 1...lst.count-1 {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest && lst[i]!= smallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```
} else if lst[i] < secondSmallest && lst[i]!= smallest { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
} else if lst[i] < secondSmallest && lst[i]!= smallest { // '=' must have consistent whitespace on both sides
} else if lst[i] < secondSmallest && lst[i]!= smallest { // use of '=' in a boolean context, did you mean '=='?
} else if lst[i] < secondSmallest && lst[i]!= smallest { // cannot force unwrap value of non-optional type 'Int'
} else if lst[i] < secondSmallest && lst[i]!= smallest { // expression is not assignable: '&&' returns immutable value

func nextSmallest(lst: [Int]) -> Int? {
    if lst.count == 0 {
        return nil
    }
    var smallest = lst[0]
    var secondSmallest = lst[0]
    for i in 1..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest && lst[i]!= smallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```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? {
    if lst.count == 0 {
        return nil
    }
    var smallest = lst[0]
    var secondSmallest = lst[0]
    for i in 1..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest && lst[i]!= smallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```
} else if lst[i] < secondSmallest && lst[i]!= smallest { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
} else if lst[i] < secondSmallest && lst[i]!= smallest { // '=' must have consistent whitespace on both sides
} else if lst[i] < secondSmallest && lst[i]!= smallest { // use of '=' in a boolean context, did you mean '=='?
} else if lst[i] < secondSmallest && lst[i]!= smallest { // cannot force unwrap value of non-optional type 'Int'
} else if lst[i] < secondSmallest && lst[i]!= smallest { // expression is not assignable: '&&' returns immutable value

func nextSmallest(lst: [Int]) -> Int? {
    if lst.count < 2 {
        return nil
    }
    
    var smallest = lst[0]
    var secondSmallest = lst[1]
    
    for i in 2..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    
    return secondSmallest
}
```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? {
    if lst.count < 2 {
        return nil
    }
    
    var smallest = lst[0]
    var secondSmallest = lst[1]
    
    for i in 2..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    
    return secondSmallest
}
```
 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    if lst.count == 0 {
        return nil
    }
    var smallest = lst[0]
    var secondSmallest = Int.max
    for i in 1...lst.count-1 {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```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? {
    if lst.count == 0 {
        return nil
    }
    var smallest = lst[0]
    var secondSmallest = Int.max
    for i in 1...lst.count-1 {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var count = 0
    var words = S.componentsSeparatedByString(" ")
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    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 words = S.componentsSeparatedByString(" ")
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```
var words = S.componentsSeparatedByString(" ") // value of type 'String' has no member 'componentsSeparatedByString'

func isBored(S: String) -> Int {
    let words = S.componentsSeparatedByString(" ")
    var count = 0
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    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 {
    let words = S.componentsSeparatedByString(" ")
    var count = 0
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```
let words = S.componentsSeparatedByString(" ") // value of type 'String' has no member 'componentsSeparatedByString'

func isBored(S: String) -> Int {
    var count = 0
    var words = S.componentsSeparatedByString(" ")
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    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 words = S.componentsSeparatedByString(" ")
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```
var words = S.componentsSeparatedByString(" ") // value of type 'String' has no member 'componentsSeparatedByString'

func isBored(S: String) -> Int {
    var count = 0
    var words = S.componentsSeparatedByString(" ")
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    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 words = S.componentsSeparatedByString(" ")
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```
var words = S.componentsSeparatedByString(" ") // value of type 'String' has no member 'componentsSeparatedByString'

func isBored(S: String) -> Int {
    var boredomCount = 0
    var sentence = S.split(".")
    for sentence in sentence {
        if sentence.hasPrefix("I") {
            boredomCount += 1
        }
    }
    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 sentence = S.split(".")
    for sentence in sentence {
        if sentence.hasPrefix("I") {
            boredomCount += 1
        }
    }
    return boredomCount
}
```
var sentence = S.split(".") // no exact matches in call to instance method 'split'

func isBored(S: String) -> Int {
    let words = S.componentsSeparatedByString(" ")
    var count = 0
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    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 {
    let words = S.componentsSeparatedByString(" ")
    var count = 0
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```
let words = S.componentsSeparatedByString(" ") // value of type 'String' has no member 'componentsSeparatedByString'

func isBored(S: String) -> Int {
    let words = S.components(separatedBy: " ")
    var count = 0
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    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 {
    let words = S.components(separatedBy: " ")
    var count = 0
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var count = 0
    for word in S.split(separator: " ") {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    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
    for word in S.split(separator: " ") {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var count = 0
    let words = S.components(separatedBy: " ")
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    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
    let words = S.components(separatedBy: " ")
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var count = 0
    for word in S.split(separator: " ") {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    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
    for word in S.split(separator: " ") {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x)
}
```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 (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x)
}
```
return (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x)
}
```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 x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x)
}
```
return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x)
}
```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 x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x)
}
```
return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x)
}
```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 (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x)
}
```
return (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x)
}
```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 x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x)
}
```
return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x)
}
```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 x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x)
}
```
return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return x.isInteger && y.isInteger && z.isInteger && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x)
}
```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 (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x)
}
```
return (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'
return (x.isInteger && y.isInteger && z.isInteger) && (x + y == z || x + z == y || y + z == x) // value of type 'Double' has no member 'isInteger'

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    // TODO: Implement this function
    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 {
    // TODO: Implement this function
    return false
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    // TODO: Implement this function!
    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 {
    // TODO: Implement this function!
    return false
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    // TODO: Implement this function.
    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 {
    // TODO: Implement this function.
    return false
}
```
 // XCTAssertTrue failed

func encode(message: String) -> String {
    var encoded = ""
    for character in message {
        if character == "a" || character == "e" || character == "i" || character == "o" || character == "u" {
            encoded += String(message.index(message.startIndex, offsetBy: 2))
        } else {
            encoded += String(character.uppercased())
        }
    }
    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 {
    var encoded = ""
    for character in message {
        if character == "a" || character == "e" || character == "i" || character == "o" || character == "u" {
            encoded += String(message.index(message.startIndex, offsetBy: 2))
        } else {
            encoded += String(character.uppercased())
        }
    }
    return encoded
}
```
encoded += String(message.index(message.startIndex, offsetBy: 2)) // no exact matches in call to initializer

func encode(message: String) -> String {
    let vowels = "aeiou"
    var encoded = ""
    for character in message {
        if vowels.contains(String(character)) {
            let index = vowels.index(of: String(character))
            let nextVowel = vowels[index+2]
            encoded += String(nextVowel)
        } else {
            encoded += String(character)
        }
    }
    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 vowels = "aeiou"
    var encoded = ""
    for character in message {
        if vowels.contains(String(character)) {
            let index = vowels.index(of: String(character))
            let nextVowel = vowels[index+2]
            encoded += String(nextVowel)
        } else {
            encoded += String(character)
        }
    }
    return encoded
}
```
let index = vowels.index(of: String(character)) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')

func encode(message: String) -> String {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'String'

func encode(message: String) -> String {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'String'

func encode(message: String) -> String {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'String'

func encode(message: String) -> String {
    return message.map {
        let char = String($0)
        let vowel = "aeiou"
        if vowel.contains(char) {
            let index = vowel.index(of: char)
            let nextChar = String(vowel[index+2])
            return nextChar
        } else {
            return String(char.uppercased().lowercased())
        }
    }.joined()
}

func decode(message: String) -> String {
    return message.map {
        let char = String($0)
        let vowel = "aeiou"
        if vowel.contains(char) {
            let index = vowel.index(of: char)
            let nextChar = String(vowel[index+2])
            return nextChar
        } else {
            return String(char.uppercased().lowercased())
        }
    }.joined()
}
```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 message.map {
        let char = String($0)
        let vowel = "aeiou"
        if vowel.contains(char) {
            let index = vowel.index(of: char)
            let nextChar = String(vowel[index+2])
            return nextChar
        } else {
            return String(char.uppercased().lowercased())
        }
    }.joined()
}

// Write a function that takes a message, and decodes it 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:
// decode(message: "TGST") == "test"
// decode(message: "tHKS KS C MGSSCGG") == "This is a message"
func decode(message: String) -> String {
    return message.map {
        let char = String($0)
        let vowel = "aeiou"
        if vowel.contains(char) {
            let index = vowel.index(of: char)
            let nextChar = String(vowel[index+2])
            return nextChar
        } else {
            return String(char.uppercased().lowercased())
        }
    }.joined()
}
```
let index = vowel.index(of: char) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')
let index = vowel.index(of: char) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')

func encode(message: String) -> String {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'String'

func encode(message: String) -> String {
    // TODO: implement encode
}
```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 {
    // TODO: implement encode
}
```
} // missing return in global function expected to return 'String'

func encode(message: String) -> String {
    var encoded = ""
    for character in message.unicodeScalars {
        if character.isLetter() {
            let index = message.unicodeScalars.index(of: character)
            let next = message.unicodeScalars[index + 2]
            if character.isVowel() {
                encoded += next
            } else {
                encoded += character.uppercased()
            }
        } else {
            encoded += character
        }
    }
    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 {
    var encoded = ""
    for character in message.unicodeScalars {
        if character.isLetter() {
            let index = message.unicodeScalars.index(of: character)
            let next = message.unicodeScalars[index + 2]
            if character.isVowel() {
                encoded += next
            } else {
                encoded += character.uppercased()
            }
        } else {
            encoded += character
        }
    }
    return encoded
}
```
if character.isLetter() { // value of type 'Unicode.Scalar' has no member 'isLetter'
let index = message.unicodeScalars.index(of: character) // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
let next = message.unicodeScalars[index + 2] // binary operator '+' cannot be applied to operands of type 'String.UnicodeScalarView.Index?' (aka 'Optional<String.Index>') and 'TimeInterval' (aka 'Double')
let next = message.unicodeScalars[index + 2] // subscript 'subscript(_:)' requires that 'Date' conform to 'RangeExpression'
if character.isVowel() { // value of type 'Unicode.Scalar' has no member 'isVowel'
encoded += character.uppercased() // value of type 'Unicode.Scalar' has no member 'uppercased'
encoded += character // operator function '+=' requires that 'Unicode.Scalar' conform to 'Sequence'

func encode(message: String) -> String {
    var encoded = ""
    for character in message {
        if character == "a" || character == "e" || character == "i" || character == "o" || character == "u" {
            encoded += String(asciiValue: character.asciiValue! + 2)
        } else {
            encoded += String(character.asciiValue! + (character.isUpperCase? 32 : -32))
        }
    }
    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 {
    var encoded = ""
    for character in message {
        if character == "a" || character == "e" || character == "i" || character == "o" || character == "u" {
            encoded += String(asciiValue: character.asciiValue! + 2)
        } else {
            encoded += String(character.asciiValue! + (character.isUpperCase? 32 : -32))
        }
    }
    return encoded
}
```
encoded += String(asciiValue: character.asciiValue! + 2) // no exact matches in call to initializer
encoded += String(character.asciiValue! + (character.isUpperCase? 32 : -32)) // expected ',' separator
encoded += String(character.asciiValue! + (character.isUpperCase? 32 : -32)) // type of expression is ambiguous without a type annotation

func skjkasdkd(lst: [Int]) -> Int {
    var maxPrime = 0
    for i in lst {
        if isPrime(i) {
            maxPrime = i
        }
    }
    return sumDigits(maxPrime)
}
```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 maxPrime = 0
    for i in lst {
        if isPrime(i) {
            maxPrime = i
        }
    }
    return sumDigits(maxPrime)
}

// 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 maxPrime = 0
    for i in lst {
        if isPrime(i) {
            maxPrime = i
        }
    }
    return sumDigits(maxPrime)
}

// 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 maxPrime = 0
    for i in lst {
        if isPrime(i) {
            maxPrime = i
        }
    }
    return sumDigits(maxPrime)
}

// 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 skjkas
if isPrime(i) { // cannot find 'isPrime' in scope
return sumDigits(maxPrime) // cannot find 'sumDigits' in scope

func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for i in lst {
        if isPrime(i) {
            largestPrime = i
        }
    }
    return sumDigits(largestPrime)
}

func sumDigits(number: Int) -> Int {
    var sum = 0
    while number > 0 {
        sum += number % 10
        number /= 10
    }
    return sum
}

func isPrime(number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    if number <= 3 {
        return true
    }
    if number % 2 == 0 || number % 3 == 0 {
        return false
    }
    var i = 5
    while i * i <= number {
        if number % i == 0 || number % (i + 2) == 0 {
            return false
        }
        i = 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 largestPrime = 0
    for i in lst {
        if isPrime(i) {
            largestPrime = i
        }
    }
    return sumDigits(largestPrime)
}

func sumDigits(number: Int) -> Int {
    var sum = 0
    while number > 0 {
        sum += number % 10
        number /= 10
    }
    return sum
}

func isPrime(number: Int) -> Bool {
    if number <= 1 {
        return false
    }
    if number <= 3 {
        return true
    }
    if number % 2 == 0 || number % 3 == 0 {
        return false
    }
    var i = 5
    while i * i <= number {
        if number % i == 0 || number % (i + 2) == 0 {
            return false
        }
        i = i + 6
    }
    return true
}
```
if isPrime(i) { // missing argument label 'number:' in call
return sumDigits(largestPrime) // missing argument label 'number:' in call
number /= 10 // left side of mutating operator isn't mutable: 'number' is a 'let' constant

func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for i in lst {
        if isPrime(i) {
            largestPrime = i
        }
    }
    return largestPrime.sumOfDigits()
}
```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 largestPrime = 0
    for i in lst {
        if isPrime(i) {
            largestPrime = i
        }
    }
    return largestPrime.sumOfDigits()
}
```
if isPrime(i) { // cannot find 'isPrime' in scope
return largestPrime.sumOfDigits() // value of type 'Int' has no member 'sumOfDigits'

func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for i in lst {
        if isPrime(i) {
            largestPrime = i
        }
    }
    return sumDigits(largestPrime)
}
```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 largestPrime = 0
    for i in lst {
        if isPrime(i) {
            largestPrime = i
        }
    }
    return sumDigits(largestPrime)
}

// 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 largestPrime = 0
    for i in lst {
        if isPrime(i) {
            largestPrime = i
        }
    }
    return sumDigits(largestPrime)
}

// 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 largestPrime = 0
    for i in lst {
        if isPrime(i) {
            largestPrime = i
        }
    }
    return sumDigits(largestPrime)
}

// 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 skjkas
if isPrime(i) { // cannot find 'isPrime' in scope
return sumDigits(largestPrime) // cannot find 'sumDigits' in scope

func skjkasdkd(lst: [Int]) -> Int {
    let max = lst.maxElement()!
    let maxPrime = max.primeFactors().reduce(0, combine: +)
    return maxPrime.digits.reduce(0, combine: +)
}
```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 max = lst.maxElement()!
    let maxPrime = max.primeFactors().reduce(0, combine: +)
    return maxPrime.digits.reduce(0, combine: +)
}
```
let max = lst.maxElement()! // value of type '[Int]' has no member 'maxElement'

func skjkasdkd(lst: [Int]) -> Int {
    // TODO: implement me
    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 {
    // TODO: implement me
    return 0
}
```
 // XCTAssertTrue failed

func skjkasdkd(lst: [Int]) -> Int {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func skjkasdkd(lst: [Int]) -> Int {
    let max = lst.max()!
    let maxPrime = max.primeFactors().first
    return maxPrime.map { $0.digits.reduce(0, combine: +) }
}
```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 max = lst.max()!
    let maxPrime = max.primeFactors().first
    return maxPrime.map { $0.digits.reduce(0, combine: +) }
}
```
let maxPrime = max.primeFactors().first // value of type 'Int' has no member 'primeFactors'

func skjkasdkd(lst: [Int]) -> Int {
    // TODO: implement me
    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 {
    // TODO: implement me
    return 0
}
```
 // XCTAssertTrue failed

func skjkasdkd(lst: [Int]) -> Int {
    let maxPrime = lst.maxElement { $0 % 2 == 1 && $0 > 1 }
    return maxPrime?.digitsSum?? 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 {
    let maxPrime = lst.maxElement { $0 % 2 == 1 && $0 > 1 }
    return maxPrime?.digitsSum?? 0
}
```
let maxPrime = lst.maxElement { $0 % 2 == 1 && $0 > 1 } // value of type '[Int]' has no member 'maxElement'
return maxPrime?.digitsSum?? 0 // type of expression is ambiguous without a type annotation
return maxPrime?.digitsSum?? 0 // consecutive statements on a line must be separated by ';'
return maxPrime?.digitsSum?? 0 // integer literal is unused

func countUpTo(n: Int) -> [Int] {
    var result: [Int] = []
    for i in 2...n {
        if isPrime(i) {
            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 {
        if isPrime(i) {
            result.append(i)
        }
    }
    return result
}
```
if isPrime(i) { // cannot find 'isPrime' in scope

func countUpTo(n: Int) -> [Int] {
    var result = [Int]()
    for i in 2...n {
        if isPrime(i) {
            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 {
        if isPrime(i) {
            result.append(i)
        }
    }
    return result
}
```
if isPrime(i) { // cannot find 'isPrime' in scope

func countUpTo(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        if isPrime(i) {
            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 1...n {
        if isPrime(i) {
            result.append(i)
        }
    }
    return result
}
```
if isPrime(i) { // cannot find 'isPrime' in scope

func countUpTo(n: Int) -> [Int] {
    var primes = [Int]()
    for i in 2...n {
        if isPrime(i) {
            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] {
    var primes = [Int]()
    for i in 2...n {
        if isPrime(i) {
            primes.append(i)
        }
    }
    return primes
}
```
if isPrime(i) { // cannot find 'isPrime' in scope

func countUpTo(n: Int) -> [Int] {
    var result = [Int]()
    for i in 2...n {
        if isPrime(i) {
            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 {
        if isPrime(i) {
            result.append(i)
        }
    }
    return result
}
```
if isPrime(i) { // cannot find 'isPrime' in scope

func countUpTo(n: Int) -> [Int] {
    var primeNumbers = [Int]()
    for i in 2...n {
        if isPrime(i) {
            primeNumbers.append(i)
        }
    }
    return primeNumbers
}
```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 primeNumbers = [Int]()
    for i in 2...n {
        if isPrime(i) {
            primeNumbers.append(i)
        }
    }
    return primeNumbers
}
```
if isPrime(i) { // cannot find 'isPrime' in scope

func countUpTo(n: Int) -> [Int] {
    // TODO: Implement me!
}
```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] {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return '[Int]'

func countUpTo(n: Int) -> [Int] {
    var primes: [Int] = []
    for i in 2...n {
        if isPrime(i) {
            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] {
    var primes: [Int] = []
    for i in 2...n {
        if isPrime(i) {
            primes.append(i)
        }
    }
    return primes
}
```
if isPrime(i) { // cannot find 'isPrime' in scope

func countUpTo(n: Int) -> [Int] {
    var result = [Int]()
    for i in 2...n {
        if isPrime(i) {
            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 {
        if isPrime(i) {
            result.append(i)
        }
    }
    return result
}
```
if isPrime(i) { // cannot find 'isPrime' in scope

func countUpTo(n: Int) -> [Int] {
    // TODO: Implement me!
}
```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] {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return '[Int]'

func multiply(a: Int, b: Int) -> Int {
    // Write your code here
    var result = 0
    var a_unit = a % 10
    var b_unit = b % 10
    while b > 0 {
        if b % 2 == 1 {
            result += a_unit
        }
        a_unit *= 2
        b /= 2
    }
    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 {
    // Write your code here
    var result = 0
    var a_unit = a % 10
    var b_unit = b % 10
    while b > 0 {
        if b % 2 == 1 {
            result += a_unit
        }
        a_unit *= 2
        b /= 2
    }
    return result
}
```
b /= 2 // left side of mutating operator isn't mutable: 'b' is a 'let' constant

func multiply(a: Int, b: Int) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func multiply(a: Int, b: Int) -> Int {
    // TODO: Complete this function
}
```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 {
    // TODO: Complete this function
}
```
} // missing return in global function expected to return 'Int'

func multiply(a: Int, b: Int) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func multiply(a: Int, b: Int) -> Int {
    // TODO: Implement this function
    return 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 {
    // TODO: Implement this function
    return 0
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    // Write your code here
    var a = a
    var b = b
    var result = 0
    
    while a > 0 {
        if a & 1 == 1 {
            result += b
        }
        a = a >> 1
        b = b << 1
    }
    
    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 {
    // Write your code here
    var a = a
    var b = b
    var result = 0
    
    while a > 0 {
        if a & 1 == 1 {
            result += b
        }
        a = a >> 1
        b = b << 1
    }
    
    return result
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    var a = a
    var b = b
    var result = 0
    
    while b > 0 {
        if b & 1 == 1 {
            result += a
        }
        a <<= 1
        b >>= 1
    }
    
    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 {
    var a = a
    var b = b
    var result = 0
    
    while b > 0 {
        if b & 1 == 1 {
            result += a
        }
        a <<= 1
        b >>= 1
    }
    
    return result
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    // Write your code here
    return a * 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 {
    // Write your code here
    return a * b
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    var a = a
    var b = b
    var result = 0
    
    while b > 0 {
        if b & 1 == 1 {
            result += a
        }
        a <<= 1
        b >>= 1
    }
    
    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 {
    var a = a
    var b = b
    var result = 0
    
    while b > 0 {
        if b & 1 == 1 {
            result += a
        }
        a <<= 1
        b >>= 1
    }
    
    return result
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    var a = a
    var b = b
    var result = 0
    
    while b > 0 {
        if b & 1 == 1 {
            result += a
        }
        a <<= 1
        b >>= 1
    }
    
    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 {
    var a = a
    var b = b
    var result = 0
    
    while b > 0 {
        if b & 1 == 1 {
            result += a
        }
        a <<= 1
        b >>= 1
    }
    
    return result
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            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 i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            count += 1
        }
    }
    return count
}
```
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly

func countUpper(s: String) -> Int {
    var count = 0
    for i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] == s.characters[i].uppercaseString {
            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 i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] == s.characters[i].uppercaseString {
            count += 1
        }
    }
    return count
}
```
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] == s.characters[i].uppercaseString { // value of type 'Character' has no member 'uppercaseString'

func countUpper(s: String) -> Int {
    let vowels = "aeiou"
    var count = 0
    for i in 0..<s.characters.count {
        if i % 2 == 0 && vowels.contains(s[i]) {
            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 {
    let vowels = "aeiou"
    var count = 0
    for i in 0..<s.characters.count {
        if i % 2 == 0 && vowels.contains(s[i]) {
            count += 1
        }
    }
    return count
}
```
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && vowels.contains(s[i]) { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func countUpper(s: String) -> Int {
    var count = 0
    for i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            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 i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            count += 1
        }
    }
    return count
}
```
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly

func countUpper(s: String) -> Int {
    var count = 0
    for i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            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 i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            count += 1
        }
    }
    return count
}
```
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly

func countUpper(s: String) -> Int {
    var count = 0
    for i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            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 i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            count += 1
        }
    }
    return count
}
```
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly

func countUpper(s: String) -> Int {
    var count = 0
    for i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] == s.characters[i].uppercaseString {
            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 i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] == s.characters[i].uppercaseString {
            count += 1
        }
    }
    return count
}
```
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] == s.characters[i].uppercaseString { // value of type 'Character' has no member 'uppercaseString'

func countUpper(s: String) -> Int {
    var count = 0
    for i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            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 i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            count += 1
        }
    }
    return count
}
```
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly

func countUpper(s: String) -> Int {
    var count = 0
    for i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            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 i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            count += 1
        }
    }
    return count
}
```
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly

func countUpper(s: String) -> Int {
    var count = 0
    for i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            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 i in 0..<s.characters.count {
        if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" {
            count += 1
        }
    }
    return count
}
```
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i % 2 == 0 && s.characters[i] >= "A" && s.characters[i] <= "Z" { // 'characters' is unavailable: Please use String directly

func closestInteger(value: String) -> Int {
    // TODO: implement closestInteger
}
```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 {
    // TODO: implement closestInteger
}
```
} // missing return in global function expected to return 'Int'

func closestInteger(value: String) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func closestInteger(value: String) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func closestInteger(value: String) -> Int {
    // TODO: Implement closestInteger
}
```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 {
    // TODO: Implement closestInteger
}
```
} // missing return in global function expected to return 'Int'

func closestInteger(value: String) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func closestInteger(value: String) -> Int {
    // TODO: implement closestInteger
    // Hint: use the Int(string:)-function
    return Int(value)
}
```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 {
    // TODO: implement closestInteger
    // Hint: use the Int(string:)-function
    return Int(value)
}
```
return Int(value) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func closestInteger(value: String) -> Int {
    // TODO: implement closestInteger
}
```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 {
    // TODO: implement closestInteger
}
```
} // missing return in global function expected to return 'Int'

func closestInteger(value: String) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func closestInteger(value: String) -> Int {
    // TODO: implement closestInteger
}
```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 {
    // TODO: implement closestInteger
}
```
} // missing return in global function expected to return 'Int'

func closestInteger(value: String) -> Int {
    // TODO:
    // 1. Convert the string to a double
    // 2. Round the double to the nearest integer
    // 3. Convert the integer to a string
    // 4. Convert the string to an integer
    // 5. Return the 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 {
    // TODO:
    // 1. Convert the string to a double
    // 2. Round the double to the nearest integer
    // 3. Convert the integer to a string
    // 4. Convert the string to an integer
    // 5. Return the integer
}
```
} // missing return in global function expected to return 'Int'

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var i = n
    while i > 0 {
        result.append(i)
        if i % 2 == 0 {
            i -= 2
        } else {
            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 = n
    while i > 0 {
        result.append(i)
        if i % 2 == 0 {
            i -= 2
        } else {
            i -= 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var pile = [Int]()
    var i = 1
    while i <= n {
        if i % 2 == 0 {
            pile.append(i + 1)
        } else {
            pile.append(i + 2)
        }
        i += 2
    }
    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]()
    var i = 1
    while i <= n {
        if i % 2 == 0 {
            pile.append(i + 1)
        } else {
            pile.append(i + 2)
        }
        i += 2
    }
    return pile
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var pile = [Int]()
    for i in 0..<n {
        if i % 2 == 0 {
            pile.append(i + 2)
        } else {
            pile.append(i + 1)
        }
    }
    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 0..<n {
        if i % 2 == 0 {
            pile.append(i + 2)
        } else {
            pile.append(i + 1)
        }
    }
    return pile
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var pile = [Int]()
    var nextLevel = n
    var nextLevelIsOdd = n % 2 == 1
    for _ in 1...n {
        if nextLevelIsOdd {
            nextLevel += 1
        } else {
            nextLevel += 2
        }
        pile.append(nextLevel)
        nextLevelIsOdd.toggle()
    }
    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]()
    var nextLevel = n
    var nextLevelIsOdd = n % 2 == 1
    for _ in 1...n {
        if nextLevelIsOdd {
            nextLevel += 1
        } else {
            nextLevel += 2
        }
        pile.append(nextLevel)
        nextLevelIsOdd.toggle()
    }
    return pile
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var pile = [Int]()
    for i in 0..<n {
        if i % 2 == 0 {
            pile.append(i + 2)
        } else {
            pile.append(i + 1)
        }
    }
    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 0..<n {
        if i % 2 == 0 {
            pile.append(i + 2)
        } else {
            pile.append(i + 1)
        }
    }
    return pile
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var pile = [Int]()
    var i = n
    while i > 0 {
        if i % 2 == 0 {
            pile.append(i + 1)
        } else {
            pile.append(i + 2)
        }
        i -= 1
    }
    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]()
    var i = n
    while i > 0 {
        if i % 2 == 0 {
            pile.append(i + 1)
        } else {
            pile.append(i + 2)
        }
        i -= 1
    }
    return pile
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var pile = [Int]()
    for i in 0...n {
        if i % 2 == 0 {
            pile.append(i + 1)
        } else {
            pile.append(i + 2)
        }
    }
    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 0...n {
        if i % 2 == 0 {
            pile.append(i + 1)
        } else {
            pile.append(i + 2)
        }
    }
    return pile
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var pile = [Int]()
    var i = 1
    while i <= n {
        pile.append(i)
        if i % 2 == 0 {
            i += 2
        } else {
            i += 1
        }
    }
    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]()
    var i = 1
    while i <= n {
        pile.append(i)
        if i % 2 == 0 {
            i += 2
        } else {
            i += 1
        }
    }
    return pile
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var pile = [Int]()
    for i in 0..<n {
        if i % 2 == 0 {
            pile.append(i + 2)
        } else {
            pile.append(i + 1)
        }
    }
    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 0..<n {
        if i % 2 == 0 {
            pile.append(i + 2)
        } else {
            pile.append(i + 1)
        }
    }
    return pile
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    var pile = [Int]()
    for i in 0..<n {
        if i % 2 == 0 {
            pile.append(i + 2)
        } else {
            pile.append(i + 1)
        }
    }
    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 0..<n {
        if i % 2 == 0 {
            pile.append(i + 2)
        } else {
            pile.append(i + 1)
        }
    }
    return pile
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ",,")
}
```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: ",,")
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ",")
}
```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: ",")
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ",")
}
```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: ",")
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    // TODO: Split the string into words and return an array of the words
}
```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] {
    // TODO: Split the string into words and return an array of the words
}
```
} // missing return in global function expected to return '[String]'

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ",")
}
```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: ",")
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ",")
}
```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: ",")
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ",")
}
```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: ",")
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ",")
}
```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: ",")
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ",")
}
```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: ",")
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ", ")
}
```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: ", ")
}
```
 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    let max = max(x, y)
    let min = min(x, y)
    
    for i in min...max {
        if i % 2 == 0 {
            return i
        }
    }
    return -1
}
```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 {
    let max = max(x, y)
    let min = min(x, y)
    
    for i in min...max {
        if i % 2 == 0 {
            return i
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    // TODO: Implement this function
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if y % 2 == 0 && y >= x {
        result = y
    }
    return result
}
```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 {
    // TODO: Implement this function
    var result = -1
    if x % 2 == 0 && x >= y {
        result = x
    } else if y % 2 == 0 && y >= x {
        result = y
    }
    return result
}
```
 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // TODO: implement this function
}
```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 {
    // TODO: implement this function
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    var result: Int = -1
    if x % 2 == 0 && x <= y {
        result = x
    } else if y % 2 == 0 && x >= y {
        result = y
    }
    return result
}
```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 {
    var result: Int = -1
    if x % 2 == 0 && x <= y {
        result = x
    } else if y % 2 == 0 && x >= y {
        result = y
    }
    return result
}
```
 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    let min = min(x, y)
    let max = max(x, y)
    
    for i in min...max {
        if i % 2 == 0 {
            return i
        }
    }
    
    return -1
}
```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 {
    let min = min(x, y)
    let max = max(x, y)
    
    for i in min...max {
        if i % 2 == 0 {
            return i
        }
    }
    
    return -1
}
```
 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    var result = -1
    for i in x...y {
        if i % 2 == 0 {
            result = i
            break
        }
    }
    return result
}
```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 {
    var result = -1
    for i in x...y {
        if i % 2 == 0 {
            result = i
            break
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    var result: Int = -1
    for i in x...y {
        if i % 2 == 0 {
            result = i
            break
        }
    }
    return result
}
```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 {
    var result: Int = -1
    for i in x...y {
        if i % 2 == 0 {
            result = i
            break
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    var max: Int = -1
    for i in x...y {
        if i % 2 == 0 {
            max = i
        }
    }
    return max
}
```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 {
    var max: Int = -1
    for i in x...y {
        if i % 2 == 0 {
            max = i
        }
    }
    return max
}
```
 // Fatal error: Range requires lowerBound <= upperBound

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 sum = (n + m) / 2
    let binary = String(format: "%b", sum)
    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 sum = (n + m) / 2
    let binary = String(format: "%b", sum)
    return.success(binary)
}
```
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 roundedAvg = avg.rounded
    let binary = String(format: "%b", roundedAvg)
    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 avg = (n + m) / 2
    let roundedAvg = avg.rounded
    let binary = String(format: "%b", roundedAvg)
    return.success(binary)
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let roundedAvg = avg.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 sum = (n + m) / 2
    let result = String(format: "%b", sum)
    return.success(result)
}
```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 sum = (n + m) / 2
    let result = String(format: "%b", sum)
    return.success(result)
}
```
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 roundedAvg = avg.rounded
    let binary = String(format: "%b", roundedAvg)
    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 avg = (n + m) / 2
    let roundedAvg = avg.rounded
    let binary = String(format: "%b", roundedAvg)
    return.success(binary)
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let roundedAvg = avg.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(format: "%b", avg))
}
```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(format: "%b", avg))
}
```
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 roundedAvg = avg.rounded
    let binary = String(format: "%b", roundedAvg)
    
    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 avg = (n + m) / 2
    let roundedAvg = avg.rounded
    let binary = String(format: "%b", roundedAvg)
    
    return.success(binary)
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let roundedAvg = avg.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
    let roundedAvg = Int(avg.rounded())
    
    return.success(String(format: "0b%b", roundedAvg))
}
```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 roundedAvg = Int(avg.rounded())
    
    return.success(String(format: "0b%b", roundedAvg))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let roundedAvg = Int(avg.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
    let rounded = avg.rounded
    let binary = String(format: "%b", rounded)
    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 avg = (n + m) / 2
    let rounded = avg.rounded
    let binary = String(format: "%b", rounded)
    return.success(binary)
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let rounded = avg.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 sum = (n + m) / 2
    let binary = String(format: "%b", sum)
    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 sum = (n + m) / 2
    let binary = String(format: "%b", sum)
    return.success(binary)
}
```
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 roundedAverage = Int(round(Double(average)))
    let binary = String(format: "%b", roundedAverage)
    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 roundedAverage = Int(round(Double(average)))
    let binary = String(format: "%b", roundedAverage)
    return.success(binary)
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        var temp = i
        var isEven = false
        while temp > 0 {
            if temp % 10 == 0 {
                isEven = true
                break
            }
            temp = temp / 10
        }
        if!isEven {
            result.append(i)
        }
    }
    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 i in x {
        var temp = i
        var isEven = false
        while temp > 0 {
            if temp % 10 == 0 {
                isEven = true
                break
            }
            temp = temp / 10
        }
        if!isEven {
            result.append(i)
        }
    }
    return result
}
```
if!isEven { // expected expression, var, or let in 'if' condition

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        var temp = i
        var isEven = false
        while temp > 0 {
            if temp % 2 == 0 {
                isEven = true
                break
            }
            temp = temp / 10
        }
        if!isEven {
            result.append(i)
        }
    }
    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 i in x {
        var temp = i
        var isEven = false
        while temp > 0 {
            if temp % 2 == 0 {
                isEven = true
                break
            }
            temp = temp / 10
        }
        if!isEven {
            result.append(i)
        }
    }
    return result
}
```
if!isEven { // expected expression, var, or let in 'if' condition

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        var temp = i
        var isEven = false
        while temp > 0 {
            let digit = temp % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            temp = temp / 10
        }
        if!isEven {
            result.append(i)
        }
    }
    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 i in x {
        var temp = i
        var isEven = false
        while temp > 0 {
            let digit = temp % 10
            if digit % 2 == 0 {
                isEven = true
                break
            }
            temp = temp / 10
        }
        if!isEven {
            result.append(i)
        }
    }
    return result
}
```
if!isEven { // expected expression, var, or let in 'if' condition

func uniqueDigits(x: [Int]) -> [Int] {
    var result: [Int] = []
    for i in x {
        var temp = i
        var isEven = false
        while temp > 0 {
            if temp % 10 == 0 {
                isEven = true
                break
            }
            temp = temp / 10
        }
        if!isEven {
            result.append(i)
        }
    }
    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 i in x {
        var temp = i
        var isEven = false
        while temp > 0 {
            if temp % 10 == 0 {
                isEven = true
                break
            }
            temp = temp / 10
        }
        if!isEven {
            result.append(i)
        }
    }
    return result
}
```
if!isEven { // expected expression, var, or let in 'if' condition

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        if i % 2!= 0 {
            result.append(i)
        }
    }
    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 i in x {
        if i % 2!= 0 {
            result.append(i)
        }
    }
    return result
}
```
if i % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if i % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if i % 2!= 0 { // '=' must have consistent whitespace on both sides

func uniqueDigits(x: [Int]) -> [Int] {
    var result: [Int] = []
    for i in x {
        if i % 2!= 0 {
            result.append(i)
        }
    }
    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 {
        if i % 2!= 0 {
            result.append(i)
        }
    }
    return result.sorted()
}
```
if i % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if i % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if i % 2!= 0 { // '=' must have consistent whitespace on both sides

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        var temp = i
        var isEven = false
        while temp > 0 {
            if temp % 10 == 0 {
                isEven = true
                break
            }
            temp = temp / 10
        }
        if!isEven {
            result.append(i)
        }
    }
    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 i in x {
        var temp = i
        var isEven = false
        while temp > 0 {
            if temp % 10 == 0 {
                isEven = true
                break
            }
            temp = temp / 10
        }
        if!isEven {
            result.append(i)
        }
    }
    return result
}
```
if!isEven { // expected expression, var, or let in 'if' condition

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        if i % 2!= 0 {
            result.append(i)
        }
    }
    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 i in x {
        if i % 2!= 0 {
            result.append(i)
        }
    }
    return result
}
```
if i % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if i % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if i % 2!= 0 { // '=' must have consistent whitespace on both sides

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        var temp = i
        var isEven = false
        while temp > 0 {
            if temp % 2 == 0 {
                isEven = true
                break
            }
            temp = temp / 10
        }
        if!isEven {
            result.append(i)
        }
    }
    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 i in x {
        var temp = i
        var isEven = false
        while temp > 0 {
            if temp % 2 == 0 {
                isEven = true
                break
            }
            temp = temp / 10
        }
        if!isEven {
            result.append(i)
        }
    }
    return result
}
```
if!isEven { // expected expression, var, or let in 'if' condition

func uniqueDigits(x: [Int]) -> [Int] {
    var result: [Int] = []
    for i in x {
        var temp: Int = i
        while temp > 0 {
            if temp % 2 == 1 {
                result.append(temp)
                break
            }
            temp = 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: Int = i
        while temp > 0 {
            if temp % 2 == 1 {
                result.append(temp)
                break
            }
            temp = temp / 10
        }
    }
    return result.sorted()
}
```
 // XCTAssertTrue failed

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var sorted = arr.sort()
    var reversed = sorted.reverse()
    for i in 0..<reversed.count {
        if reversed[i] >= 1 && reversed[i] <= 9 {
            result.append(names[reversed[i] - 1])
        }
    }
    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 sorted = arr.sort()
    var reversed = sorted.reverse()
    for i in 0..<reversed.count {
        if reversed[i] >= 1 && reversed[i] <= 9 {
            result.append(names[reversed[i] - 1])
        }
    }
    return result
}
```
var sorted = arr.sort() // cannot use mutating member on immutable value: 'arr' is a 'let' constant

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    
    // Sort the array
    arr.sort()
    
    // Reverse the array
    arr.reverse()
    
    // Iterate over the array
    for i in 0..<arr.count {
        // Get the number
        let number = arr[i]
        
        // Check if the number is between 1 and 9
        if number >= 1 && number <= 9 {
            // Get the name of the number
            let name = names[number]
            
            // Add the name to the result
            result.append(name)
        }
    }
    
    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]()
    
    // Sort the array
    arr.sort()
    
    // Reverse the array
    arr.reverse()
    
    // Iterate over the array
    for i in 0..<arr.count {
        // Get the number
        let number = arr[i]
        
        // Check if the number is between 1 and 9
        if number >= 1 && number <= 9 {
            // Get the name of the number
            let name = names[number]
            
            // Add the name to the result
            result.append(name)
        }
    }
    
    return result
}
```
arr.sort() // cannot use mutating member on immutable value: 'arr' is a 'let' constant
arr.reverse() // cannot use mutating member on immutable value: 'arr' is a 'let' constant
let name = names[number] // cannot find 'names' in scope

func byLength(arr: [Int]) -> [String] {
    // 1. Write your solution here
    var result = [String]()
    
    for i in 0..<arr.count {
        if arr[i] >= 1 && arr[i] <= 9 {
            result.append(String(format: "%@", arr[i]))
        }
    }
    
    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] {
    // 1. Write your solution here
    var result = [String]()
    
    for i in 0..<arr.count {
        if arr[i] >= 1 && arr[i] <= 9 {
            result.append(String(format: "%@", arr[i]))
        }
    }
    
    return result.reversed()
}
```

func byLength(arr: [Int]) -> [String] {
    let sorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    let reversed = sorted.reversed()
    let result = reversed.map {
        switch $0 {
        case 1: return "One"
        case 2: return "Two"
        case 3: return "Three"
        case 4: return "Four"
        case 5: return "Five"
        case 6: return "Six"
        case 7: return "Seven"
        case 8: return "Eight"
        case 9: return "Nine"
        default: return ""
        }
    }
    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] {
    let sorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    let reversed = sorted.reversed()
    let result = reversed.map {
        switch $0 {
        case 1: return "One"
        case 2: return "Two"
        case 3: return "Three"
        case 4: return "Four"
        case 5: return "Five"
        case 6: return "Six"
        case 7: return "Seven"
        case 8: return "Eight"
        case 9: return "Nine"
        default: return ""
        }
    }
    return result
}
```

func byLength(arr: [Int]) -> [String] {
    let sorted = arr.sorted()
    let between = sorted.filter { $0 >= 1 && $0 <= 9 }
    let reversed = between.reversed()
    let names = reversed.map {
        switch $0 {
        case 1: return "One"
        case 2: return "Two"
        case 3: return "Three"
        case 4: return "Four"
        case 5: return "Five"
        case 6: return "Six"
        case 7: return "Seven"
        case 8: return "Eight"
        case 9: return "Nine"
        default: return ""
        }
    }
    return names
}
```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 sorted = arr.sorted()
    let between = sorted.filter { $0 >= 1 && $0 <= 9 }
    let reversed = between.reversed()
    let names = reversed.map {
        switch $0 {
        case 1: return "One"
        case 2: return "Two"
        case 3: return "Three"
        case 4: return "Four"
        case 5: return "Five"
        case 6: return "Six"
        case 7: return "Seven"
        case 8: return "Eight"
        case 9: return "Nine"
        default: return ""
        }
    }
    return names
}
```

func byLength(arr: [Int]) -> [String] {
    let sorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    let reversed = sorted.reversed()
    let result = reversed.map {
        switch $0 {
        case 1: return "One"
        case 2: return "Two"
        case 3: return "Three"
        case 4: return "Four"
        case 5: return "Five"
        case 6: return "Six"
        case 7: return "Seven"
        case 8: return "Eight"
        case 9: return "Nine"
        default: return ""
        }
    }
    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] {
    let sorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    let reversed = sorted.reversed()
    let result = reversed.map {
        switch $0 {
        case 1: return "One"
        case 2: return "Two"
        case 3: return "Three"
        case 4: return "Four"
        case 5: return "Five"
        case 6: return "Six"
        case 7: return "Seven"
        case 8: return "Eight"
        case 9: return "Nine"
        default: return ""
        }
    }
    return result
}
```

func byLength(arr: [Int]) -> [String] {
    let sorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    let reversed = sorted.reversed()
    let result = reversed.map {
        switch $0 {
        case 1: return "One"
        case 2: return "Two"
        case 3: return "Three"
        case 4: return "Four"
        case 5: return "Five"
        case 6: return "Six"
        case 7: return "Seven"
        case 8: return "Eight"
        case 9: return "Nine"
        default: return ""
        }
    }
    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] {
    let sorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    let reversed = sorted.reversed()
    let result = reversed.map {
        switch $0 {
        case 1: return "One"
        case 2: return "Two"
        case 3: return "Three"
        case 4: return "Four"
        case 5: return "Five"
        case 6: return "Six"
        case 7: return "Seven"
        case 8: return "Eight"
        case 9: return "Nine"
        default: return ""
        }
    }
    return result
}
```

func byLength(arr: [Int]) -> [String] {
    let sorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    let reversed = sorted.reversed()
    return reversed.map {
        switch $0 {
        case 1: return "One"
        case 2: return "Two"
        case 3: return "Three"
        case 4: return "Four"
        case 5: return "Five"
        case 6: return "Six"
        case 7: return "Seven"
        case 8: return "Eight"
        case 9: return "Nine"
        default: return ""
        }
    }
}
```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 sorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    let reversed = sorted.reversed()
    return reversed.map {
        switch $0 {
        case 1: return "One"
        case 2: return "Two"
        case 3: return "Three"
        case 4: return "Four"
        case 5: return "Five"
        case 6: return "Six"
        case 7: return "Seven"
        case 8: return "Eight"
        case 9: return "Nine"
        default: return ""
        }
    }
}
```

func byLength(arr: [Int]) -> [String] {
    let sorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    let reversed = sorted.reversed()
    let names = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"]
    return reversed.map { names[$0 - 1] }
}
```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 sorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    let reversed = sorted.reversed()
    let names = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"]
    return reversed.map { names[$0 - 1] }
}
```

func byLength(arr: [Int]) -> [String] {
    let sorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    let reversed = sorted.reversed()
    return reversed.map {
        switch $0 {
        case 1: return "One"
        case 2: return "Two"
        case 3: return "Three"
        case 4: return "Four"
        case 5: return "Five"
        case 6: return "Six"
        case 7: return "Seven"
        case 8: return "Eight"
        case 9: return "Nine"
        default: return ""
        }
    }
}
```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 sorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    let reversed = sorted.reversed()
    return reversed.map {
        switch $0 {
        case 1: return "One"
        case 2: return "Two"
        case 3: return "Three"
        case 4: return "Four"
        case 5: return "Five"
        case 6: return "Six"
        case 7: return "Seven"
        case 8: return "Eight"
        case 9: return "Nine"
        default: return ""
        }
    }
}
```

func f(n: Int) -> [Int] {
    // TODO: implement me
}
```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] {
    // TODO: implement me
}
```
} // missing return in global function expected to return '[Int]'

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
}
```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
}
```
result.append(factorial(i)) // cannot find 'factorial' in scope
result.append(sum(1...i)) // cannot find 'sum' in scope

func f(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        if i % 2 == 0 {
            result.append(factorial(i))
        } else {
            result.append(sumOfNumbers(from: 1, to: 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]()
    for i in 1...n {
        if i % 2 == 0 {
            result.append(factorial(i))
        } else {
            result.append(sumOfNumbers(from: 1, to: i))
        }
    }
    return result
}
```
result.append(factorial(i)) // cannot find 'factorial' in scope
result.append(sumOfNumbers(from: 1, to: i)) // cannot find 'sumOfNumbers' in scope

func f(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        if i % 2 == 0 {
            result.append(factorial(of: i))
        } else {
            result.append(sum(1...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]()
    for i in 1...n {
        if i % 2 == 0 {
            result.append(factorial(of: i))
        } else {
            result.append(sum(1...i))
        }
    }
    return result
}
```
result.append(factorial(of: i)) // cannot find 'factorial' in scope
result.append(sum(1...i)) // cannot find 'sum' in scope

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
}
```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
}
```
result.append(factorial(i)) // cannot find 'factorial' in scope
result.append(sum(1...i)) // cannot find 'sum' in scope

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
}
```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
}
```
result.append(factorial(i)) // cannot find 'factorial' in scope
result.append(sum(1...i)) // cannot find 'sum' in scope

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
}
```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
}
```
result.append(factorial(i)) // cannot find 'factorial' in scope
result.append(sum(1...i)) // cannot find 'sum' in scope

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
}
```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
}
```
result.append(factorial(i)) // cannot find 'factorial' in scope
result.append(sum(1...i)) // cannot find 'sum' in scope

func f(n: Int) -> [Int] {
    // TODO: implement me
}
```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] {
    // TODO: implement me
}
```
} // missing return in global function expected to return '[Int]'

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
}
```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
}
```
result.append(factorial(i)) // cannot find 'factorial' in scope
result.append(sum(1...i)) // cannot find 'sum' in scope

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var odd = 0
    var even = 0
    for i in 1...n {
        let s = String(i)
        if s == s.reverse() {
            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 odd = 0
    var even = 0
    for i in 1...n {
        let s = String(i)
        if s == s.reverse() {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}
```
if s == s.reverse() { // value of type 'String' has no member 'reverse'

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)
}
```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)
}
```
if isPalindrome(i) { // cannot find 'isPalindrome' in scope

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        var s = String(i)
        var isPalindrome = true
        for j in 0..<s.characters.count/2 {
            if s[j]!= s[s.characters.count-j-1] {
                isPalindrome = false
                break
            }
        }
        if isPalindrome {
            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 {
        var s = String(i)
        var isPalindrome = true
        for j in 0..<s.characters.count/2 {
            if s[j]!= s[s.characters.count-j-1] {
                isPalindrome = false
                break
            }
        }
        if isPalindrome {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}
```
for j in 0..<s.characters.count/2 { // 'characters' is unavailable: Please use String directly
if s[j]!= s[s.characters.count-j-1] { // use of '=' in a boolean context, did you mean '=='?
if s[j]!= s[s.characters.count-j-1] { // cannot force unwrap value of non-optional type 'Character'
if s[j]!= s[s.characters.count-j-1] { // '=' must have consistent whitespace on both sides

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        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 % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
    }
    return (even, odd)
}
```
 // XCTAssertTrue failed

func evenOddPalindrome(n: Int) -> (Int, Int) {
    // TODO: Implement me
}
```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) {
    // TODO: Implement me
}
```
} // missing return in global function expected to return '(Int, Int)'

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        let s = String(i)
        if s == s.reverse() {
            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.reverse() {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}
```
if s == s.reverse() { // value of type 'String' has no member 'reverse'

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 oddNumbers(n: Int) -> Int {
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if i % 2!= 0 {
                odd += 1
            }
        }
    }
    return 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 isPalindrome(i) {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

// Given a positive integer n, return the number of odd integers that fall
// within the range(1, n), inclusive.
// Example 1:
// Explanation:
// The odd integers are 1, 3, 5, 7, 9, 11, 13, 15, 17, 19.
// Example 2:
// Explanation:
// The odd integers are 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59.
// Note:
// 1. 1 <= n <= 10^6
// 2. returned integer has the number of odd integers that fall within the range(1, n), inclusive.
// oddNumbers(n: 3) == 1
// oddNumbers(n: 12) == 6
func oddNumbers(n: Int) -> Int {
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if i % 2!= 0 {
                odd += 1
            }
        }
    }
    return odd
}

// Given a positive integer n, return the number of odd integers that fall
// within the range(1, n), inclusive.
// Example 1:
// Explanation:
// The odd integers are 1, 3, 5, 7, 9, 11, 13, 15, 17, 19.
// Example 2:
// Explanation:
// The odd integers are 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59.
// Note:
// 1. 1 <= n <= 10^6
// 2. returned integer has the number of odd integers that fall within the range(1, n), inclusive.
// oddNumbers(n: 3) == 1
// oddNumbers(n: 12) == 6
func oddNumbers(n: Int) -> Int {
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if i % 2!= 0 {
                odd += 1
            }
        }
    }
    return odd
}

// Given a positive integer n, return the number of odd integers that fall
// within the range(1, n), inclusive.
// Example 1:
// Explanation:
// The odd integers are 1, 3, 5, 7, 9, 11, 13, 15, 17, 19.
// Example 2:
// Explanation:
// The odd integers are 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59.
// Note:
// 1. 1 <= n <= 10^6
// 2. returned integer has the number of odd integers that fall within the range(1, n), inclusive.
// oddNumbers(n: 3) == 1
// oddNumbers(n: 12) == 6
func oddNumbers(n: Int) -> Int {
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if i % 2!= 0 {
                odd += 1
            }
        }
    }
    return odd
}

// Given a positive integer n, return the number of odd integers that fall
// within the range(1, n), inclusive.
// Example 1:
// Explanation:
// The odd integers are 1, 3, 5, 7, 9, 11, 13, 15, 17, 19.
// Example 2:
// Explanation:
// The odd integers are 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59.
if isPalindrome(i) { // cannot find 'isPalindrome' in scope
if isPalindrome(i) { // cannot find 'isPalindrome' in scope
if i % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if i % 2!= 0 { // '=' must have consistent whitespace on both sides
if i % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        let s = String(i)
        if s == s.reverse() {
            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.reverse() {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}
```
if s == s.reverse() { // value of type 'String' has no member 'reverse'

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        let s = String(i)
        var isPalindrome = true
        for j in 0..<s.characters.count/2 {
            if s[j]!= s[s.characters.count-j-1] {
                isPalindrome = false
                break
            }
        }
        if isPalindrome {
            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)
        var isPalindrome = true
        for j in 0..<s.characters.count/2 {
            if s[j]!= s[s.characters.count-j-1] {
                isPalindrome = false
                break
            }
        }
        if isPalindrome {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}
```
for j in 0..<s.characters.count/2 { // 'characters' is unavailable: Please use String directly
if s[j]!= s[s.characters.count-j-1] { // use of '=' in a boolean context, did you mean '=='?
if s[j]!= s[s.characters.count-j-1] { // cannot force unwrap value of non-optional type 'Character'
if s[j]!= s[s.characters.count-j-1] { // '=' must have consistent whitespace on both sides

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        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 % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
    }
    return (even, odd)
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        for digit in num.abs().digits() {
            sum += digit
        }
        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
        for digit in num.abs().digits() {
            sum += digit
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
for digit in num.abs().digits() { // value of type 'Int' has no member 'abs'

func countNums(arr: [Int]) -> Int {
    var count = 0
    for i in 0..<arr.count {
        var sum = 0
        for j in 0..<arr[i].count {
            sum += arr[i][j]
        }
        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 i in 0..<arr.count {
        var sum = 0
        for j in 0..<arr[i].count {
            sum += arr[i][j]
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
for j in 0..<arr[i].count { // no exact matches in call to subscript

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        for digit in String(num).characters {
            sum += Int(digit) - 48
        }
        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
        for digit in String(num).characters {
            sum += Int(digit) - 48
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
for digit in String(num).characters { // 'characters' is unavailable: Please use String directly
sum += Int(digit) - 48 // no exact matches in call to initializer

func countNums(arr: [Int]) -> Int {
    var count = 0
    for i in 0..<arr.count {
        var sum = 0
        for j in 0..<arr[i].count {
            sum += arr[i][j]
        }
        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 i in 0..<arr.count {
        var sum = 0
        for j in 0..<arr[i].count {
            sum += arr[i][j]
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
for j in 0..<arr[i].count { // no exact matches in call to subscript

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        let digits = num.abs().digits()
        if digits.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 {
        let digits = num.abs().digits()
        if digits.sum() > 0 {
            count += 1
        }
    }
    return count
}
```
let digits = num.abs().digits() // value of type 'Int' has no member 'abs'

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        let sum = num.abs().reduce(0, combine: +)
        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 {
        let sum = num.abs().reduce(0, combine: +)
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
let sum = num.abs().reduce(0, combine: +) // value of type 'Int' has no member 'abs'

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 {
        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
        for digit in String(num).characters {
            sum += Int(digit) - Int("0")
        }
        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
        for digit in String(num).characters {
            sum += Int(digit) - Int("0")
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
for digit in String(num).characters { // 'characters' is unavailable: Please use String directly
sum += Int(digit) - Int("0") // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
sum += Int(digit) - Int("0") // no exact matches in call to initializer

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        var sum = 0
        for digit in String(num).characters {
            sum += Int(digit) - Int("0")
        }
        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
        for digit in String(num).characters {
            sum += Int(digit) - Int("0")
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
for digit in String(num).characters { // 'characters' is unavailable: Please use String directly
sum += Int(digit) - Int("0") // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
sum += Int(digit) - Int("0") // no exact matches in call to initializer

func moveOneBall(arr: [Int]) -> Bool {
    var i = 0
    var j = arr.count - 1
    var count = 0
    while i < j {
        if arr[i] < arr[j] {
            i += 1
        } else {
            arr.swapAt(i, j)
            count += 1
        }
    }
    return count % 2 == 0
}
```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 i = 0
    var j = arr.count - 1
    var count = 0
    while i < j {
        if arr[i] < arr[j] {
            i += 1
        } else {
            arr.swapAt(i, j)
            count += 1
        }
    }
    return count % 2 == 0
}
```
arr.swapAt(i, j) // cannot use mutating member on immutable value: 'arr' is a 'let' constant

func moveOneBall(arr: [Int]) -> Bool {
    var count = 0
    for i in 0..<arr.count {
        if arr[i] > arr[i+1] {
            count += 1
        }
    }
    return count == 0
}
```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 count = 0
    for i in 0..<arr.count {
        if arr[i] > arr[i+1] {
            count += 1
        }
    }
    return count == 0
}
```
 // Fatal error: Index out of range

func moveOneBall(arr: [Int]) -> Bool {
    // Write your code here
    var count = 0
    for i in 0..<arr.count {
        if arr[i] < arr[i+1] {
            count += 1
        }
    }
    return count == 0
}
```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 {
    // Write your code here
    var count = 0
    for i in 0..<arr.count {
        if arr[i] < arr[i+1] {
            count += 1
        }
    }
    return count == 0
}
```
 // Fatal error: Index out of range

func moveOneBall(arr: [Int]) -> Bool {
    var count = 0
    var i = 0
    while i < arr.count {
        if arr[i] > arr[i+1] {
            arr.swapAt(i, i+1)
            count += 1
        }
        i += 1
    }
    return count == 0
}
```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 count = 0
    var i = 0
    while i < arr.count {
        if arr[i] > arr[i+1] {
            arr.swapAt(i, i+1)
            count += 1
        }
        i += 1
    }
    return count == 0
}
```
arr.swapAt(i, i+1) // cannot use mutating member on immutable value: 'arr' is a 'let' constant

func moveOneBall(arr: [Int]) -> Bool {
    var count = 0
    for i in 0..<arr.count {
        if arr[i] > arr[i+1] {
            count += 1
        }
    }
    return count == 0
}
```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 count = 0
    for i in 0..<arr.count {
        if arr[i] > arr[i+1] {
            count += 1
        }
    }
    return count == 0
}
```
 // Fatal error: Index out of range

func moveOneBall(arr: [Int]) -> Bool {
    // Write your code here
    var count = 0
    for i in 0..<arr.count {
        if arr[i] > arr[i+1] {
            count += 1
        }
    }
    return count == 0
}
```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 {
    // Write your code here
    var count = 0
    for i in 0..<arr.count {
        if arr[i] > arr[i+1] {
            count += 1
        }
    }
    return count == 0
}
```
 // Fatal error: Index out of range

func moveOneBall(arr: [Int]) -> Bool {
    var count = 0
    for i in 0..<arr.count {
        if arr[i] > arr[i+1] {
            count += 1
        }
    }
    return count == 0
}
```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 count = 0
    for i in 0..<arr.count {
        if arr[i] > arr[i+1] {
            count += 1
        }
    }
    return count == 0
}
```
 // Fatal error: Index out of range

func moveOneBall(arr: [Int]) -> Bool {
    // Write your code here
    if arr.count == 0 {
        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: i)
            return false
        }
        i += 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 {
    // Write your code here
    if arr.count == 0 {
        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: i)
            return false
        }
        i += 1
    }
    return true
}
```
 // XCTAssertTrue failed

func moveOneBall(arr: [Int]) -> Bool {
    // Write your code here
    var count = 0
    for i in 0..<arr.count {
        if arr[i] > arr[i+1] {
            count += 1
        }
    }
    return 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 {
    // Write your code here
    var count = 0
    for i in 0..<arr.count {
        if arr[i] > arr[i+1] {
            count += 1
        }
    }
    return count <= 1
}
```
 // Fatal error: Index out of range

func moveOneBall(arr: [Int]) -> Bool {
    // Write your code here
    // return true if the array is sorted in non-decreasing order
    // return false otherwise
    
    var sorted = false
    
    for i in 0..<arr.count-1 {
        if arr[i] > arr[i+1] {
            sorted = false
            break
        }
        sorted = true
    }
    
    return 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 {
    // Write your code here
    // return true if the array is sorted in non-decreasing order
    // return false otherwise
    
    var sorted = false
    
    for i in 0..<arr.count-1 {
        if arr[i] > arr[i+1] {
            sorted = false
            break
        }
        sorted = true
    }
    
    return sorted
}
```
 // XCTAssertTrue failed

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1Even = true
    var lst2Even = true
    for i in 0..<lst1.count {
        if lst1[i] % 2!= 0 {
            lst1Even = false
        }
        if lst2[i] % 2!= 0 {
            lst2Even = false
        }
    }
    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 {
    var lst1Even = true
    var lst2Even = true
    for i in 0..<lst1.count {
        if lst1[i] % 2!= 0 {
            lst1Even = false
        }
        if lst2[i] % 2!= 0 {
            lst2Even = false
        }
    }
    if lst1Even && lst2Even {
        return "YES"
    } else {
        return "NO"
    }
}
```
if lst1[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if lst1[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if lst1[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if lst1[i] % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if lst2[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if lst2[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if lst2[i] % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if lst2[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // TODO: implement me
}
```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: implement me
}
```
} // missing return in global function expected to return 'String'

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1_even = true
    var lst2_even = true
    for i in 0..<lst1.count {
        if lst1[i] % 2!= 0 {
            lst1_even = false
        }
        if lst2[i] % 2!= 0 {
            lst2_even = false
        }
    }
    if lst1_even && lst2_even {
        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_even = true
    var lst2_even = true
    for i in 0..<lst1.count {
        if lst1[i] % 2!= 0 {
            lst1_even = false
        }
        if lst2[i] % 2!= 0 {
            lst2_even = false
        }
    }
    if lst1_even && lst2_even {
        return "YES"
    } else {
        return "NO"
    }
}
```
if lst1[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if lst1[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if lst1[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if lst1[i] % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if lst2[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if lst2[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if lst2[i] % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if lst2[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?

```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: implement this function
    // Hint: use a for loop to iterate over the elements of lst1 and lst2
    // and check if the element is even.
    // If the element is even, you can exchange it with the corresponding element
    // in lst2.
    // If the element is odd, you cannot exchange it with the corresponding element
    // in lst2.
    // You can use the swap function to exchange elements in lst1 and lst2.
    // For example:
    // swap(&lst1[i], &lst2[i])
    // Note that you cannot use the swap function in the for loop.
    // You can use the swap function in the function body.
    // If you cannot find a way to exchange elements between lst1 and lst2,
    // return "NO".
    // If you can find a way to exchange elements between lst1 and lst2,
    // return "YES".
    // Note that you cannot use the swap function in the return statement.
    // You can use the swap function in the function body.
    // You can use the if statement to check if the elements in lst1 are all even.
    // If the elements in lst1 are all even, return "YES".
    // Otherwise, return "NO".
    // Note that you cannot use the if statement in the for loop.
    // You can use the if statement in the function body.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You can use the for loop to iterate over the elements of lst1 and lst2.
    // You
XCTAssertTrue(exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [1, 2, 3, 4], lst2: [2, 1, 4, 3]) == "YES") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [5, 7, 3], lst2: [2, 6, 4]) == "YES") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [5, 7, 3], lst2: [2, 6, 3]) == "NO") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [3, 2, 6, 1, 8, 9], lst2: [3, 5, 5, 1, 1, 1]) == "NO") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [100, 200], lst2: [200, 200]) == "YES") // cannot find 'exchange' in scope

```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: Implement this function
    // Hint: Use the filter() function
    // Hint: Use the zip() function
    // Hint: Use the reduce() function
    // Hint: Use the map() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    // Hint: Use the reduce() function
    //
XCTAssertTrue(exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [1, 2, 3, 4], lst2: [2, 1, 4, 3]) == "YES") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [5, 7, 3], lst2: [2, 6, 4]) == "YES") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [5, 7, 3], lst2: [2, 6, 3]) == "NO") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [3, 2, 6, 1, 8, 9], lst2: [3, 5, 5, 1, 1, 1]) == "NO") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [100, 200], lst2: [200, 200]) == "YES") // cannot find 'exchange' in scope

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var result = "NO"
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            lst2[i] = lst1[i]
            lst1[i] = 0
        }
    }
    for i in 0..<lst2.count {
        if lst2[i] % 2!= 0 {
            lst1[i] = lst2[i]
            lst2[i] = 0
        }
    }
    for i in 0..<lst1.count {
        if lst1[i] % 2!= 0 {
            result = "NO"
            break
        }
    }
    return result
}
```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 result = "NO"
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            lst2[i] = lst1[i]
            lst1[i] = 0
        }
    }
    for i in 0..<lst2.count {
        if lst2[i] % 2!= 0 {
            lst1[i] = lst2[i]
            lst2[i] = 0
        }
    }
    for i in 0..<lst1.count {
        if lst1[i] % 2!= 0 {
            result = "NO"
            break
        }
    }
    return result
}
```
if lst2[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if lst2[i] % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if lst2[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if lst2[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if lst1[i] % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if lst1[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if lst1[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if lst1[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?

```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: implement this function
    // You can use the following function to check if an integer is even:
    // isEven(x: Int) -> Bool
    // You can use the following function to check if an integer is odd:
    // isOdd(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 2:
    // isDivisibleBy2(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 3:
    // isDivisibleBy3(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 4:
    // isDivisibleBy4(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 5:
    // isDivisibleBy5(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 6:
    // isDivisibleBy6(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 7:
    // isDivisibleBy7(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 8:
    // isDivisibleBy8(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 9:
    // isDivisibleBy9(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 10:
    // isDivisibleBy10(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 11:
    // isDivisibleBy11(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 12:
    // isDivisibleBy12(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 13:
    // isDivisibleBy13(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 14:
    // isDivisibleBy14(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 15:
    // isDivisibleBy15(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 16:
    // isDivisibleBy16(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 17:
    // isDivisibleBy17(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 18:
    // isDivisibleBy18(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 19:
    // isDivisibleBy19(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 20:
    // isDivisibleBy20(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 21:
    // isDivisibleBy21(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 22:
    // isDivisibleBy22(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 23:
    // isDivisibleBy23(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 24:
    // isDivisibleBy24(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 25:
    // isDivisibleBy25(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 26:
    // isDivisibleBy26(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 27:
    // isDivisibleBy27(x: Int) -> Bool
    // You can use the following function to check if an integer is divisible by 28:
    // isDivisibleBy28(x: Int) -> Bool
    // You can use the following function to check if
XCTAssertTrue(exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [1, 2, 3, 4], lst2: [2, 1, 4, 3]) == "YES") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [5, 7, 3], lst2: [2, 6, 4]) == "YES") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [5, 7, 3], lst2: [2, 6, 3]) == "NO") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [3, 2, 6, 1, 8, 9], lst2: [3, 5, 5, 1, 1, 1]) == "NO") // cannot find 'exchange' in scope
XCTAssertTrue(exchange(lst1: [100, 200], lst2: [200, 200]) == "YES") // cannot find 'exchange' in scope

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // TODO: implement me!
}
```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: implement me!
}
```
} // missing return in global function expected to return 'String'

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // TODO: implement this function
}
```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: implement this function
}
```
} // missing return in global function expected to return 'String'

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // TODO: implement this function
    // return "YES" if it is possible to exchange elements between lst1 and lst2
    // to make all the elements of lst1 to be even, otherwise return "NO"
    var result = "NO"
    var lst1_even = 0
    var lst2_even = 0
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            lst1_even += 1
        }
        if lst2[i] % 2 == 0 {
            lst2_even += 1
        }
    }
    if lst1_even == lst1.count || lst2_even == lst2.count {
        result = "YES"
    }
    return result
}
```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: implement this function
    // return "YES" if it is possible to exchange elements between lst1 and lst2
    // to make all the elements of lst1 to be even, otherwise return "NO"
    var result = "NO"
    var lst1_even = 0
    var lst2_even = 0
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            lst1_even += 1
        }
        if lst2[i] % 2 == 0 {
            lst2_even += 1
        }
    }
    if lst1_even == lst1.count || lst2_even == lst2.count {
        result = "YES"
    }
    return result
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    for character in test.characters {
        if let count = result[String(character)] {
            result[String(character)] = count + 1
        } else {
            result[String(character)] = 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]()
    for character in test.characters {
        if let count = result[String(character)] {
            result[String(character)] = count + 1
        } else {
            result[String(character)] = 1
        }
    }
    return result
}
```
for character in test.characters { // 'characters' is unavailable: Please use String directly

func histogram(test: String) -> [String : Int] {
    var result = [String: Int]()
    for letter in test.split(separator: " ") {
        if let count = result[letter] {
            result[letter] = count + 1
        } else {
            result[letter] = 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]()
    for letter in test.split(separator: " ") {
        if let count = result[letter] {
            result[letter] = count + 1
        } else {
            result[letter] = 1
        }
    }
    return result
}
```
if let count = result[letter] { // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
result[letter] = count + 1 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
result[letter] = 1 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'

func histogram(test: String) -> [String : Int] {
    var dict = [String:Int]()
    for letter in test.split(separator: " ") {
        if let count = dict[letter] {
            dict[letter] = count + 1
        } else {
            dict[letter] = 1
        }
    }
    return dict
}
```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 dict = [String:Int]()
    for letter in test.split(separator: " ") {
        if let count = dict[letter] {
            dict[letter] = count + 1
        } else {
            dict[letter] = 1
        }
    }
    return dict
}
```
if let count = dict[letter] { // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
dict[letter] = count + 1 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
dict[letter] = 1 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'

func histogram(test: String) -> [String : Int] {
    var result = [String: Int]()
    var testArray = test.split(separator: " ")
    for item in testArray {
        if let count = result[item] {
            result[item] = count + 1
        } else {
            result[item] = 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]()
    var testArray = test.split(separator: " ")
    for item in testArray {
        if let count = result[item] {
            result[item] = count + 1
        } else {
            result[item] = 1
        }
    }
    return result
}
```
if let count = result[item] { // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
result[item] = count + 1 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
result[item] = 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] = [:]
    for character in test.characters {
        if let count = histogram[String(character)] {
            histogram[String(character)] = count + 1
        } else {
            histogram[String(character)] = 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 character in test.characters {
        if let count = histogram[String(character)] {
            histogram[String(character)] = count + 1
        } else {
            histogram[String(character)] = 1
        }
    }
    return histogram
}
```
for character in test.characters { // 'characters' is unavailable: Please use String directly

func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    var letters = test.split(separator: " ")
    for letter in letters {
        if let count = result[letter] {
            result[letter] = count + 1
        } else {
            result[letter] = 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]()
    var letters = test.split(separator: " ")
    for letter in letters {
        if let count = result[letter] {
            result[letter] = count + 1
        } else {
            result[letter] = 1
        }
    }
    return result
}
```
if let count = result[letter] { // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
result[letter] = count + 1 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
result[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] = [:]
    var letters: [String] = test.split(separator: " ").map { $0.lowercased() }
    
    for letter in letters {
        if let count = histogram[letter] {
            histogram[letter] = count + 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] = [:]
    var letters: [String] = test.split(separator: " ").map { $0.lowercased() }
    
    for letter in letters {
        if let count = histogram[letter] {
            histogram[letter] = count + 1
        } else {
            histogram[letter] = 1
        }
    }
    
    return histogram
}
```
var letters: [String] = test.split(separator: " ").map { $0.lowercased() } // variable 'letters' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var histogram: [String : Int] = [:]
    for character in test.characters {
        if let count = histogram[String(character)] {
            histogram[String(character)] = count + 1
        } else {
            histogram[String(character)] = 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 character in test.characters {
        if let count = histogram[String(character)] {
            histogram[String(character)] = count + 1
        } else {
            histogram[String(character)] = 1
        }
    }
    return histogram
}
```
for character in test.characters { // 'characters' is unavailable: Please use String directly

func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    var testArray = test.split(separator: " ")
    for letter in testArray {
        if let count = result[letter] {
            result[letter] = count + 1
        } else {
            result[letter] = 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]()
    var testArray = test.split(separator: " ")
    for letter in testArray {
        if let count = result[letter] {
            result[letter] = count + 1
        } else {
            result[letter] = 1
        }
    }
    return result
}
```
if let count = result[letter] { // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
result[letter] = count + 1 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
result[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] = [:]
    for character in test.split(separator: " ") {
        if let count = histogram[character] {
            histogram[character] = count + 1
        } else {
            histogram[character] = 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 character in test.split(separator: " ") {
        if let count = histogram[character] {
            histogram[character] = count + 1
        } else {
            histogram[character] = 1
        }
    }
    return histogram
}
```
if let count = histogram[character] { // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
histogram[character] = count + 1 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'
histogram[character] = 1 // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'

func reverseDelete(s: String, c: String) -> (String, Bool) {
    // Write your code here
    var result = s
    var isPalindrome = true
    
    for i in 0..<s.count {
        if s[i] in c {
            result.remove(at: i)
            isPalindrome = false
        }
    }
    
    return (result, isPalindrome)
}
```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
    var result = s
    var isPalindrome = true
    
    for i in 0..<s.count {
        if s[i] in c {
            result.remove(at: i)
            isPalindrome = false
        }
    }
    
    return (result, isPalindrome)
}
```
if s[i] in c { // expected '{' after 'if' condition
if s[i] in c { // cannot convert value of type 'Character' to expected condition type 'Bool'
result.remove(at: i) // cannot convert value of type 'Int' to expected argument type 'String.Index'

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    var isPalindrome = true
    
    for i in 0..<s.count {
        if s[i]!= c[0] {
            result.append(s[i])
        } else {
            isPalindrome = false
        }
    }
    
    return (result, isPalindrome)
}
```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 = ""
    var isPalindrome = true
    
    for i in 0..<s.count {
        if s[i]!= c[0] {
            result.append(s[i])
        } else {
            isPalindrome = false
        }
    }
    
    return (result, isPalindrome)
}
```
if s[i]!= c[0] { // '=' must have consistent whitespace on both sides
if s[i]!= c[0] { // use of '=' in a boolean context, did you mean '=='?
if s[i]!= c[0] { // cannot force unwrap value of non-optional type 'Character'
result.append(s[i]) // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for i in c.characters.indices {
        result = result.replacingOccurrences(of: String(c[i]), with: "")
    }
    return (result, isPalindrome(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 = s
    for i in c.characters.indices {
        result = result.replacingOccurrences(of: String(c[i]), with: "")
    }
    return (result, isPalindrome(result))
}
```
for i in c.characters.indices { // 'characters' is unavailable: Please use String directly
return (result, isPalindrome(result)) // cannot find 'isPalindrome' in scope

func reverseDelete(s: String, c: String) -> (String, Bool) {
    let s = s.reversed()
    let c = c.reversed()
    let s = s.filter {!c.contains($0) }
    return (s.reversed(), 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.reversed()
    let c = c.reversed()
    let s = s.filter {!c.contains($0) }
    return (s.reversed(), s == s.reversed())
}
```
let s = s.filter {!c.contains($0) } // invalid redeclaration of 's'

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    for i in 0..<s.count {
        if s[i]!= c[0] {
            result.append(s[i])
        }
    }
    return (result, isPalindrome(result))
}

func isPalindrome(s: String) -> Bool {
    var result = ""
    for i in 0..<s.count {
        if s[i] >= "a" && s[i] <= "z" {
            result.append(s[i].uppercaseString)
        } else if s[i] >= "A" && s[i] <= "Z" {
            result.append(s[i].lowercaseString)
        } else if s[i] >= "0" && s[i] <= "9" {
            result.append(s[i])
        }
    }
    return result == result.reverse()
}
```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 i in 0..<s.count {
        if s[i]!= c[0] {
            result.append(s[i])
        }
    }
    return (result, isPalindrome(result))
}

// Palindrome
// Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
// Note: For the purpose of this problem, we define empty string as valid palindrome.
// Example
// isPalindrome("A man, a plan, a canal: Panama") == true
// isPalindrome("race a car") == false
func isPalindrome(s: String) -> Bool {
    var result = ""
    for i in 0..<s.count {
        if s[i] >= "a" && s[i] <= "z" {
            result.append(s[i].uppercaseString)
        } else if s[i] >= "A" && s[i] <= "Z" {
            result.append(s[i].lowercaseString)
        } else if s[i] >= "0" && s[i] <= "9" {
            result.append(s[i])
        }
    }
    return result == result.reverse()
}

// Palindrome
// Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
// Note: For the purpose of this problem, we define empty string as valid palindrome.
// Example
// isPalindrome("A man, a plan, a canal: Panama") == true
// isPalindrome("race a car") == false
func isPalindrome(s: String) -> Bool {
    var result = ""
    for i in 0..<s.count {
        if s[i] >= "a" && s[i] <= "z" {
            result.append(s[i].uppercaseString)
        } else if s[i] >= "A" && s[i] <= "Z" {
            result.append(s[i].lowercaseString)
        } else if s[i] >= "0" && s[i] <= "9" {
            result.append(s[i])
        }
    }
    return result == result.reverse()
}

// Palindrome
// Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
// Note: For the purpose of this problem, we define empty string as valid palindrome.
// Example
// isPalindrome("A man, a plan, a canal: Panama") == true
// isPalindrome("race a car") == false
func isPalindrome(s: String) -> Bool {
    var result = ""
    for i in 0..<s.count {
        if s[i] >= "a" && s[i] <= "z" {
            result.append(s[i].uppercaseString)
        } else if s[i] >= "A" && s[i] <= "Z" {
            result.append(s[i].lowercaseString)
        } else if s[i] >= "0" && s[i] <= "9" {
            result.append(s[i])
        }
    }
    return result == result.reverse()
}

// Palindrome
// Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
// Note: For the purpose of this problem, we define empty string as valid palindrome.
// Example
// isPalindrome("A man, a plan, a canal: Panama") == true
// isPalindrome("race a car") == false
func isPalindrome(s: String) -> Bool {
    var result = ""
    for i in 0..<s.count {
        if s[i] >= "a" && s[i] <= "z" {
            result.append(s[i].uppercaseString)
        } else if s[i] >= "A" && s[i] <= "Z" {
            result.append(s[i].lowercaseString)
        } else if s[i] >= "0" && s[i] <= "9" {
            result.append(s[i])
        }
    }
if s[i]!= c[0] { // use of '=' in a boolean context, did you mean '=='?
if s[i]!= c[0] { // '=' must have consistent whitespace on both sides
if s[i]!= c[0] { // cannot force unwrap value of non-optional type 'Character'
result.append(s[i]) // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
return (result, isPalindrome(result)) // missing argument label 's:' in call
if s[i] >= "a" && s[i] <= "z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s[i] >= "a" && s[i] <= "z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
result.append(s[i].uppercaseString) // value of type 'Character' has no member 'uppercaseString'
} else if s[i] >= "A" && s[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
} else if s[i] >= "A" && s[i] <= "Z" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
result.append(s[i].lowercaseString) // value of type 'Character' has no member 'lowercaseString'
} else if s[i] >= "0" && s[i] <= "9" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
} else if s[i] >= "0" && s[i] <= "9" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
result.append(s[i]) // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
return result == result.reverse() // value of type 'String' has no member 'reverse'

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for i in c.characters.enumerated() {
        if let index = s.index(s.startIndex, offsetBy: i.offset) {
            result.removeSubrange(index..<index+1)
        }
    }
    return (result, isPalindrome(result))
}

func isPalindrome(s: String) -> Bool {
    var s = s.reversed()
    return 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) {
    var result = s
    for i in c.characters.enumerated() {
        if let index = s.index(s.startIndex, offsetBy: i.offset) {
            result.removeSubrange(index..<index+1)
        }
    }
    return (result, isPalindrome(result))
}

// isPalindrome
// Given a string s, return true if the s is palindrome, or false otherwise.
// A string is called palindrome if it reads the same backward as forward.
// Example
// isPalindrome(s: "abcdcba") == true
// isPalindrome(s: "abcd") == false
func isPalindrome(s: String) -> Bool {
    var s = s.reversed()
    return s == s.reversed()
}
```
for i in c.characters.enumerated() { // 'characters' is unavailable: Please use String directly
if let index = s.index(s.startIndex, offsetBy: i.offset) { // initializer for conditional binding must have Optional type, not 'String.Index'
result.removeSubrange(index..<index+1) // binary operator '+' cannot be applied to operands of type 'String.Index' and 'Int'
return (result, isPalindrome(result)) // missing argument label 's:' in call
return s == s.reversed() // binary operator '==' cannot be applied to operands of type 'ReversedCollection<String>' and 'String'

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for i in c.characters.enumerated() {
        if s.contains(i.element) {
            result = result.replacingOccurrences(of: i.element, with: "")
        }
    }
    return (result, isPalindrome(result))
}

func isPalindrome(s: String) -> Bool {
    var result = s.replacingOccurrences(of: " ", with: "")
    result = result.replacingOccurrences(of: ".", with: "")
    result = result.replacingOccurrences(of: "-", with: "")
    result = result.replacingOccurrences(of: " ", with: "")
    result = result.lowercased()
    return result == result.reversed()
}

func isPalindromePermutation(s: String) -> Bool {
    var result = [Character: Int]()
    for i in s.characters.enumerated() {
        if result[i.element] == nil {
            result[i.element] = 1
        } else {
            result[i.element] = result[i.element]! + 1
        }
    }
    var odd = false
    for i in result.keys.enumerated() {
        if i.element == " " {
            continue
        }
        if result[i.element]! % 2 == 1 {
            if odd {
                return false
            } else {
                odd = true
            }
        }
    }
    return true
}

func partition(_ s: String) -> [[String]] {
    var result = [[String]]()
    var temp = [String]()
    var start = 0
    var end = 0
    var s = s
    var isPalindrome = isPalindrome(s)
    if isPalindrome {
        result.append([s])
    }
    while start < s.count {
        for i in start...s.count-1 {
            s = s.substring(from: start, to: i+1)
            isPalindrome = isPalindrome(s)
            if isPalindrome {
                temp.append(s)
                start = i+1
                break
            }
        }
        if isPalindrome {
            result.append(temp)
            temp = []
            start = 0
        } else {
            break
        }
    }
    return 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 = s
    for i in c.characters.enumerated() {
        if s.contains(i.element) {
            result = result.replacingOccurrences(of: i.element, with: "")
        }
    }
    return (result, isPalindrome(result))
}

// Palindrome
// Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
// Note: For the purpose of this problem, we define empty string as valid palindrome.
// Example
// isPalindrome("A man, a plan, a canal: Panama") == true
// isPalindrome("race a car") == false
func isPalindrome(s: String) -> Bool {
    var result = s.replacingOccurrences(of: " ", with: "")
    result = result.replacingOccurrences(of: ".", with: "")
    result = result.replacingOccurrences(of: "-", with: "")
    result = result.replacingOccurrences(of: " ", with: "")
    result = result.lowercased()
    return result == result.reversed()
}

// Palindrome Permutation
// Given a string, determine if its characters can be rearranged to form a palindrome.
// Example
// isPalindromePermutation("Tact Coa") == true
// isPalindromePermutation("Taco Cat") == false
func isPalindromePermutation(s: String) -> Bool {
    var result = [Character: Int]()
    for i in s.characters.enumerated() {
        if result[i.element] == nil {
            result[i.element] = 1
        } else {
            result[i.element] = result[i.element]! + 1
        }
    }
    var odd = false
    for i in result.keys.enumerated() {
        if i.element == " " {
            continue
        }
        if result[i.element]! % 2 == 1 {
            if odd {
                return false
            } else {
                odd = true
            }
        }
    }
    return true
}

// Palindrome Partitioning
// Given a string s, partition s such that every substring of the partition is a palindrome.
// Return all possible palindrome partitioning of s.
// A palindrome string is a string that reads the same backward as forward.
// Example
// partition("aab") == [["a","a","b"],["aa","b"]]
// partition("a") == [["a"]]
// partition("ab") == [["a","b"]]
func partition(_ s: String) -> [[String]] {
    var result = [[String]]()
    var temp = [String]()
    var start = 0
    var end = 0
    var s = s
    var isPalindrome = isPalindrome(s)
    if isPalindrome {
        result.append([s])
    }
    while start < s.count {
        for i in start...s.count-1 {
            s = s.substring(from: start, to: i+1)
            isPalindrome = isPalindrome(s)
            if isPalindrome {
                temp.append(s)
                start = i+1
                break
            }
        }
        if isPalindrome {
            result.append(temp)
            temp = []
            start = 0
        } else {
            break
        }
    }
    return result
}

// Palindrome Partitioning II
// Given a string s, partition s such that every substring of the partition is a palindrome.
// Find the minimum cuts needed for a palindrome partitioning of s.
// A palindrome string is a string that reads the same backward as forward.
// Example
// minCut("aab") == 1
// minCut("aabaa") == 2
func minCut(s: String) -> Int {
    var result = [Int](repeating: 0, count: s.count+1)
    var temp = [Int](repeating: 0, count: s.count+1)
    var start = 0
    var end = 0
    var s = s
    var isPalindrome = isPalindrome
for i in c.characters.enumerated() { // 'characters' is unavailable: Please use String directly
result = result.replacingOccurrences(of: i.element, with: "") // instance method 'replacingOccurrences(of:with:options:range:)' requires that 'String.Element' (aka 'Character') conform to 'StringProtocol'
return (result, isPalindrome(result)) // missing argument label 's:' in call
return result == result.reversed() // binary operator '==' cannot be applied to operands of type 'String' and '[String.Element]' (aka 'Array<Character>')
for i in s.characters.enumerated() { // 'characters' is unavailable: Please use String directly
var isPalindrome = isPalindrome(s) // missing argument label 's:' in call
s = s.substring(from: start, to: i+1) // extra argument 'to' in call
s = s.substring(from: start, to: i+1) // cannot convert value of type 'Int' to expected argument type 'String.Index'

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for i in 0..<s.count {
        if s[i] in c {
            result.remove(at: i)
        }
    }
    return (result, isPalindrome(result))
}

func isPalindrome(s: String) -> Bool {
    var result = s.replacingOccurrences(of: " ", with: "")
    result = result.replacingOccurrences(of: ".", with: "")
    result = result.replacingOccurrences(of: "?", with: "")
    result = result.replacingOccurrences(of: "!", with: "")
    result = result.replacingOccurrences(of: ",", with: "")
    result = result.replacingOccurrences(of: "-", with: "")
    result = result.replacingOccurrences(of: " ", with: "")
    result = result.replacingOccurrences(of: " ", with: "")
    result = result.lowercased()
    return result == 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 i in 0..<s.count {
        if s[i] in c {
            result.remove(at: i)
        }
    }
    return (result, isPalindrome(result))
}

// isPalindrome
// Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
// Note: For the purpose of this problem, we define empty string as valid palindrome.
// Example
// isPalindrome("A man, a plan, a canal: Panama") == true
// isPalindrome("race a car") == false
func isPalindrome(s: String) -> Bool {
    var result = s.replacingOccurrences(of: " ", with: "")
    result = result.replacingOccurrences(of: ".", with: "")
    result = result.replacingOccurrences(of: "?", with: "")
    result = result.replacingOccurrences(of: "!", with: "")
    result = result.replacingOccurrences(of: ",", with: "")
    result = result.replacingOccurrences(of: "-", with: "")
    result = result.replacingOccurrences(of: " ", with: "")
    result = result.replacingOccurrences(of: " ", with: "")
    result = result.lowercased()
    return result == result.reversed()
}

// isPalindrome
// Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
// Note: For the purpose of this problem, we define empty string as valid palindrome.
// Example
// isPalindrome("A man, a plan, a canal: Panama") == true
// isPalindrome("race a car") == false
func isPalindrome(s: String) -> Bool {
    var result = s.replacingOccurrences(of: " ", with: "")
    result = result.replacingOccurrences(of: ".", with: "")
    result = result.replacingOccurrences(of: "?", with: "")
    result = result.replacingOccurrences(of: "!", with: "")
    result = result.replacingOccurrences(of: ",", with: "")
    result = result.replacingOccurrences(of: "-", with: "")
    result = result.replacingOccurrences(of: " ", with: "")
    result = result.replacingOccurrences(of: " ", with: "")
    result = result.lowercased()
    return result == result.reversed()
}

// isPalindrome
// Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
// Note: For the purpose of this problem, we define empty string as valid palindrome.
// Example
// isPalindrome("A man, a plan, a canal: Panama") == true
// isPalindrome("race a car") == false
func isPalindrome(s: String) -> Bool {
    var result = s.replacingOccurrences(of: " ", with: "")
    result = result.replacingOccurrences(of: ".", with: "")
    result = result.replacingOccurrences(of: "?", with: "")
    result = result.replacingOccurrences(of: "!", with: "")
    result = result.replacingOccurrences(of: ",", with: "")
    result = result.replacingOccurrences(of: "-", with: "")
    result = result.replacingOccurrences(of: " ", with: "")
    result = result.replacingOccurrences(of: " ", with: "")
    result = result.lowercased()
    return result == result.reversed()
}

// isPalindrome
// Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
// Note: For the purpose of this problem, we define empty string as valid palindrome.
// Example
// isPalindrome("A man, a plan, a canal: Panama") == true
// isPalindrome("race a car") == false
func isPalindrome(s: String) -> Bool {
    var result = s.replacingOccurrences(of: " ", with: "")
if s[i] in c { // cannot convert value of type 'Character' to expected condition type 'Bool'
if s[i] in c { // expected '{' after 'if' condition
result.remove(at: i) // cannot convert value of type 'Int' to expected argument type 'String.Index'
return (result, isPalindrome(result)) // missing argument label 's:' in call
return result == result.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 i in 0..<s.characters.count {
        if s.characters[i] in c.characters {
            result.removeAtIndex(i)
        }
    }
    return (result, isPalindrome(result))
}

func isPalindrome(s: String) -> Bool {
    var result = s.lowercaseString.stringByReplacingOccurrencesOfString(" ", withString: "", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil, locale: nil)
    for i in 0..<result.characters.count/2 {
        if result.characters[i]!= result.characters[result.characters.count-i-1] {
            return false
        }
    }
    return true
}

func isPalindromePermutation(s: String) -> Bool {
    var result = [Character: Int]()
    for i in 0..<s.characters.count {
        if s.characters[i]!= " " {
            if result[s.characters[i]] == nil {
                result[s.characters[i]] = 1
            } else {
                result[s.characters[i]] += 1
            }
        }
    }
    var odd = false
    for i in result.keys {
        if result[i] % 2 == 1 {
            if odd {
                return false
            } else {
                odd = true
            }
        }
    }
    return true
}

func isPalindrome(head: ListNode?) -> Bool {
    var stack = [Int]()
    var current = head
    while current!= nil {
        stack.append(current!.val)
        current = current!.next
    }
    var current2 = head
    while current2!= nil {
        if current2!.val!= stack.removeFirst() {
            return false
        }
        current2 = current2!.next
    }
    return true
}

func isPalindrome(x: Int) -> Bool {
    if x < 0 {
        return false
    }
    var result = x
    var temp = 0
    while result > 0 {
        temp = temp*10 + result%10
        result = result/10
    }
    return temp == x
}
```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 i in 0..<s.characters.count {
        if s.characters[i] in c.characters {
            result.removeAtIndex(i)
        }
    }
    return (result, isPalindrome(result))
}

// Palindrome
// Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
// Note: For the purpose of this problem, we define empty string as valid palindrome.
// Example
// isPalindrome("A man, a plan, a canal: Panama") == true
// isPalindrome("race a car") == false
func isPalindrome(s: String) -> Bool {
    var result = s.lowercaseString.stringByReplacingOccurrencesOfString(" ", withString: "", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil, locale: nil)
    for i in 0..<result.characters.count/2 {
        if result.characters[i]!= result.characters[result.characters.count-i-1] {
            return false
        }
    }
    return true
}

// Palindrome Permutation
// Given a string, determine if a permutation of the string could form a palindrome.
// Example
// isPalindromePermutation("tact coa") == true
// isPalindromePermutation("eagle") == false
func isPalindromePermutation(s: String) -> Bool {
    var result = [Character: Int]()
    for i in 0..<s.characters.count {
        if s.characters[i]!= " " {
            if result[s.characters[i]] == nil {
                result[s.characters[i]] = 1
            } else {
                result[s.characters[i]] += 1
            }
        }
    }
    var odd = false
    for i in result.keys {
        if result[i] % 2 == 1 {
            if odd {
                return false
            } else {
                odd = true
            }
        }
    }
    return true
}

// Palindrome Linked List
// Given a singly linked list, determine if it is a palindrome.
// Example
// isPalindrome(1 -> 2) == false
// isPalindrome(1 -> 2 -> 2 -> 1) == true
func isPalindrome(head: ListNode?) -> Bool {
    var stack = [Int]()
    var current = head
    while current!= nil {
        stack.append(current!.val)
        current = current!.next
    }
    var current2 = head
    while current2!= nil {
        if current2!.val!= stack.removeFirst() {
            return false
        }
        current2 = current2!.next
    }
    return true
}

// Palindrome Number
// Determine whether an integer is a palindrome. Do this without extra space.
// Example
// isPalindrome(10) == false
// isPalindrome(11) == true
// isPalindrome(1221) == true
func isPalindrome(x: Int) -> Bool {
    if x < 0 {
        return false
    }
    var result = x
    var temp = 0
    while result > 0 {
        temp = temp*10 + result%10
        result = result/10
    }
    return temp == x
}

// Palindrome Partitioning
// Given a string s, partition s such that every substring of the partition is a palindrome.
// Return all possible palindrome partitioning of s.
// Example
// partition("aab") == [["a","a","b"], ["aa","b"]]
func partition(s: String) -> [[String]] {
    var result = [[String]]()
    var current = [String]()
    var stack = [[String]]()
    var currentString = s
    var i = 0
    while i < currentString.characters.count {
        if isPalindrome(currentString.characters[i...currentString.characters.count]) {
            current.append(currentString.characters[i...currentString.characters.count])
            currentString = currentString.characters.dropFirst(current.count)
            i = 0
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if s.characters[i] in c.characters { // cannot convert value of type 'Character' to expected condition type 'Bool'
if s.characters[i] in c.characters { // expected '{' after 'if' condition
result.removeAtIndex(i) // value of type 'String' has no member 'removeAtIndex'
return (result, isPalindrome(result)) // missing argument label 's:' in call
var result = s.lowercaseString.stringByReplacingOccurrencesOfString(" ", withString: "", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil, locale: nil) // 'nil' requires a contextual type
var result = s.lowercaseString.stringByReplacingOccurrencesOfString(" ", withString: "", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil, locale: nil) // 'nil' requires a contextual type
var result = s.lowercaseString.stringByReplacingOccurrencesOfString(" ", withString: "", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil, locale: nil) // value of type 'String' has no member 'lowercaseString'
var result = s.lowercaseString.stringByReplacingOccurrencesOfString(" ", withString: "", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil, locale: nil) // type 'NSStringCompareOptions' has no member 'CaseInsensitiveSearch'
if result.characters[i]!= result.characters[result.characters.count-i-1] { // '=' must have consistent whitespace on both sides
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
if s.characters[i]!= " " { // cannot force unwrap value of non-optional type 'Character'
if s.characters[i]!= " " { // use of '=' in a boolean context, did you mean '=='?
if s.characters[i]!= " " { // '=' must have consistent whitespace on both sides
if result[s.characters[i]] == nil { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if result[s.characters[i]] == nil { // 'characters' is unavailable: Please use String directly
result[s.characters[i]] = 1 // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
result[s.characters[i]] = 1 // 'characters' is unavailable: Please use String directly
result[s.characters[i]] += 1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if result[i] % 2 == 1 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
func isPalindrome(head: ListNode?) -> Bool { // cannot find type 'ListNode' in scope
while current!= nil { // use of '=' in a boolean context, did you mean '=='?
while current!= nil { // '=' must have consistent whitespace on both sides
while current2!= nil { // use of '=' in a boolean context, did you mean '=='?
while current2!= nil { // '=' must have consistent whitespace on both sides
if current2!.val!= stack.removeFirst() { // use of '=' in a boolean context, did you mean '=='?
if current2!.val!= stack.removeFirst() { // '=' must have consistent whitespace on both sides

func reverseDelete(s: String, c: String) -> (String, Bool) {
    // Write your code here
    var result = s
    for i in c.characters.enumerated() {
        let index = i.offset
        let character = i.element
        if s.contains(character) {
            result.removeSubrange(index..<index+1)
        }
    }
    return (result, isPalindrome(result))
}

func isPalindrome(s: String) -> Bool {
    // Write your code here
    let lowercase = s.lowercased()
    let alphanumeric = lowercase.filter {
        let character = $0 as Character
        return character.isLetterOrNumber
    }
    let reversed = alphanumeric.reversed()
    return alphanumeric == reversed
}

func isPalindromePermutation(s: String) -> Bool {
    // Write your code here
    let lowercase = s.lowercased()
    let characterCounts = lowercase.characters.reduce([:]) {
        (result: [Character: Int], character: Character) -> [Character: Int] in
        var result = result
        if result[character] == nil {
            result[character] = 0
        }
        result[character] += 1
        return result
    }
    var oddCount = 0
    for (character, count) in characterCounts {
        if count % 2 == 1 {
            oddCount += 1
        }
        if oddCount > 1 {
            return false
        }
    }
    return true
}

func partition(_ s: String) -> [[String]] {
    // Write your code here
    var result = [[String]]()
    partition(s: s, result: &result, current: [String]())
    return result
}

func partition(s: String, result: inout [[String]], current: [String]) {
    if s.isEmpty {
        result.append(current)
    } else {
        for i in 0..<s.characters.count {
            let substring = s.substring(to: i)
            if isPalindrome(s: substring) {
                let newCurrent = current + [substring]
                partition(s: s.substring(from: i + 1), result: &result, current: newCurrent)
            }
        }
    }
}

func isPalindrome(_ head: ListNode?) -> Bool {
    // Write your code here
    var stack = [Int]()
    var current = head
    while current!= nil {
        stack.append(current!.value)
        current = current!.next
    }
    var reversed = head
    while reversed!= nil {
        if reversed.value!= stack.removeFirst() {
            return false
        }
        reversed = reversed!.next
    }
    return true
}
```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
    var result = s
    for i in c.characters.enumerated() {
        let index = i.offset
        let character = i.element
        if s.contains(character) {
            result.removeSubrange(index..<index+1)
        }
    }
    return (result, isPalindrome(result))
}

// Palindrome
// Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
// Note: For the purpose of this problem, we define empty string as valid palindrome.
// Example
// isPalindrome("A man, a plan, a canal: Panama") == true
// isPalindrome("race a car") == false
func isPalindrome(s: String) -> Bool {
    // Write your code here
    let lowercase = s.lowercased()
    let alphanumeric = lowercase.filter {
        let character = $0 as Character
        return character.isLetterOrNumber
    }
    let reversed = alphanumeric.reversed()
    return alphanumeric == reversed
}

// Palindrome Permutation
// Given a string, determine if its characters can be rearranged to form a palindrome.
// Example
// isPalindromePermutation("Tact Coa") == true
// isPalindromePermutation("Tact Co") == false
func isPalindromePermutation(s: String) -> Bool {
    // Write your code here
    let lowercase = s.lowercased()
    let characterCounts = lowercase.characters.reduce([:]) {
        (result: [Character: Int], character: Character) -> [Character: Int] in
        var result = result
        if result[character] == nil {
            result[character] = 0
        }
        result[character] += 1
        return result
    }
    var oddCount = 0
    for (character, count) in characterCounts {
        if count % 2 == 1 {
            oddCount += 1
        }
        if oddCount > 1 {
            return false
        }
    }
    return true
}

// Palindrome Partitioning
// Given a string s, partition s such that every substring of the partition is a palindrome.
// Return all possible palindrome partitioning of s.
// A palindrome string is a string that reads the same backward as forward.
// Example
// partition("aab") == [["a", "a", "b"], ["aa", "b"]]
// partition("a") == [["a"]]
// partition("ab") == [["a", "b"]]
func partition(_ s: String) -> [[String]] {
    // Write your code here
    var result = [[String]]()
    partition(s: s, result: &result, current: [String]())
    return result
}

func partition(s: String, result: inout [[String]], current: [String]) {
    if s.isEmpty {
        result.append(current)
    } else {
        for i in 0..<s.characters.count {
            let substring = s.substring(to: i)
            if isPalindrome(s: substring) {
                let newCurrent = current + [substring]
                partition(s: s.substring(from: i + 1), result: &result, current: newCurrent)
            }
        }
    }
}

// Palindrome Linked List
// Given a singly linked list, determine if it is a palindrome.
// Example
// isPalindrome(1 -> 4 -> 3 -> 4 -> 1 -> nil) == true
// isPalindrome(1 -> 2 -> 3 -> nil) == false
func isPalindrome(_ head: ListNode?) -> Bool {
    // Write your code here
    var stack = [Int]()
    var current = head
    while current!= nil {
        stack.append(current!.value)
        current = current!.next
    }
    var reversed = head
    while reversed!= nil {
        if reversed.value!= stack.removeFirst() {
            return false
        }
        reversed = reversed!.next
    }
    return true
}

// Palindrome Number
// Determine whether an integer is a palindrome. Do this without extra space.
//
for i in c.characters.enumerated() { // 'characters' is unavailable: Please use String directly
result.removeSubrange(index..<index+1) // instance method 'removeSubrange' requires the types 'String.Index' and 'Int' be equivalent
return (result, isPalindrome(result)) // missing argument label 's:' in call
return character.isLetterOrNumber // value of type 'Character' has no member 'isLetterOrNumber'
result[character] += 1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
for i in 0..<s.characters.count { // 'characters' is unavailable: Please use String directly
let substring = s.substring(to: i) // cannot convert value of type 'Int' to expected argument type 'String.Index'
partition(s: s.substring(from: i + 1), result: &result, current: newCurrent) // cannot convert value of type 'Int' to expected argument type 'String.Index'
func isPalindrome(_ head: ListNode?) -> Bool { // cannot find type 'ListNode' in scope
while current!= nil { // use of '=' in a boolean context, did you mean '=='?
while current!= nil { // '=' must have consistent whitespace on both sides
while reversed!= nil { // '=' must have consistent whitespace on both sides
while reversed!= nil { // use of '=' in a boolean context, did you mean '=='?
if reversed.value!= stack.removeFirst() { // '=' must have consistent whitespace on both sides
if reversed.value!= stack.removeFirst() { // use of '=' in a boolean context, did you mean '=='?

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.reduce(0) {
            (count, digit) -> Int in
            return count + (digit as Character).isOdd
        }
        return "the number of odd elements \(oddCount) in the string \(String(lst.index(of: $0))) 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.reduce(0) {
            (count, digit) -> Int in
            return count + (digit as Character).isOdd
        }
        return "the number of odd elements \(oddCount) in the string \(String(lst.index(of: $0))) of the input."
    }
}
```
return count + (digit as Character).isOdd // value of type 'Character' has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    var result: [String] = []
    for i in lst {
        var oddCount = 0
        for j in i {
            if j.isOdd {
                oddCount += 1
            }
        }
        result.append("the number of odd elements \(oddCount) in the string \(i) 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 i in lst {
        var oddCount = 0
        for j in i {
            if j.isOdd {
                oddCount += 1
            }
        }
        result.append("the number of odd elements \(oddCount) in the string \(i) of the input.")
    }
    return result
}
```
if j.isOdd { // value of type 'Character' has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    var result: [String] = []
    for s in lst {
        var oddCount = 0
        for c in s {
            if c.isOdd {
                oddCount += 1
            }
        }
        result.append("the number of odd elements \(oddCount) in the string \(s) 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 s in lst {
        var oddCount = 0
        for c in s {
            if c.isOdd {
                oddCount += 1
            }
        }
        result.append("the number of odd elements \(oddCount) in the string \(s) of the input.")
    }
    return result
}
```
if c.isOdd { // value of type 'Character' has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    var result = [String]()
    for str in lst {
        var oddCount = 0
        for ch in str {
            if ch.isOdd {
                oddCount += 1
            }
        }
        result.append("the number of odd elements \(oddCount) in the string \(str) 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 str in lst {
        var oddCount = 0
        for ch in str {
            if ch.isOdd {
                oddCount += 1
            }
        }
        result.append("the number of odd elements \(oddCount) in the string \(str) of the input.")
    }
    return result
}
```
if ch.isOdd { // value of type 'Character' has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.reduce(0) { (count, char) -> Int in
            return count + (char.isOddDigit? 1 : 0)
        }
        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.reduce(0) { (count, char) -> Int in
            return count + (char.isOddDigit? 1 : 0)
        }
        return "the number of odd elements \(oddCount)n the str\(oddCount)ng \(oddCount) of the \(oddCount)nput."
    }
}
```
return lst.map { // type of expression is ambiguous without a type annotation
return count + (char.isOddDigit? 1 : 0) // expected ',' separator

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.reduce(0) { (count, digit) -> Int in
            if digit.isOdd {
                return count + 1
            }
            return 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.reduce(0) { (count, digit) -> Int in
            if digit.isOdd {
                return count + 1
            }
            return count
        }
        return "the number of odd elements \(oddCount) in the string \(oddCount) of the input."
    }
}
```
if digit.isOdd { // value of type 'String.Element' (aka 'Character') has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.reduce(0) {
            (count, char) -> Int in
            return count + (char.isOddDigit? 1 : 0)
        }
        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.reduce(0) {
            (count, char) -> Int in
            return count + (char.isOddDigit? 1 : 0)
        }
        return "the number of odd elements \(oddCount)n the str\(oddCount)ng \(oddCount) of the \(oddCount)nput."
    }
}
```
return lst.map { // type of expression is ambiguous without a type annotation
return count + (char.isOddDigit? 1 : 0) // expected ',' separator

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        $0.reduce(0) { (oddCount, char) -> Int in
            return oddCount + (char.isOddDigit? 1 : 0)
        }.description
    }
}
```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 {
        $0.reduce(0) { (oddCount, char) -> Int in
            return oddCount + (char.isOddDigit? 1 : 0)
        }.description
    }
}
```
return lst.map { // type of expression is ambiguous without a type annotation
return oddCount + (char.isOddDigit? 1 : 0) // expected ',' separator

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        $0.reduce(0) {
            $0 + ($0 % 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 {
        $0.reduce(0) {
            $0 + ($0 % 2 == 1)
        }
    }
}
```

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        $0.reduce(0) {
            $0 + ($0 % 2 == 0? 0 : 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 {
        $0.reduce(0) {
            $0 + ($0 % 2 == 0? 0 : 1)
        }
    }
}
```

func minSubArraySum(nums: [Int]) -> Int {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'Int'

func minSubArraySum(nums: [Int]) -> Int {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'Int'

func minSubArraySum(nums: [Int]) -> Int {
    // TODO: Write your minSubArraySum solution here
}
```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 {
    // TODO: Write your minSubArraySum solution here
}
```
} // missing return in global function expected to return 'Int'

func minSubArraySum(nums: [Int]) -> Int {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func minSubArraySum(nums: [Int]) -> Int {
    // Write your solution here
    var sum = 0
    var minSum = Int.max
    var start = 0
    var end = 0
    for end in 0..<nums.count {
        sum += nums[end]
        while sum >= minSum {
            minSum = min(minSum, sum)
            sum -= nums[start]
            start += 1
        }
    }
    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 {
    // Write your solution here
    var sum = 0
    var minSum = Int.max
    var start = 0
    var end = 0
    for end in 0..<nums.count {
        sum += nums[end]
        while sum >= minSum {
            minSum = min(minSum, sum)
            sum -= nums[start]
            start += 1
        }
    }
    return minSum
}
```
var end = 0 // initialization of variable 'end' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    // Write your solution here
    var minSum = Int.max
    var sum = 0
    var start = 0
    var end = 0
    for end in 0..<nums.count {
        sum += nums[end]
        while sum > minSum {
            sum -= nums[start]
            start += 1
        }
        minSum = min(minSum, sum)
    }
    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 {
    // Write your solution here
    var minSum = Int.max
    var sum = 0
    var start = 0
    var end = 0
    for end in 0..<nums.count {
        sum += nums[end]
        while sum > minSum {
            sum -= nums[start]
            start += 1
        }
        minSum = min(minSum, sum)
    }
    return minSum
}
```
var end = 0 // initialization of variable 'end' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    var sum = 0
    var minSum = Int.max
    var start = 0
    var end = 0
    
    while end < nums.count {
        sum += nums[end]
        end += 1
        
        while sum >= minSum {
            minSum = min(minSum, sum)
            sum -= nums[start]
            start += 1
        }
    }
    
    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 sum = 0
    var minSum = Int.max
    var start = 0
    var end = 0
    
    while end < nums.count {
        sum += nums[end]
        end += 1
        
        while sum >= minSum {
            minSum = min(minSum, sum)
            sum -= nums[start]
            start += 1
        }
    }
    
    return minSum
}
```
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    // Write your solution here
    var sum = 0
    var min = Int.max
    for i in 0..<nums.count {
        sum += nums[i]
        if sum < min {
            min = sum
        }
        if sum <= 0 {
            sum = 0
        }
    }
    return min
}
```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 {
    // Write your solution here
    var sum = 0
    var min = Int.max
    for i in 0..<nums.count {
        sum += nums[i]
        if sum < min {
            min = sum
        }
        if sum <= 0 {
            sum = 0
        }
    }
    return min
}
```
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    // Write your solution here
    // 暴力法
    // 时间复杂度:O(n^2)
    // 空间复杂度:O(1)
    var minSum = Int.max
    for i in 0..<nums.count {
        for j in i+1..<nums.count {
            minSum = min(minSum, nums[i]+nums[j])
        }
    }
    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 {
    // Write your solution here
    // 暴力法
    // 时间复杂度:O(n^2)
    // 空间复杂度:O(1)
    var minSum = Int.max
    for i in 0..<nums.count {
        for j in i+1..<nums.count {
            minSum = min(minSum, nums[i]+nums[j])
        }
    }
    return minSum
}
```
 // XCTAssertTrue failed

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    var start = 0
    var end = 0
    for end in 0..<nums.count {
        sum += nums[end]
        while sum > minSum {
            sum -= nums[start]
            start += 1
        }
        minSum = min(minSum, sum)
    }
    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
    var start = 0
    var end = 0
    for end in 0..<nums.count {
        sum += nums[end]
        while sum > minSum {
            sum -= nums[start]
            start += 1
        }
        minSum = min(minSum, sum)
    }
    return minSum
}
```
var end = 0 // initialization of variable 'end' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    
}
```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 {
    
}
```
} // missing return in global function expected to return 'Int'

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    
}
```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 {
    
}
```
} // missing return in global function expected to return 'Int'

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    
}
```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 {
    
}
```
} // missing return in global function expected to return 'Int'

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    // Write your solution here
    var result = 0
    var count = 0
    var bucket = capacity
    for row in grid {
        for i in 0..<row.count {
            if row[i] == 0 {
                count += 1
            }
            if row[i] == 1 {
                if bucket == 0 {
                    result += 1
                    bucket = capacity
                }
                bucket -= 1
            }
        }
    }
    result += count
    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 {
    // Write your solution here
    var result = 0
    var count = 0
    var bucket = capacity
    for row in grid {
        for i in 0..<row.count {
            if row[i] == 0 {
                count += 1
            }
            if row[i] == 1 {
                if bucket == 0 {
                    result += 1
                    bucket = capacity
                }
                bucket -= 1
            }
        }
    }
    result += count
    return result
}
```
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    
}
```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 {
    
}
```
} // missing return in global function expected to return 'Int'

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    // Write your code here
    let rows = grid.count
    let cols = grid[0].count
    var buckets = [Int](repeating: capacity, count: cols)
    var water = 0
    for row in 0..<rows {
        for col in 0..<cols {
            if grid[row][col] == 1 {
                water += 1
                buckets[col] -= 1
            }
        }
    }
    
    var buckets = [Int](repeating: capacity, count: cols)
    var water = 0
    for row in 0..<rows {
        for col in 0..<cols {
            if grid[row][col] == 1 {
                water += 1
                buckets[col] -= 1
            }
        }
    }
    
    return water
}
```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 {
    // Write your code here
    let rows = grid.count
    let cols = grid[0].count
    var buckets = [Int](repeating: capacity, count: cols)
    var water = 0
    for row in 0..<rows {
        for col in 0..<cols {
            if grid[row][col] == 1 {
                water += 1
                buckets[col] -= 1
            }
        }
    }
    
    var buckets = [Int](repeating: capacity, count: cols)
    var water = 0
    for row in 0..<rows {
        for col in 0..<cols {
            if grid[row][col] == 1 {
                water += 1
                buckets[col] -= 1
            }
        }
    }
    
    return water
}
```
var buckets = [Int](repeating: capacity, count: cols) // invalid redeclaration of 'buckets'
var water = 0 // invalid redeclaration of 'water'

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    // Write your code here
    var count = 0
    var queue = [Int]()
    var visited = [Int]()
    var visitedCount = 0
    for i in 0..<grid.count {
        if grid[i][0] == 1 {
            queue.append(i)
            visited.append(0)
            visitedCount += 1
        }
    }
    while visitedCount > 0 {
        var nextQueue = [Int]()
        var nextVisited = [Int]()
        var nextVisitedCount = 0
        for i in 0..<queue.count {
            var x = queue[i]
            var y = visited[i]
            if y == grid[x].count - 1 {
                count += 1
                visitedCount -= 1
            } else {
                nextQueue.append(x)
                nextVisited.append(y + 1)
                nextVisitedCount += 1
            }
        }
        queue = nextQueue
        visited = nextVisited
        visitedCount = nextVisitedCount
    }
    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 {
    // Write your code here
    var count = 0
    var queue = [Int]()
    var visited = [Int]()
    var visitedCount = 0
    for i in 0..<grid.count {
        if grid[i][0] == 1 {
            queue.append(i)
            visited.append(0)
            visitedCount += 1
        }
    }
    while visitedCount > 0 {
        var nextQueue = [Int]()
        var nextVisited = [Int]()
        var nextVisitedCount = 0
        for i in 0..<queue.count {
            var x = queue[i]
            var y = visited[i]
            if y == grid[x].count - 1 {
                count += 1
                visitedCount -= 1
            } else {
                nextQueue.append(x)
                nextVisited.append(y + 1)
                nextVisitedCount += 1
            }
        }
        queue = nextQueue
        visited = nextVisited
        visitedCount = nextVisitedCount
    }
    return count
}
```
var x = queue[i] // variable 'x' was never mutated; consider changing to 'let' constant
var y = visited[i] // variable 'y' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    // Write your code here
    let m = grid.count
    let n = grid[0].count
    var dp = [[Int]](repeating: [Int](repeating: 0, count: n+1), count: m+1)
    for i in 0..<m {
        for j in 0..<n {
            if grid[i][j] == 0 {
                dp[i+1][j+1] = dp[i][j+1]
            } else {
                dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])
            }
        }
    }
    var ans = 0
    for i in 0..<m {
        for j in 0..<n {
            if grid[i][j] == 1 {
                ans += min(dp[i+1][j+1], capacity)
            }
        }
    }
    return ans
}
```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 {
    // Write your code here
    let m = grid.count
    let n = grid[0].count
    var dp = [[Int]](repeating: [Int](repeating: 0, count: n+1), count: m+1)
    for i in 0..<m {
        for j in 0..<n {
            if grid[i][j] == 0 {
                dp[i+1][j+1] = dp[i][j+1]
            } else {
                dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])
            }
        }
    }
    var ans = 0
    for i in 0..<m {
        for j in 0..<n {
            if grid[i][j] == 1 {
                ans += min(dp[i+1][j+1], capacity)
            }
        }
    }
    return ans
}
```
 // XCTAssertTrue failed

```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 {
    // Write your code here
    var count = 0
    var bucket = capacity
    var gridCopy = grid
    var gridCopy2 = grid
    var gridCopy3 = grid
    var gridCopy4 = grid
    var gridCopy5 = grid
    var gridCopy6 = grid
    var gridCopy7 = grid
    var gridCopy8 = grid
    var gridCopy9 = grid
    var gridCopy10 = grid
    var gridCopy11 = grid
    var gridCopy12 = grid
    var gridCopy13 = grid
    var gridCopy14 = grid
    var gridCopy15 = grid
    var gridCopy16 = grid
    var gridCopy17 = grid
    var gridCopy18 = grid
    var gridCopy19 = grid
    var gridCopy20 = grid
    var gridCopy21 = grid
    var gridCopy22 = grid
    var gridCopy23 = grid
    var gridCopy24 = grid
    var gridCopy25 = grid
    var gridCopy26 = grid
    var gridCopy27 = grid
    var gridCopy28 = grid
    var gridCopy29 = grid
    var gridCopy30 = grid
    var gridCopy31 = grid
    var gridCopy32 = grid
    var gridCopy33 = grid
    var gridCopy34 = grid
    var gridCopy35 = grid
    var gridCopy36 = grid
    var gridCopy37 = grid
    var gridCopy38 = grid
    var gridCopy39 = grid
    var gridCopy40 = grid
    var gridCopy41 = grid
    var gridCopy42 = grid
    var gridCopy43 = grid
    var gridCopy44 = grid
    var gridCopy45 = grid
    var gridCopy46 = grid
    var gridCopy47 = grid
    var gridCopy48 = grid
    var gridCopy49 = grid
    var gridCopy50 = grid
    var gridCopy51 = grid
    var gridCopy52 = grid
    var gridCopy53 = grid
    var gridCopy54 = grid
    var gridCopy55 = grid
    var gridCopy56 = grid
    var gridCopy57 = grid
    var gridCopy58 = grid
    var gridCopy59 = grid
    var gridCopy60 = grid
    var gridCopy61 = grid
    var gridCopy62 = grid
    var gridCopy63 = grid
    var gridCopy64 = grid
    var gridCopy65 = grid
    var gridCopy66 = grid
    var gridCopy67 = grid
    var gridCopy68 = grid
    var gridCopy69 = grid
    var gridCopy70 = grid
    var gridCopy71 = grid
    var gridCopy72 = grid
    var gridCopy73 = grid
    var gridCopy74 = grid
    var gridCopy75 = grid
    var gridCopy76 = grid
    var gridCopy77 = grid
    var gridCopy78 = grid
    var gridCopy79 = grid
    var gridCopy80 = grid
    var gridCopy81 = grid
    var gridCopy82 = grid
    var gridCopy83 = grid
    var gridCopy84 = grid
    var gridCopy85 = grid
    var gridCopy86 = grid
    var gridCopy87 = grid
    var gridCopy88 = grid
    var gridCopy89 = grid
    var gridCopy90 = grid
    var gridCopy91 = grid
    var gridCopy92 = grid
    var gridCopy93 = grid
    var gridCopy94 = grid
    var gridCopy95 = grid
    var gridCopy96 = grid
    var gridCopy97 = grid
    var gridCopy98 = grid
    var gridCopy99 = grid
    var gridCopy100 = grid
    var gridCopy101 = grid
    var gridCopy102 = grid
    var gridCopy103 = grid
    var gridCopy104 = grid
    var gridCopy105 = grid
    var gridCopy106 = grid
    var gridCopy107 = grid
    var gridCopy108 = grid
    var gridCopy109 = grid
    var gridCopy110 = grid
    var gridCopy111 = grid
    var gridCopy112 = grid
    var gridCopy113 = grid
    var gridCopy114 = grid
    var gridCopy115 = grid
    var gridCopy116 = grid
    var gridCopy117 = grid
    var gridCopy118 = grid
    var gridCopy119 = grid
    var gridCopy120 = grid
    var gridCopy121 = grid
    var gridCopy122 = grid
    var gridCopy123 = grid
    var gridCopy124 = grid
    var gridCopy125 = grid
    var gridCopy126
XCTAssertTrue(maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6) // cannot find 'maxFill' in scope
XCTAssertTrue(maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5) // cannot find 'maxFill' in scope
XCTAssertTrue(maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0) // cannot find 'maxFill' in scope
XCTAssertTrue(maxFill(grid: [[1, 1, 1, 1], [1, 1, 1, 1]], capacity: 2) == 4) // cannot find 'maxFill' in scope
XCTAssertTrue(maxFill(grid: [[1, 1, 1, 1], [1, 1, 1, 1]], capacity: 9) == 2) // cannot find 'maxFill' in scope

```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 {
    // Write your code here
    var max = 0
    var count = 0
    var i = 0
    var j = 0
    var k = 0
    var l = 0
    var m = 0
    var n = 0
    var mx = 0
    var mn = 0
    var mx2 = 0
    var mn2 = 0
    var mx3 = 0
    var mn3 = 0
    var mx4 = 0
    var mn4 = 0
    var mx5 = 0
    var mn5 = 0
    var mx6 = 0
    var mn6 = 0
    var mx7 = 0
    var mn7 = 0
    var mx8 = 0
    var mn8 = 0
    var mx9 = 0
    var mn9 = 0
    var mx10 = 0
    var mn10 = 0
    var mx11 = 0
    var mn11 = 0
    var mx12 = 0
    var mn12 = 0
    var mx13 = 0
    var mn13 = 0
    var mx14 = 0
    var mn14 = 0
    var mx15 = 0
    var mn15 = 0
    var mx16 = 0
    var mn16 = 0
    var mx17 = 0
    var mn17 = 0
    var mx18 = 0
    var mn18 = 0
    var mx19 = 0
    var mn19 = 0
    var mx20 = 0
    var mn20 = 0
    var mx21 = 0
    var mn21 = 0
    var mx22 = 0
    var mn22 = 0
    var mx23 = 0
    var mn23 = 0
    var mx24 = 0
    var mn24 = 0
    var mx25 = 0
    var mn25 = 0
    var mx26 = 0
    var mn26 = 0
    var mx27 = 0
    var mn27 = 0
    var mx28 = 0
    var mn28 = 0
    var mx29 = 0
    var mn29 = 0
    var mx30 = 0
    var mn30 = 0
    var mx31 = 0
    var mn31 = 0
    var mx32 = 0
    var mn32 = 0
    var mx33 = 0
    var mn33 = 0
    var mx34 = 0
    var mn34 = 0
    var mx35 = 0
    var mn35 = 0
    var mx36 = 0
    var mn36 = 0
    var mx37 = 0
    var mn37 = 0
    var mx38 = 0
    var mn38 = 0
    var mx39 = 0
    var mn39 = 0
    var mx40 = 0
    var mn40 = 0
    var mx41 = 0
    var mn41 = 0
    var mx42 = 0
    var mn42 = 0
    var mx43 = 0
    var mn43 = 0
    var mx44 = 0
    var mn44 = 0
    var mx45 = 0
    var mn45 = 0
    var mx46 = 0
    var mn46 = 0
    var mx47 = 0
    var mn47 = 0
    var mx48 = 0
    var mn48 = 0
    var mx49 = 0
    var mn49 = 0
    var mx50 = 0
    var mn50 = 0
    var mx51 = 0
    var mn51 = 0
    var mx52 = 0
    var mn52 = 0
    var mx53 = 0
    var mn53 = 0
    var mx54 = 0
    var mn54 = 0
    var mx55 = 0
    var mn55 = 0
    var mx56 = 0
    var mn56 = 0
    var mx57 = 0
    var mn57 = 0
    var mx58 = 0
    var mn58 = 0
    var mx59 = 0
    var mn59 = 0
    var mx60 = 0
    var mn60 = 0
    var mx61 = 0
    var
XCTAssertTrue(maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6) // cannot find 'maxFill' in scope
XCTAssertTrue(maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5) // cannot find 'maxFill' in scope
XCTAssertTrue(maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0) // cannot find 'maxFill' in scope
XCTAssertTrue(maxFill(grid: [[1, 1, 1, 1], [1, 1, 1, 1]], capacity: 2) == 4) // cannot find 'maxFill' in scope
XCTAssertTrue(maxFill(grid: [[1, 1, 1, 1], [1, 1, 1, 1]], capacity: 9) == 2) // cannot find 'maxFill' in scope

func sortArray(arr: [Int]) -> [Int] {
    // TODO: Add your code here
}
```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] {
    // TODO: Add your code here
}
```
} // missing return in global function expected to return '[Int]'

func sortArray(arr: [Int]) -> [Int] {
    // TODO: Add your code here
}
```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] {
    // TODO: Add your code here
}
```
} // missing return in global function expected to return '[Int]'

func sortArray(arr: [Int]) -> [Int] {
    // TODO: Add your code here
}
```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] {
    // TODO: Add your code here
}
```
} // missing return in global function expected to return '[Int]'

func sortArray(arr: [Int]) -> [Int] {
    // TODO: Add your code here
}
```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] {
    // TODO: Add your code here
}
```
} // missing return in global function expected to return '[Int]'

func sortArray(arr: [Int]) -> [Int] {
    // TODO: Add your code here
}
```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] {
    // TODO: Add your code here
}
```
} // missing return in global function expected to return '[Int]'

func sortArray(arr: [Int]) -> [Int] {
    // TODO: Add your code here
}
```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] {
    // TODO: Add your code here
}
```
} // missing return in global function expected to return '[Int]'

func sortArray(arr: [Int]) -> [Int] {
    // TODO: Add your code here
}
```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] {
    // TODO: Add your code here
}
```
} // missing return in global function expected to return '[Int]'

func sortArray(arr: [Int]) -> [Int] {
    // TODO: Add your code here
}
```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] {
    // TODO: Add your code here
}
```
} // missing return in global function expected to return '[Int]'

func sortArray(arr: [Int]) -> [Int] {
    // TODO: Add your code here
}
```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] {
    // TODO: Add your code here
}
```
} // missing return in global function expected to return '[Int]'

func sortArray(arr: [Int]) -> [Int] {
    // TODO: Add your code here
}
```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] {
    // TODO: Add your code here
}
```
} // missing return in global function expected to return '[Int]'

func selectWords(s: String, n: Int) -> [String] {
    var words = [String]()
    let consonants = "bcdfghjklmnpqrstvwxyz"
    let wordsArray = s.components(separatedBy: " ")
    for word in wordsArray {
        let wordArray = word.split(separator: " ")
        if wordArray.count == 1 {
            let word = wordArray[0]
            var count = 0
            for char in word {
                if!consonants.contains(char) {
                    count += 1
                }
            }
            if count == n {
                words.append(word)
            }
        }
    }
    return words
}
```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 = [String]()
    let consonants = "bcdfghjklmnpqrstvwxyz"
    let wordsArray = s.components(separatedBy: " ")
    for word in wordsArray {
        let wordArray = word.split(separator: " ")
        if wordArray.count == 1 {
            let word = wordArray[0]
            var count = 0
            for char in word {
                if!consonants.contains(char) {
                    count += 1
                }
            }
            if count == n {
                words.append(word)
            }
        }
    }
    return words
}
```
if!consonants.contains(char) { // expected expression, var, or let in 'if' condition
words.append(word) // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'String'

func selectWords(s: String, n: Int) -> [String] {
    // TODO: implement me!
}
```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] {
    // TODO: implement me!
}
```
} // missing return in global function expected to return '[String]'

func selectWords(s: String, n: Int) -> [String] {
    // Your implementation goes here
}
```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] {
    // Your implementation goes here
}
```
} // missing return in global function expected to return '[String]'

func selectWords(s: String, n: Int) -> [String] {
    var words = [String]()
    var word = ""
    var consonants = 0
    
    for character in s.characters {
        if character == " " {
            if consonants == n {
                words.append(word)
            }
            word = ""
            consonants = 0
        } else if character.isLowercase {
            if!character.isConsonant() {
                consonants += 1
            }
            word.append(character)
        }
    }
    
    if consonants == n {
        words.append(word)
    }
    
    return words
}
```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 = [String]()
    var word = ""
    var consonants = 0
    
    for character in s.characters {
        if character == " " {
            if consonants == n {
                words.append(word)
            }
            word = ""
            consonants = 0
        } else if character.isLowercase {
            if!character.isConsonant() {
                consonants += 1
            }
            word.append(character)
        }
    }
    
    if consonants == n {
        words.append(word)
    }
    
    return words
}
```
for character in s.characters { // 'characters' is unavailable: Please use String directly
if!character.isConsonant() { // expected expression, var, or let in 'if' condition

func selectWords(s: String, n: Int) -> [String] {
    var words = [String]()
    var word = ""
    var consonants = 0
    
    for c in s.characters {
        if c == " " {
            if consonants == n {
                words.append(word)
            }
            word = ""
            consonants = 0
        } else if isConsonant(c) {
            word += c
            consonants += 1
        }
    }
    
    if consonants == n {
        words.append(word)
    }
    
    return words
}

func isConsonant(c: Character) -> Bool {
    if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
        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 words = [String]()
    var word = ""
    var consonants = 0
    
    for c in s.characters {
        if c == " " {
            if consonants == n {
                words.append(word)
            }
            word = ""
            consonants = 0
        } else if isConsonant(c) {
            word += c
            consonants += 1
        }
    }
    
    if consonants == n {
        words.append(word)
    }
    
    return words
}

func isConsonant(c: Character) -> Bool {
    if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
        return false
    }
    return true
}
```
for c in s.characters { // 'characters' is unavailable: Please use String directly
} else if isConsonant(c) { // missing argument label 'c:' in call
word += c // cannot convert value of type 'Character' to expected argument type 'String'

func selectWords(s: String, n: Int) -> [String] {
    // TODO: implement me!
}
```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] {
    // TODO: implement me!
}
```
} // missing return in global function expected to return '[String]'

func selectWords(s: String, n: Int) -> [String] {
    
    var words: [String] = []
    
    // Split the string into an array of words
    let wordsArray = s.components(separatedBy: " ")
    
    // Loop through each word
    for word in wordsArray {
        
        // Count the number of consonants in the word
        let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" }
        let count = consonants.count
        
        // If the word contains the correct number of consonants, add it to the array
        if count == n {
            words.append(word)
        }
    }
    
    return words
}
```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: [String] = []
    
    // Split the string into an array of words
    let wordsArray = s.components(separatedBy: " ")
    
    // Loop through each word
    for word in wordsArray {
        
        // Count the number of consonants in the word
        let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" }
        let count = consonants.count
        
        // If the word contains the correct number of consonants, add it to the array
        if count == n {
            words.append(word)
        }
    }
    
    return words
}
```
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // expression is not assignable: '&&' returns immutable value
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type 'String' to expected argument type 'Bool'
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // '=' must have consistent whitespace on both sides
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type '()' to expected argument type 'Bool'
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type 'String' to expected argument type 'Bool'
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type '()' to expected argument type 'Bool'
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // trailing closure passed to parameter of type 'Predicate<String.Element>' (aka 'Predicate<Character>') that does not accept a closure
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type 'String' to expected argument type 'Bool'
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type '()' to expected argument type 'Bool'
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // expression is not assignable: '&&' returns immutable value
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // '=' must have consistent whitespace on both sides
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot assign through '!': '$0' is immutable
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // '=' must have consistent whitespace on both sides
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // '=' must have consistent whitespace on both sides
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // '=' must have consistent whitespace on both sides
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type 'String' to expected argument type 'Bool'
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type '()' to expected argument type 'Bool'
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // expression is not assignable: '&&' returns immutable value
let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // expression is not assignable: '&&' returns immutable value

func selectWords(s: String, n: Int) -> [String] {
    // TODO: Implement this function
}
```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] {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return '[String]'

func selectWords(s: String, n: Int) -> [String] {
    var words = [String]()
    var currentWord = ""
    var currentConsonants = 0
    
    for character in s {
        if character.isLetter {
            if character.isVowel {
                currentWord += character
            } else {
                currentConsonants += 1
                currentWord += character
            }
        } else {
            if currentWord.count > 0 {
                if currentConsonants == n {
                    words.append(currentWord)
                }
                currentWord = ""
                currentConsonants = 0
            }
        }
    }
    
    if currentWord.count > 0 {
        if currentConsonants == n {
            words.append(currentWord)
        }
    }
    
    return words
}
```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 = [String]()
    var currentWord = ""
    var currentConsonants = 0
    
    for character in s {
        if character.isLetter {
            if character.isVowel {
                currentWord += character
            } else {
                currentConsonants += 1
                currentWord += character
            }
        } else {
            if currentWord.count > 0 {
                if currentConsonants == n {
                    words.append(currentWord)
                }
                currentWord = ""
                currentConsonants = 0
            }
        }
    }
    
    if currentWord.count > 0 {
        if currentConsonants == n {
            words.append(currentWord)
        }
    }
    
    return words
}
```
if character.isVowel { // value of type 'Character' has no member 'isVowel'
currentWord += character // cannot convert value of type 'Character' to expected argument type 'String'
currentWord += character // cannot convert value of type 'Character' to expected argument type 'String'

func selectWords(s: String, n: Int) -> [String] {
    var words: [String] = []
    var word: String = ""
    var consonants: Int = 0
    
    for c in s.characters {
        if c == " " {
            if consonants == n {
                words.append(word)
            }
            word = ""
            consonants = 0
        } else if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            word += c
        } else {
            word += c
            consonants += 1
        }
    }
    
    if consonants == n {
        words.append(word)
    }
    
    return words
}
```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: [String] = []
    var word: String = ""
    var consonants: Int = 0
    
    for c in s.characters {
        if c == " " {
            if consonants == n {
                words.append(word)
            }
            word = ""
            consonants = 0
        } else if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            word += c
        } else {
            word += c
            consonants += 1
        }
    }
    
    if consonants == n {
        words.append(word)
    }
    
    return words
}
```
for c in s.characters { // 'characters' is unavailable: Please use String directly
word += c // cannot convert value of type 'Character' to expected argument type 'String'
word += c // cannot convert value of type 'Character' to expected argument type 'String'

func getClosestVowel(word: String) -> String {
    // TODO: implement getClosestVowel
}
```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 {
    // TODO: implement getClosestVowel
}
```
} // missing return in global function expected to return 'String'

func getClosestVowel(word: String) -> String {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'String'

func getClosestVowel(word: String) -> String {
    let vowels = "aeiou"
    var vowel: String = ""
    var consonants: String = ""
    
    for character in word {
        if vowels.containsString(character) {
            vowel = String(character)
        } else {
            consonants.append(character)
        }
    }
    
    if vowel.isEmpty {
        return ""
    }
    
    let vowelIndex = vowels.rangeOfString(vowel)
    
    if vowelIndex.location == word.endIndex {
        return ""
    }
    
    let nextVowelIndex = vowels.rangeOfString(vowel, options:.BackwardsSearch)
    
    if nextVowelIndex.location == word.endIndex {
        return ""
    }
    
    let nextVowel = word[nextVowelIndex.location]
    
    if vowelIndex.location == word.startIndex {
        return nextVowel
    }
    
    let previousVowelIndex = vowels.rangeOfString(vowel, options:.ForwardSearch)
    let previousVowel = word[previousVowelIndex.location]
    
    if vowelIndex.location < nextVowelIndex.location {
        return previousVowel
    } else {
        return nextVowel
    }
}
```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"
    var vowel: String = ""
    var consonants: String = ""
    
    for character in word {
        if vowels.containsString(character) {
            vowel = String(character)
        } else {
            consonants.append(character)
        }
    }
    
    if vowel.isEmpty {
        return ""
    }
    
    let vowelIndex = vowels.rangeOfString(vowel)
    
    if vowelIndex.location == word.endIndex {
        return ""
    }
    
    let nextVowelIndex = vowels.rangeOfString(vowel, options:.BackwardsSearch)
    
    if nextVowelIndex.location == word.endIndex {
        return ""
    }
    
    let nextVowel = word[nextVowelIndex.location]
    
    if vowelIndex.location == word.startIndex {
        return nextVowel
    }
    
    let previousVowelIndex = vowels.rangeOfString(vowel, options:.ForwardSearch)
    let previousVowel = word[previousVowelIndex.location]
    
    if vowelIndex.location < nextVowelIndex.location {
        return previousVowel
    } else {
        return nextVowel
    }
}
```
if vowels.containsString(character) { // value of type 'String' has no member 'containsString'
let vowelIndex = vowels.rangeOfString(vowel) // value of type 'String' has no member 'rangeOfString'
let nextVowelIndex = vowels.rangeOfString(vowel, options:.BackwardsSearch) // value of type 'String' has no member 'rangeOfString'
let nextVowelIndex = vowels.rangeOfString(vowel, options:.BackwardsSearch) // cannot infer contextual base in reference to member 'BackwardsSearch'
let previousVowelIndex = vowels.rangeOfString(vowel, options:.ForwardSearch) // value of type 'String' has no member 'rangeOfString'
let previousVowelIndex = vowels.rangeOfString(vowel, options:.ForwardSearch) // cannot infer contextual base in reference to member 'ForwardSearch'

func getClosestVowel(word: String) -> String {
    var vowels = "aeiouAEIOU"
    var result = ""
    var index = 0
    
    for i in word.characters.enumerated() {
        if i.offset < word.characters.count - 1 {
            if vowels.contains(String(i.element)) {
                index = i.offset
                break
            }
        }
    }
    
    for i in word.characters.enumerated() {
        if i.offset > index {
            if vowels.contains(String(i.element)) {
                result = String(i.element)
                break
            }
        }
    }
    
    return result
}
```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 vowels = "aeiouAEIOU"
    var result = ""
    var index = 0
    
    for i in word.characters.enumerated() {
        if i.offset < word.characters.count - 1 {
            if vowels.contains(String(i.element)) {
                index = i.offset
                break
            }
        }
    }
    
    for i in word.characters.enumerated() {
        if i.offset > index {
            if vowels.contains(String(i.element)) {
                result = String(i.element)
                break
            }
        }
    }
    
    return result
}
```
var vowels = "aeiouAEIOU" // variable 'vowels' was never mutated; consider changing to 'let' constant
for i in word.characters.enumerated() { // 'characters' is unavailable: Please use String directly
if i.offset < word.characters.count - 1 { // 'characters' is unavailable: Please use String directly
for i in word.characters.enumerated() { // 'characters' is unavailable: Please use String directly

func getClosestVowel(word: String) -> String {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'String'

func getClosestVowel(word: String) -> String {
    // TODO: implement me
}
```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 {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'String'

func getClosestVowel(word: String) -> String {
    var vowels = ["a", "e", "i", "o", "u"]
    var vowel = ""
    var index = 0
    var i = 0
    
    while i < word.count {
        if vowels.contains(word[i]) {
            if index == 0 {
                vowel = word[i]
                index = i
            }
        } else {
            if index!= 0 {
                vowel = word[index]
                break
            }
        }
        i += 1
    }
    
    return vowel
}
```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 vowels = ["a", "e", "i", "o", "u"]
    var vowel = ""
    var index = 0
    var i = 0
    
    while i < word.count {
        if vowels.contains(word[i]) {
            if index == 0 {
                vowel = word[i]
                index = i
            }
        } else {
            if index!= 0 {
                vowel = word[index]
                break
            }
        }
        i += 1
    }
    
    return vowel
}
```
if vowels.contains(word[i]) { // cannot convert value of type 'Character' to expected argument type 'String'
vowel = word[i] // cannot assign value of type 'Character' to type 'String'
if index!= 0 { // cannot force unwrap value of non-optional type 'Int'
if index!= 0 { // use of '=' in a boolean context, did you mean '=='?
if index!= 0 { // '=' must have consistent whitespace on both sides
vowel = word[index] // cannot assign value of type 'Character' to type 'String'

func getClosestVowel(word: String) -> String {
    let vowels = "aeiou"
    var result = ""
    var index = word.index(before: word.endIndex)
    while index!= word.startIndex {
        if vowels.contains(String(word[index])) {
            result = String(word[index])
            break
        }
        index = word.index(before: index)
    }
    return result
}
```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"
    var result = ""
    var index = word.index(before: word.endIndex)
    while index!= word.startIndex {
        if vowels.contains(String(word[index])) {
            result = String(word[index])
            break
        }
        index = word.index(before: index)
    }
    return result
}
```
while index!= word.startIndex { // cannot force unwrap value of non-optional type 'String.Index'
while index!= word.startIndex { // use of '=' in a boolean context, did you mean '=='?
while index!= word.startIndex { // '=' must have consistent whitespace on both sides

func getClosestVowel(word: String) -> String {
    // TODO:
    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 {
    // TODO:
    return ""
}
```
 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    var vowels = ["a", "e", "i", "o", "u"]
    var result = ""
    var index = 0
    var lastConsonant = ""
    var lastVowel = ""
    
    for i in word.characters.enumerated() {
        if vowels.contains(String(i.element)) {
            lastVowel = String(i.element)
        } else if!vowels.contains(String(i.element)) {
            lastConsonant = String(i.element)
        }
        
        if lastConsonant!= "" && lastVowel!= "" {
            if abs(word.index(word.startIndex, offsetBy: index) - word.index(word.startIndex, offsetBy: word.index(word.startIndex, offsetBy: word.index(word.startIndex, offsetBy: lastConsonant.index(lastConsonant.startIndex, offsetBy: 1))))) < abs(word.index(word.startIndex, offsetBy: index) - word.index(word.startIndex, offsetBy: word.index(word.startIndex, offsetBy: word.index(word.startIndex, offsetBy: lastVowel.index(lastVowel.startIndex, offsetBy: 1))))) {
                result = lastConsonant
            } else {
                result = lastVowel
            }
            
            lastConsonant = ""
            lastVowel = ""
        }
        
        index += 1
    }
    
    return result
}
```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 vowels = ["a", "e", "i", "o", "u"]
    var result = ""
    var index = 0
    var lastConsonant = ""
    var lastVowel = ""
    
    for i in word.characters.enumerated() {
        if vowels.contains(String(i.element)) {
            lastVowel = String(i.element)
        } else if!vowels.contains(String(i.element)) {
            lastConsonant = String(i.element)
        }
        
        if lastConsonant!= "" && lastVowel!= "" {
            if abs(word.index(word.startIndex, offsetBy: index) - word.index(word.startIndex, offsetBy: word.index(word.startIndex, offsetBy: word.index(word.startIndex, offsetBy: lastConsonant.index(lastConsonant.startIndex, offsetBy: 1))))) < abs(word.index(word.startIndex, offsetBy: index) - word.index(word.startIndex, offsetBy: word.index(word.startIndex, offsetBy: word.index(word.startIndex, offsetBy: lastVowel.index(lastVowel.startIndex, offsetBy: 1))))) {
                result = lastConsonant
            } else {
                result = lastVowel
            }
            
            lastConsonant = ""
            lastVowel = ""
        }
        
        index += 1
    }
    
    return result
}
```

func matchParens(lst: [String]) -> String {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'String'

func matchParens(lst: [String]) -> String {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func matchParens(lst: [String]) -> String {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'String'

func matchParens(lst: [String]) -> String {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func matchParens(lst: [String]) -> String {
    // 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 {
    // Your code here
}
```
} // missing return in global function expected to return 'String'

func matchParens(lst: [String]) -> String {
    // TODO: Implement me!
}
```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 {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func matchParens(lst: [String]) -> String {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'String'

func matchParens(lst: [String]) -> String {
    var result = "No"
    var stack = [Character]()
    for s in lst {
        for c in s {
            if c == "(" {
                stack.append(c)
            } else {
                if stack.isEmpty {
                    result = "No"
                    break
                }
                let top = stack.removeLast()
                if top == "(" {
                    result = "Yes"
                    break
                }
            }
        }
        if result == "No" {
            break
        }
    }
    return result
}
```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 result = "No"
    var stack = [Character]()
    for s in lst {
        for c in s {
            if c == "(" {
                stack.append(c)
            } else {
                if stack.isEmpty {
                    result = "No"
                    break
                }
                let top = stack.removeLast()
                if top == "(" {
                    result = "Yes"
                    break
                }
            }
        }
        if result == "No" {
            break
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    var result = "No"
    var stack = [Character]()
    for s in lst {
        for c in s {
            if c == "(" {
                stack.append(c)
            } else {
                if stack.isEmpty {
                    result = "No"
                    break
                }
                if stack.last == "(" {
                    stack.removeLast()
                } else {
                    result = "No"
                    break
                }
            }
        }
        if result == "No" {
            break
        }
    }
    if stack.isEmpty {
        result = "Yes"
    }
    return result
}
```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 result = "No"
    var stack = [Character]()
    for s in lst {
        for c in s {
            if c == "(" {
                stack.append(c)
            } else {
                if stack.isEmpty {
                    result = "No"
                    break
                }
                if stack.last == "(" {
                    stack.removeLast()
                } else {
                    result = "No"
                    break
                }
            }
        }
        if result == "No" {
            break
        }
    }
    if stack.isEmpty {
        result = "Yes"
    }
    return result
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    // TODO: implement me!
    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 {
    // TODO: implement me!
    return "Yes"
}
```
 // XCTAssertTrue failed

func maximum(arr: [Int], k: Int) -> [Int] {
    var max = [Int]()
    var i = 0
    while i < k {
        var max = arr[0]
        for j in 0..<arr.count {
            if arr[j] > max {
                max = arr[j]
            }
        }
        max = max.removeAll()
        max.append(max)
        arr.removeAll()
        arr.append(max)
        i += 1
    }
    return arr
}
```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 max = [Int]()
    var i = 0
    while i < k {
        var max = arr[0]
        for j in 0..<arr.count {
            if arr[j] > max {
                max = arr[j]
            }
        }
        max = max.removeAll()
        max.append(max)
        arr.removeAll()
        arr.append(max)
        i += 1
    }
    return arr
}
```
max = max.removeAll() // value of type 'Int' has no member 'removeAll'
max.append(max) // value of type 'Int' has no member 'append'
arr.removeAll() // cannot use mutating member on immutable value: 'arr' is a 'let' constant
arr.append(max) // cannot use mutating member on immutable value: 'arr' is a 'let' constant

func maximum(arr: [Int], k: Int) -> [Int] {
    var result = [Int]()
    var i = 0
    var j = 0
    while i < k {
        if arr[j] > arr[i] {
            result.append(arr[j])
            i += 1
        } else {
            result.append(arr[i])
            j += 1
        }
    }
    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 result = [Int]()
    var i = 0
    var j = 0
    while i < k {
        if arr[j] > arr[i] {
            result.append(arr[j])
            i += 1
        } else {
            result.append(arr[i])
            j += 1
        }
    }
    return result
}
```
 // Fatal error: Index out of range

func maximum(arr: [Int], k: Int) -> [Int] {
    // 先排序
    let sortedArr = arr.sorted()
    // 取出前k个数
    let kArr = sortedArr.prefix(k)
    // 返回排序后的数组
    return kArr.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] {
    // 先排序
    let sortedArr = arr.sorted()
    // 取出前k个数
    let kArr = sortedArr.prefix(k)
    // 返回排序后的数组
    return kArr.sorted()
}
```
 // XCTAssertTrue failed

func maximum(arr: [Int], k: Int) -> [Int] {
    let sortedArr = arr.sorted()
    var result = [Int]()
    for i in 0..<k {
        result.append(sortedArr[arr.count - k + 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] {
    let sortedArr = arr.sorted()
    var result = [Int]()
    for i in 0..<k {
        result.append(sortedArr[arr.count - k + i])
    }
    return result
}
```

func maximum(arr: [Int], k: Int) -> [Int] {
    var result: [Int] = []
    var heap: [Int] = []
    for i in 0..<k {
        heap.append(arr[i])
    }
    heapify(heap)
    for i in k..<arr.count {
        heap.append(arr[i])
        heap.remove(at: 0)
        heap.insert(arr[i], at: 0)
        heapify(heap)
    }
    for i in 0..<k {
        result.append(heap[i])
    }
    return result
}

func heapify(arr: [Int]) {
    var i = 0
    var l = 2 * i + 1
    var r = 2 * i + 2
    var largest = i
    while l < arr.count {
        if l < arr.count && arr[l] > arr[largest] {
            largest = l
        }
        if r < arr.count && arr[r] > arr[largest] {
            largest = r
        }
        if largest!= i {
            swap(&arr[i], &arr[largest])
            i = largest
            l = 2 * i + 1
            r = 2 * i + 2
        } else {
            break
        }
    }
}
```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 result: [Int] = []
    var heap: [Int] = []
    for i in 0..<k {
        heap.append(arr[i])
    }
    heapify(heap)
    for i in k..<arr.count {
        heap.append(arr[i])
        heap.remove(at: 0)
        heap.insert(arr[i], at: 0)
        heapify(heap)
    }
    for i in 0..<k {
        result.append(heap[i])
    }
    return result
}

func heapify(arr: [Int]) {
    var i = 0
    var l = 2 * i + 1
    var r = 2 * i + 2
    var largest = i
    while l < arr.count {
        if l < arr.count && arr[l] > arr[largest] {
            largest = l
        }
        if r < arr.count && arr[r] > arr[largest] {
            largest = r
        }
        if largest!= i {
            swap(&arr[i], &arr[largest])
            i = largest
            l = 2 * i + 1
            r = 2 * i + 2
        } else {
            break
        }
    }
}
```
heapify(heap) // missing argument label 'arr:' in call
heapify(heap) // missing argument label 'arr:' in call
if largest!= i { // cannot force unwrap value of non-optional type 'Int'
if largest!= i { // use of '=' in a boolean context, did you mean '=='?
if largest!= i { // '=' must have consistent whitespace on both sides
swap(&arr[i], &arr[largest]) // cannot pass immutable value as inout argument: 'arr' is a 'let' constant
swap(&arr[i], &arr[largest]) // cannot pass immutable value as inout argument: 'arr' is a 'let' constant

func maximum(arr: [Int], k: Int) -> [Int] {
    var max = [Int]()
    var i = 0
    var j = 0
    while i < k {
        if arr[j] > arr[j+1] {
            max.append(arr[j])
            i += 1
        } else {
            max.append(arr[j+1])
            i += 1
        }
        j += 1
    }
    return max
}
```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 max = [Int]()
    var i = 0
    var j = 0
    while i < k {
        if arr[j] > arr[j+1] {
            max.append(arr[j])
            i += 1
        } else {
            max.append(arr[j+1])
            i += 1
        }
        j += 1
    }
    return max
}
```
 // Fatal error: Index out of range

func maximum(arr: [Int], k: Int) -> [Int] {
    var result: [Int] = []
    var index = 0
    var count = 0
    for i in 0..<arr.count {
        if count < k {
            result.append(arr[i])
            count += 1
        } else {
            if arr[i] > result[index] {
                result[index] = arr[i]
            }
            index += 1
            if index == k {
                index = 0
            }
        }
    }
    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 result: [Int] = []
    var index = 0
    var count = 0
    for i in 0..<arr.count {
        if count < k {
            result.append(arr[i])
            count += 1
        } else {
            if arr[i] > result[index] {
                result[index] = arr[i]
            }
            index += 1
            if index == k {
                index = 0
            }
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func maximum(arr: [Int], k: Int) -> [Int] {
    var max = [Int]()
    var i = 0
    var j = 0
    while i < k {
        if j < arr.count {
            max.append(arr[j])
            i += 1
        }
        j += 1
    }
    return max
}
```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 max = [Int]()
    var i = 0
    var j = 0
    while i < k {
        if j < arr.count {
            max.append(arr[j])
            i += 1
        }
        j += 1
    }
    return max
}
```
 // XCTAssertTrue failed

func maximum(arr: [Int], k: Int) -> [Int] {
    var result: [Int] = [Int]()
    var index = 0
    for i in 0..<k {
        if index == arr.count {
            break
        }
        result.append(arr[index])
        index += 1
    }
    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 result: [Int] = [Int]()
    var index = 0
    for i in 0..<k {
        if index == arr.count {
            break
        }
        result.append(arr[index])
        index += 1
    }
    return result
}
```
for i in 0..<k { // immutable value 'i' was never used; consider replacing with '_' or removing it
 // XCTAssertTrue failed

```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 max = [Int]()
    var maxIndex = [Int]()
    var maxValue = [Int]()
    var maxIndexValue = [Int]()
    var maxIndexValue2 = [Int]()
    var maxIndexValue3 = [Int]()
    var maxIndexValue4 = [Int]()
    var maxIndexValue5 = [Int]()
    var maxIndexValue6 = [Int]()
    var maxIndexValue7 = [Int]()
    var maxIndexValue8 = [Int]()
    var maxIndexValue9 = [Int]()
    var maxIndexValue10 = [Int]()
    var maxIndexValue11 = [Int]()
    var maxIndexValue12 = [Int]()
    var maxIndexValue13 = [Int]()
    var maxIndexValue14 = [Int]()
    var maxIndexValue15 = [Int]()
    var maxIndexValue16 = [Int]()
    var maxIndexValue17 = [Int]()
    var maxIndexValue18 = [Int]()
    var maxIndexValue19 = [Int]()
    var maxIndexValue20 = [Int]()
    var maxIndexValue21 = [Int]()
    var maxIndexValue22 = [Int]()
    var maxIndexValue23 = [Int]()
    var maxIndexValue24 = [Int]()
    var maxIndexValue25 = [Int]()
    var maxIndexValue26 = [Int]()
    var maxIndexValue27 = [Int]()
    var maxIndexValue28 = [Int]()
    var maxIndexValue29 = [Int]()
    var maxIndexValue30 = [Int]()
    var maxIndexValue31 = [Int]()
    var maxIndexValue32 = [Int]()
    var maxIndexValue33 = [Int]()
    var maxIndexValue34 = [Int]()
    var maxIndexValue35 = [Int]()
    var maxIndexValue36 = [Int]()
    var maxIndexValue37 = [Int]()
    var maxIndexValue38 = [Int]()
    var maxIndexValue39 = [Int]()
    var maxIndexValue40 = [Int]()
    var maxIndexValue41 = [Int]()
    var maxIndexValue42 = [Int]()
    var maxIndexValue43 = [Int]()
    var maxIndexValue44 = [Int]()
    var maxIndexValue45 = [Int]()
    var maxIndexValue46 = [Int]()
    var maxIndexValue47 = [Int]()
    var maxIndexValue48 = [Int]()
    var maxIndexValue49 = [Int]()
    var maxIndexValue50 = [Int]()
    var maxIndexValue51 = [Int]()
    var maxIndexValue52 = [Int]()
    var maxIndexValue53 = [Int]()
    var maxIndexValue54 = [Int]()
    var maxIndexValue55 = [Int]()
    var maxIndexValue56 = [Int]()
    var maxIndexValue57 = [Int]()
    var maxIndexValue58 = [Int]()
    var maxIndexValue59 = [Int]()
    var maxIndexValue60 = [Int]()
    var maxIndexValue61 = [Int]()
    var maxIndexValue62 = [Int]()
    var maxIndexValue63 = [Int]()
    var maxIndexValue64 = [Int]()
    var maxIndexValue65 = [Int]()
    var maxIndexValue66 = [Int]()
    var maxIndexValue67 = [Int]()
    var maxIndexValue68 = [Int]()
    var maxIndexValue69 = [Int]()
    var maxIndexValue70 = [Int]()
    var maxIndexValue71 = [Int]()
    var maxIndexValue72 = [Int]()
    var maxIndexValue73 = [Int]()
    var maxIndexValue74 = [Int]()
    var maxIndexValue75 = [Int]()
    var maxIndexValue76 = [Int]()
    var maxIndexValue77 = [Int]()
    var maxIndexValue78 = [Int]()
    var maxIndexValue79 = [Int]()
    var maxIndexValue80 = [Int]()
    var maxIndexValue81 = [Int]()
    var maxIndexValue82 = [Int]()
    var maxIndexValue83 = [Int]()
XCTAssertTrue(maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]) // cannot find 'maximum' in scope
XCTAssertTrue(maximum(arr: [4, -4, 4], k: 2) == [4, 4]) // cannot find 'maximum' in scope
XCTAssertTrue(maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]) // cannot find 'maximum' in scope
XCTAssertTrue(maximum(arr: [123, -123, 20, 0, 1, 2, -3], k: 3) == [2, 20, 123]) // cannot find 'maximum' in scope
XCTAssertTrue(maximum(arr: [-123, 20, 0, 1, 2, -3], k: 4) == [0, 1, 2, 20]) // cannot find 'maximum' in scope
XCTAssertTrue(maximum(arr: [5, 15, 0, 3, -13, -8, 0], k: 7) == [-13, -8, 0, 0, 3, 5, 15]) // cannot find 'maximum' in scope
XCTAssertTrue(maximum(arr: [-1, 0, 2, 5, 3, -10], k: 2) == [3, 5]) // cannot find 'maximum' in scope
XCTAssertTrue(maximum(arr: [1, 0, 5, -7], k: 1) == [5]) // cannot find 'maximum' in scope
XCTAssertTrue(maximum(arr: [4, -4], k: 2) == [-4, 4]) // cannot find 'maximum' in scope
XCTAssertTrue(maximum(arr: [-10, 10], k: 2) == [-10, 10]) // cannot find 'maximum' in scope
XCTAssertTrue(maximum(arr: [1, 2, 3, -23, 243, -400, 0], k: 0) == [] as [Int]) // cannot find 'maximum' in scope

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
}
```
if i % 2 == 0 && lst[i] % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if i % 2 == 0 && lst[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2 == 0 && lst[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if i % 2 == 0 && lst[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if i % 2 == 0 && lst[i] % 2!= 0 { // expression is not assignable: '&&' returns immutable value

func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerate() {
        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.enumerate() {
        if index % 2 == 0 && value % 2!= 0 {
            sum += value
        }
    }
    return sum
}
```
for (index, value) in lst.enumerate() { // value of type '[Int]' has no member 'enumerate'
if index % 2 == 0 && value % 2!= 0 { // '=' must have consistent whitespace on both sides

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
}
```
if i % 2 == 0 && lst[i] % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if i % 2 == 0 && lst[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2 == 0 && lst[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if i % 2 == 0 && lst[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if i % 2 == 0 && lst[i] % 2!= 0 { // expression is not assignable: '&&' returns immutable value

func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerate() {
        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.enumerate() {
        if index % 2 == 0 && value % 2!= 0 {
            sum += value
        }
    }
    return sum
}
```
for (index, value) in lst.enumerate() { // value of type '[Int]' has no member 'enumerate'
if index % 2 == 0 && value % 2!= 0 { // '=' must have consistent whitespace on both sides

func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerate() {
        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.enumerate() {
        if index % 2 == 0 && value % 2!= 0 {
            sum += value
        }
    }
    return sum
}
```
for (index, value) in lst.enumerate() { // value of type '[Int]' has no member 'enumerate'
if index % 2 == 0 && value % 2!= 0 { // '=' must have consistent whitespace on both sides

func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerate() {
        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.enumerate() {
        if index % 2 == 0 && value % 2!= 0 {
            sum += value
        }
    }
    return sum
}
```
for (index, value) in lst.enumerate() { // value of type '[Int]' has no member 'enumerate'
if index % 2 == 0 && value % 2!= 0 { // '=' must have consistent whitespace on both sides

func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 {
            if 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 {
            if lst[i] % 2!= 0 {
                sum += lst[i]
            }
        }
    }
    return sum
}
```
if lst[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if lst[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if lst[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if lst[i] % 2!= 0 { // expression is not assignable: binary operator returns immutable value

func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 {
            if 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 {
            if lst[i] % 2!= 0 {
                sum += lst[i]
            }
        }
    }
    return sum
}
```
if lst[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if lst[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if lst[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if lst[i] % 2!= 0 { // expression is not assignable: binary operator returns immutable value

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
}
```
if i % 2 == 0 && lst[i] % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if i % 2 == 0 && lst[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2 == 0 && lst[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if i % 2 == 0 && lst[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if i % 2 == 0 && lst[i] % 2!= 0 { // expression is not assignable: '&&' returns immutable value

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
}
```
if i % 2 == 0 && lst[i] % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if i % 2 == 0 && lst[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2 == 0 && lst[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if i % 2 == 0 && lst[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if i % 2 == 0 && lst[i] % 2!= 0 { // expression is not assignable: '&&' returns immutable value

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    while i < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        if sum > 9 {
            sum -= 9
        }
        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
    while i < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        if sum > 9 {
            sum -= 9
        }
        j += 1
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    // Write your solution here
    var sum = 0
    var i = 0
    while i < k {
        sum += arr[i]
        i += 1
    }
    while i < arr.count {
        if sum > 9 {
            sum = sum % 10 + arr[i] % 10
        } else {
            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 {
    // Write your solution here
    var sum = 0
    var i = 0
    while i < k {
        sum += arr[i]
        i += 1
    }
    while i < arr.count {
        if sum > 9 {
            sum = sum % 10 + arr[i] % 10
        } else {
            sum += arr[i]
        }
        i += 1
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    while i < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        j += 1
        if j < arr.count {
            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
    while i < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        j += 1
        if j < arr.count {
            sum -= arr[i]
            i += 1
        }
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    while i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        j += 1
        if j < k {
            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
    while i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        j += 1
        if j < k {
            sum -= arr[i]
            i += 1
        }
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    while i < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        if sum > 9 {
            sum -= 9
        }
        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
    while i < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        if sum > 9 {
            sum -= 9
        }
        j += 1
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    while i < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        if sum > 9 {
            sum -= 9
        }
        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
    while i < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        if sum > 9 {
            sum -= 9
        }
        j += 1
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    while i < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        if sum > 9 {
            sum -= 9
        }
        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
    while i < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        if sum > 9 {
            sum -= 9
        }
        j += 1
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    while i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        if sum > 9 {
            sum -= 9
        }
        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
    while i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        if sum > 9 {
            sum -= 9
        }
        j += 1
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    while i < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        if sum > 9 {
            sum -= 9
        }
        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
    while i < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    var j = i
    while j < arr.count {
        sum += arr[j]
        if sum > 9 {
            sum -= 9
        }
        j += 1
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var i = 0
    while i < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    if i == arr.count {
        return sum
    }
    var carry = 0
    while i < arr.count {
        let x = arr[i] + carry
        carry = x / 10
        sum += x % 10
        i += 1
    }
    return sum + carry
}
```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 < arr.count && i < k {
        sum += arr[i]
        i += 1
    }
    if i == arr.count {
        return sum
    }
    var carry = 0
    while i < arr.count {
        let x = arr[i] + carry
        carry = x / 10
        sum += x % 10
        i += 1
    }
    return sum + carry
}
```
 // XCTAssertTrue failed

func getOddCollatz(n: Int) -> [Int] {
    var arr = [Int]()
    var i = n
    while i!= 1 {
        if i % 2 == 0 {
            i = i / 2
        } else {
            i = 3 * i + 1
        }
        if i % 2 == 1 {
            arr.append(i)
        }
    }
    return arr
}
```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 arr = [Int]()
    var i = n
    while i!= 1 {
        if i % 2 == 0 {
            i = i / 2
        } else {
            i = 3 * i + 1
        }
        if i % 2 == 1 {
            arr.append(i)
        }
    }
    return arr
}
```
while i!= 1 { // use of '=' in a boolean context, did you mean '=='?
while i!= 1 { // cannot force unwrap value of non-optional type 'Int'
while i!= 1 { // '=' must have consistent whitespace on both sides

func getOddCollatz(n: Int) -> [Int] {
    var collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            collatz.append(current)
        }
    }
    return collatz
}
```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 collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            collatz.append(current)
        }
    }
    return collatz
}
```
while current!= 1 { // cannot force unwrap value of non-optional type 'Int'
while current!= 1 { // use of '=' in a boolean context, did you mean '=='?
while current!= 1 { // '=' must have consistent whitespace on both sides
if current % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if current % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if current % 2!= 0 { // '=' must have consistent whitespace on both sides

func getOddCollatz(n: Int) -> [Int] {
    var collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            collatz.append(current)
        }
    }
    collatz.append(1)
    return collatz.sorted()
}
```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 collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            collatz.append(current)
        }
    }
    collatz.append(1)
    return collatz.sorted()
}
```
while current!= 1 { // cannot force unwrap value of non-optional type 'Int'
while current!= 1 { // use of '=' in a boolean context, did you mean '=='?
while current!= 1 { // '=' must have consistent whitespace on both sides
if current % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if current % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if current % 2!= 0 { // '=' must have consistent whitespace on both sides

func getOddCollatz(n: Int) -> [Int] {
    var collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            collatz.append(current)
        }
    }
    return collatz
}
```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 collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            collatz.append(current)
        }
    }
    return collatz
}
```
while current!= 1 { // cannot force unwrap value of non-optional type 'Int'
while current!= 1 { // use of '=' in a boolean context, did you mean '=='?
while current!= 1 { // '=' must have consistent whitespace on both sides
if current % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if current % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if current % 2!= 0 { // '=' must have consistent whitespace on both sides

func getOddCollatz(n: Int) -> [Int] {
    var collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            collatz.append(current)
        }
    }
    collatz.append(current)
    return collatz.sorted()
}
```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 collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            collatz.append(current)
        }
    }
    collatz.append(current)
    return collatz.sorted()
}
```
while current!= 1 { // cannot force unwrap value of non-optional type 'Int'
while current!= 1 { // use of '=' in a boolean context, did you mean '=='?
while current!= 1 { // '=' must have consistent whitespace on both sides
if current % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if current % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if current % 2!= 0 { // '=' must have consistent whitespace on both sides

func getOddCollatz(n: Int) -> [Int] {
    var collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        if current % 2 == 1 {
            collatz.append(current)
        }
    }
    return collatz
}
```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 collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        if current % 2 == 1 {
            collatz.append(current)
        }
    }
    return collatz
}
```
while current!= 1 { // cannot force unwrap value of non-optional type 'Int'
while current!= 1 { // '=' must have consistent whitespace on both sides
while current!= 1 { // use of '=' in a boolean context, did you mean '=='?

func getOddCollatz(n: Int) -> [Int] {
    var collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2 == 1 {
            collatz.append(current)
        }
    }
    return collatz
}
```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 collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2 == 1 {
            collatz.append(current)
        }
    }
    return collatz
}
```
while current!= 1 { // cannot force unwrap value of non-optional type 'Int'
while current!= 1 { // '=' must have consistent whitespace on both sides
while current!= 1 { // use of '=' in a boolean context, did you mean '=='?

func getOddCollatz(n: Int) -> [Int] {
    var collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            collatz.append(current)
        }
    }
    collatz.append(current)
    return collatz.sorted()
}
```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 collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            collatz.append(current)
        }
    }
    collatz.append(current)
    return collatz.sorted()
}
```
while current!= 1 { // cannot force unwrap value of non-optional type 'Int'
while current!= 1 { // use of '=' in a boolean context, did you mean '=='?
while current!= 1 { // '=' must have consistent whitespace on both sides
if current % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if current % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if current % 2!= 0 { // '=' must have consistent whitespace on both sides

func getOddCollatz(n: Int) -> [Int] {
    var collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            collatz.append(current)
        }
    }
    return collatz
}
```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 collatz = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current = current / 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            collatz.append(current)
        }
    }
    return collatz
}
```
while current!= 1 { // cannot force unwrap value of non-optional type 'Int'
while current!= 1 { // use of '=' in a boolean context, did you mean '=='?
while current!= 1 { // '=' must have consistent whitespace on both sides
if current % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if current % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if current % 2!= 0 { // '=' must have consistent whitespace on both sides

func getOddCollatz(n: Int) -> [Int] {
    var collatz = [Int]()
    var i = n
    while i!= 1 {
        if i % 2 == 0 {
            i = i / 2
        } else {
            i = 3 * i + 1
        }
        collatz.append(i)
    }
    collatz.append(1)
    return collatz.filter { $0 % 2!= 0 }
}
```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 collatz = [Int]()
    var i = n
    while i!= 1 {
        if i % 2 == 0 {
            i = i / 2
        } else {
            i = 3 * i + 1
        }
        collatz.append(i)
    }
    collatz.append(1)
    return collatz.filter { $0 % 2!= 0 }
}
```
while i!= 1 { // '=' must have consistent whitespace on both sides
while i!= 1 { // use of '=' in a boolean context, did you mean '=='?
while i!= 1 { // cannot force unwrap value of non-optional type 'Int'
return collatz.filter { $0 % 2!= 0 } // cannot force unwrap value of non-optional type 'Int'
return collatz.filter { $0 % 2!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
return collatz.filter { $0 % 2!= 0 } // '=' must have consistent whitespace on both sides
return collatz.filter { $0 % 2!= 0 } // expression is not assignable: binary operator returns immutable value

func validDate(date: String) -> Bool {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func validDate(date: String) -> Bool {
    // TODO: Your implementation goes 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 {
    // TODO: Your implementation goes here
}
```
} // missing return in global function expected to return 'Bool'

func validDate(date: String) -> Bool {
    // Your code goes 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 {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func validDate(date: String) -> Bool {
    // Your code goes 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 {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func validDate(date: String) -> Bool {
    // Your code goes 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 {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    if dateComponents.count!= 3 {
        return false
    }
    let month = Int(dateComponents[0])
    let day = Int(dateComponents[1])
    let year = Int(dateComponents[2])
    if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 {
        return false
    }
    if month == 2 {
        return day >= 1 && day <= 29
    }
    if [4, 6, 9, 11].contains(month) {
        return day >= 1 && day <= 30
    }
    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: "-")
    if dateComponents.count!= 3 {
        return false
    }
    let month = Int(dateComponents[0])
    let day = Int(dateComponents[1])
    let year = Int(dateComponents[2])
    if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 {
        return false
    }
    if month == 2 {
        return day >= 1 && day <= 29
    }
    if [4, 6, 9, 11].contains(month) {
        return day >= 1 && day <= 30
    }
    return true
}
```
if dateComponents.count!= 3 { // '=' must have consistent whitespace on both sides
if dateComponents.count!= 3 { // use of '=' in a boolean context, did you mean '=='?
if dateComponents.count!= 3 { // cannot force unwrap value of non-optional type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return day >= 1 && day <= 29 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return day >= 1 && day <= 29 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return day >= 1 && day <= 30 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return day >= 1 && day <= 30 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    if dateComponents.count!= 3 {
        return false
    }
    let month = Int(dateComponents[0])
    let day = Int(dateComponents[1])
    let year = Int(dateComponents[2])
    if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 {
        return false
    }
    if month == 2 {
        return day >= 1 && day <= 28
    }
    if month == 4 || month == 6 || month == 9 || month == 11 {
        return day >= 1 && day <= 30
    }
    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: "-")
    if dateComponents.count!= 3 {
        return false
    }
    let month = Int(dateComponents[0])
    let day = Int(dateComponents[1])
    let year = Int(dateComponents[2])
    if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 {
        return false
    }
    if month == 2 {
        return day >= 1 && day <= 28
    }
    if month == 4 || month == 6 || month == 9 || month == 11 {
        return day >= 1 && day <= 30
    }
    return true
}
```
if dateComponents.count!= 3 { // '=' must have consistent whitespace on both sides
if dateComponents.count!= 3 { // use of '=' in a boolean context, did you mean '=='?
if dateComponents.count!= 3 { // cannot force unwrap value of non-optional type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return day >= 1 && day <= 28 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return day >= 1 && day <= 28 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return day >= 1 && day <= 30 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return day >= 1 && day <= 30 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    if dateComponents.count!= 3 {
        return false
    }
    let month = Int(dateComponents[0])
    let day = Int(dateComponents[1])
    let year = Int(dateComponents[2])
    if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 {
        return false
    }
    if month == 2 {
        if day < 1 || day > 28 {
            return false
        }
    } else if month == 4 || month == 6 || month == 9 || month == 11 {
        if day < 1 || day > 30 {
            return false
        }
    } else if month == 2 && day == 29 {
        if year % 4!= 0 {
            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: "-")
    if dateComponents.count!= 3 {
        return false
    }
    let month = Int(dateComponents[0])
    let day = Int(dateComponents[1])
    let year = Int(dateComponents[2])
    if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 {
        return false
    }
    if month == 2 {
        if day < 1 || day > 28 {
            return false
        }
    } else if month == 4 || month == 6 || month == 9 || month == 11 {
        if day < 1 || day > 30 {
            return false
        }
    } else if month == 2 && day == 29 {
        if year % 4!= 0 {
            return false
        }
    }
    return true
}
```
if dateComponents.count!= 3 { // '=' must have consistent whitespace on both sides
if dateComponents.count!= 3 { // use of '=' in a boolean context, did you mean '=='?
if dateComponents.count!= 3 { // cannot force unwrap value of non-optional type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if day < 1 || day > 28 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if day < 1 || day > 28 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if day < 1 || day > 30 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if day < 1 || day > 30 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if year % 4!= 0 { // cannot force unwrap value of non-optional type 'Int'
if year % 4!= 0 { // use of '=' in a boolean context, did you mean '=='?
if year % 4!= 0 { // '=' must have consistent whitespace on both sides
if year % 4!= 0 { // binary operator '%' cannot be applied to operands of type 'Int?' and 'Int'

func validDate(date: String) -> Bool {
    // TODO: Your implementation goes here
    return false
}
```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 {
    // TODO: Your implementation goes here
    return false
}
```
 // XCTAssertTrue failed

func validDate(date: String) -> Bool {
    let dateComponents = date.components(separatedBy: "-")
    if dateComponents.count!= 3 {
        return false
    }
    let month = Int(dateComponents[0])
    let day = Int(dateComponents[1])
    let year = Int(dateComponents[2])
    if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 {
        return false
    }
    if month == 2 {
        if day > 29 || (day == 29 &&!isLeapYear(year: year)) {
            return false
        }
    } else if month == 4 || month == 6 || month == 9 || month == 11 {
        if 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 dateComponents = date.components(separatedBy: "-")
    if dateComponents.count!= 3 {
        return false
    }
    let month = Int(dateComponents[0])
    let day = Int(dateComponents[1])
    let year = Int(dateComponents[2])
    if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 {
        return false
    }
    if month == 2 {
        if day > 29 || (day == 29 &&!isLeapYear(year: year)) {
            return false
        }
    } else if month == 4 || month == 6 || month == 9 || month == 11 {
        if day > 30 {
            return false
        }
    }
    return true
}
```
if dateComponents.count!= 3 { // '=' must have consistent whitespace on both sides
if dateComponents.count!= 3 { // use of '=' in a boolean context, did you mean '=='?
if dateComponents.count!= 3 { // cannot force unwrap value of non-optional type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if month < 1 || month > 12 || day < 1 || day > 31 || year < 1000 || year > 9999 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if day > 29 || (day == 29 &&!isLeapYear(year: year)) { // expected ',' separator
if day > 29 || (day == 29 &&!isLeapYear(year: year)) { // cannot find 'isLeapYear' in scope
if day > 29 || (day == 29 &&!isLeapYear(year: year)) { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if day > 29 || (day == 29 &&!isLeapYear(year: year)) { // cannot find operator '&&!' in scope
if day > 29 || (day == 29 &&!isLeapYear(year: year)) { // cannot convert value of type '(Bool, _)' to expected argument type 'Bool'
if day > 30 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

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> {
    //...
}

func splitWords(txt: String) -> Result<[String], Int> {
    //...
}
```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> {
    //...
}

// 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> {
    //...
}

// 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> {
    //...
}
```
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> {
    // TODO: implement me!
}

func splitWords(txt: String) -> Result<[String], Int> {
    // TODO: implement me!
}
```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 me!
}

// 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 me!
}

// 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 me!
}

// 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 me!
}
```
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> {
    // TODO: implement me!
}
```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 me!
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'

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> {
    return.success(txt.split(separator: " ").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}
```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> {
    return.success(txt.split(separator: " ").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// 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> {
    return.success(txt.split(separator: " ").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// 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> {
    return.success(txt.split(separator: " ").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}
```
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> {
    return.success(txt.split(separator: " ").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}
```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> {
    return.success(txt.split(separator: " ").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}
```
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> {
    return.success(txt.split(separator: " ").map { String($0) })
}

func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}
```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> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// 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> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// 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> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// 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> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// 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> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// 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> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// 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
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> {
    // TODO: implement me!
}

func splitWords(txt: String) -> Result<[String], Int> {
    // TODO: implement me!
}
```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 me!
}

// 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 me!
}

// 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 me!
}

// 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 me!
}

// 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 me!
}

// 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 me!
}

// 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", "
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.success(words.map { String($0) })
    } else {
        let lowerCaseLetters = txt.lowercased().characters.map { Int($0.unicodeScalars.first!.value) }
        let oddCount = lowerCaseLetters.filter { $0 % 2!= 0 }.count
        return.failure(oddCount)
    }
}
```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(words.map { String($0) })
    } else {
        let lowerCaseLetters = txt.lowercased().characters.map { Int($0.unicodeScalars.first!.value) }
        let oddCount = lowerCaseLetters.filter { $0 % 2!= 0 }.count
        return.failure(oddCount)
    }
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let lowerCaseLetters = txt.lowercased().characters.map { Int($0.unicodeScalars.first!.value) } // 'characters' is unavailable: Please use String directly
let oddCount = lowerCaseLetters.filter { $0 % 2!= 0 }.count // expression is not assignable: binary operator returns immutable value
let oddCount = lowerCaseLetters.filter { $0 % 2!= 0 }.count // cannot force unwrap value of non-optional type 'Int'
let oddCount = lowerCaseLetters.filter { $0 % 2!= 0 }.count // cannot convert value of type '()' to closure result type 'Bool'
let oddCount = lowerCaseLetters.filter { $0 % 2!= 0 }.count // '=' must have consistent whitespace on both sides

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> {
    return.success(txt.split(separator: " ").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}
```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> {
    return.success(txt.split(separator: " ").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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
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> {
    return.success(txt.split(separator: " ").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}
```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> {
    return.success(txt.split(separator: " ").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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> {
    return.success(txt.split(separator: ",").map { $0.trimmingCharacters(in:.whitespacesAndNewlines) })
}

// Given a string of words, return an array of words 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
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
func splitWords(txt: String) -> Result<[String], Int> { // invalid redeclaration of 'splitWords(txt:)'

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 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 isSorted(lst: [Int]) -> Bool {
    var sorted = true
    var prev = lst[0]
    for i in 1...lst.count-1 {
        if lst[i] < prev {
            sorted = false
            break
        }
        prev = 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 prev = lst[0]
    for i in 1...lst.count-1 {
        if lst[i] < prev {
            sorted = false
            break
        }
        prev = lst[i]
    }
    return sorted
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 1...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 1...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 = false
    var last = lst[0]
    for i in 1..<lst.count {
        if lst[i] < last {
            sorted = false
            break
        }
        last = 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 = false
    var last = lst[0]
    for i in 1..<lst.count {
        if lst[i] < last {
            sorted = false
            break
        }
        last = lst[i]
    }
    return sorted
}
```
 // XCTAssertTrue failed

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 {
    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 = false
    var prev = lst[0]
    for i in 1...lst.count-1 {
        if lst[i] < prev {
            sorted = false
            break
        }
        prev = 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 = false
    var prev = lst[0]
    for i in 1...lst.count-1 {
        if lst[i] < prev {
            sorted = false
            break
        }
        prev = lst[i]
    }
    return sorted
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // Your code here
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    
    if start1 > end2 || start2 > end1 {
        return "NO"
    }
    
    let intersection = (max(start1, start2), min(end1, end2))
    
    if isPrime(intersection.0) && isPrime(intersection.1) {
        return "YES"
    }
    
    return "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 {
    // Your code here
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    
    if start1 > end2 || start2 > end1 {
        return "NO"
    }
    
    let intersection = (max(start1, start2), min(end1, end2))
    
    if isPrime(intersection.0) && isPrime(intersection.1) {
        return "YES"
    }
    
    return "NO"
}
```
if isPrime(intersection.0) && isPrime(intersection.1) { // cannot find 'isPrime' in scope
if isPrime(intersection.0) && isPrime(intersection.1) { // cannot find 'isPrime' in scope

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"
    }
    if isPrime(start) {
        return "YES"
    }
    return "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"
    }
    if isPrime(start) {
        return "YES"
    }
    return "NO"
}
```
if isPrime(start) { // cannot find 'isPrime' in scope

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    
    if start1 > end1 || start2 > end2 {
        return "NO"
    }
    
    let intersection = (max(start1, start2), min(end1, end2))
    let (start, end) = intersection
    
    if start > end {
        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 {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    
    if start1 > end1 || start2 > end2 {
        return "NO"
    }
    
    let intersection = (max(start1, start2), min(end1, end2))
    let (start, end) = intersection
    
    if start > end {
        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"
    }
    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 {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    if start > end {
        return "NO"
    }
    return "YES"
}
```
 // XCTAssertTrue failed

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    
    // If the two intervals don't intersect, return "NO".
    if start1 > end2 || start2 > end1 {
        return "NO"
    }
    
    // If the length of the intersection is a prime number, return "YES",
    // otherwise, return "NO".
    let intersection = (max(start1, start2), min(end1, end2))
    let (start, end) = intersection
    let length = end - start + 1
    
    if isPrime(length) {
        return "YES"
    }
    
    return "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 (start1, end1) = interval1
    let (start2, end2) = interval2
    
    // If the two intervals don't intersect, return "NO".
    if start1 > end2 || start2 > end1 {
        return "NO"
    }
    
    // If the length of the intersection is a prime number, return "YES",
    // otherwise, return "NO".
    let intersection = (max(start1, start2), min(end1, end2))
    let (start, end) = intersection
    let length = end - start + 1
    
    if isPrime(length) {
        return "YES"
    }
    
    return "NO"
}
```
if isPrime(length) { // cannot find 'isPrime' in scope

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // Your code here
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    
    let start = max(start1, start2)
    let end = min(end1, end2)
    
    if start > end {
        return "NO"
    }
    
    let length = end - start + 1
    
    if isPrime(length) {
        return "YES"
    }
    
    return "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 {
    // Your code here
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    
    let start = max(start1, start2)
    let end = min(end1, end2)
    
    if start > end {
        return "NO"
    }
    
    let length = end - start + 1
    
    if isPrime(length) {
        return "YES"
    }
    
    return "NO"
}
```
if isPrime(length) { // cannot find 'isPrime' in scope

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 isPrime(length) {
        return "YES"
    }
    return "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 isPrime(length) {
        return "YES"
    }
    return "NO"
}
```
if isPrime(length) { // cannot find 'isPrime' in scope

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    
    if start1 > end1 || start2 > end2 {
        return "NO"
    }
    
    let start = max(start1, start2)
    let end = min(end1, end2)
    
    if end - start == 1 {
        return "YES"
    }
    
    return "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 (start1, end1) = interval1
    let (start2, end2) = interval2
    
    if start1 > end1 || start2 > end2 {
        return "NO"
    }
    
    let start = max(start1, start2)
    let end = min(end1, end2)
    
    if end - start == 1 {
        return "YES"
    }
    
    return "NO"
}
```
 // 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"
    }
    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 {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    if start > end {
        return "NO"
    }
    return "YES"
}
```
 // XCTAssertTrue failed

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // TODO: implement me
    return ""
}
```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 {
    // TODO: implement me
    return ""
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    if arr.isEmpty { return nil }
    var result = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        }
        if arr[i] < 0 {
            result *= -1
        }
    }
    return arr.map { $0.abs() }.reduce(0, combine: +) * 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? {
    if arr.isEmpty { return nil }
    var result = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        }
        if arr[i] < 0 {
            result *= -1
        }
    }
    return arr.map { $0.abs() }.reduce(0, combine: +) * result
}
```
return arr.map { $0.abs() }.reduce(0, combine: +) * result // value of type 'Int' has no member 'abs'
return arr.map { $0.abs() }.reduce(0, combine: +) * result // extraneous argument label 'combine:' in call

func prodSigns(arr: [Int]) -> Int? {
    guard arr.count > 0 else {
        return nil
    }
    
    var sum = 0
    var product = 1
    for num in arr {
        sum += abs(num)
        product *= num
    }
    return sum * product
}
```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.count > 0 else {
        return nil
    }
    
    var sum = 0
    var product = 1
    for num in arr {
        sum += abs(num)
        product *= num
    }
    return sum * product
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard arr.count > 0 else {
        return nil
    }
    
    var sum = 0
    var product = 1
    for i in 0..<arr.count {
        sum += arr[i].magnitude
        if arr[i] < 0 {
            product *= -1
        }
    }
    return sum * product
}
```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.count > 0 else {
        return nil
    }
    
    var sum = 0
    var product = 1
    for i in 0..<arr.count {
        sum += arr[i].magnitude
        if arr[i] < 0 {
            product *= -1
        }
    }
    return sum * product
}
```
sum += arr[i].magnitude // cannot convert value of type 'UInt' to expected argument type 'Int'

func prodSigns(arr: [Int]) -> Int? {
    guard arr.count > 0 else {
        return nil
    }
    var sum = 0
    var product = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        }
        if arr[i] > 0 {
            product *= 1
        } else if arr[i] < 0 {
            product *= -1
        }
        sum += abs(arr[i])
    }
    return sum * product
}
```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.count > 0 else {
        return nil
    }
    var sum = 0
    var product = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        }
        if arr[i] > 0 {
            product *= 1
        } else if arr[i] < 0 {
            product *= -1
        }
        sum += abs(arr[i])
    }
    return sum * product
}
```

func prodSigns(arr: [Int]) -> Int? {
    guard arr.count > 0 else { return nil }
    var sum = 0
    var product = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        } else if arr[i] > 0 {
            sum += arr[i]
        } else {
            sum -= arr[i]
        }
        product *= arr[i]
    }
    return sum * product
}
```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.count > 0 else { return nil }
    var sum = 0
    var product = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        } else if arr[i] > 0 {
            sum += arr[i]
        } else {
            sum -= arr[i]
        }
        product *= arr[i]
    }
    return sum * product
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    if arr.isEmpty {
        return nil
    }
    var sum = 0
    var product = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        }
        if arr[i] > 0 {
            product *= 1
        } else if arr[i] < 0 {
            product *= -1
        }
        sum += abs(arr[i])
    }
    return sum * product
}
```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? {
    if arr.isEmpty {
        return nil
    }
    var sum = 0
    var product = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        }
        if arr[i] > 0 {
            product *= 1
        } else if arr[i] < 0 {
            product *= -1
        }
        sum += abs(arr[i])
    }
    return sum * product
}
```

func prodSigns(arr: [Int]) -> Int? {
    if arr.isEmpty {
        return nil
    }
    
    var sum = 0
    var product = 1
    
    for num in arr {
        sum += abs(num)
        if num < 0 {
            product *= -1
        }
    }
    
    return sum * product
}
```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? {
    if arr.isEmpty {
        return nil
    }
    
    var sum = 0
    var product = 1
    
    for num in arr {
        sum += abs(num)
        if num < 0 {
            product *= -1
        }
    }
    
    return sum * product
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard arr.count > 0 else { return nil }
    var sum = 0
    var product = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        }
        if arr[i] > 0 {
            product *= 1
        } else if arr[i] < 0 {
            product *= -1
        }
        sum += abs(arr[i])
    }
    return sum * product
}
```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.count > 0 else { return nil }
    var sum = 0
    var product = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        }
        if arr[i] > 0 {
            product *= 1
        } else if arr[i] < 0 {
            product *= -1
        }
        sum += abs(arr[i])
    }
    return sum * product
}
```

func prodSigns(arr: [Int]) -> Int? {
    guard arr.count > 0 else { return nil }
    var sum = 0
    var prod = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            prod = 0
            break
        }
        if arr[i] > 0 {
            prod *= 1
        } else if arr[i] < 0 {
            prod *= -1
        }
        sum += abs(arr[i])
    }
    return sum * prod
}
```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.count > 0 else { return nil }
    var sum = 0
    var prod = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            prod = 0
            break
        }
        if arr[i] > 0 {
            prod *= 1
        } else if arr[i] < 0 {
            prod *= -1
        }
        sum += abs(arr[i])
    }
    return sum * prod
}
```

func prodSigns(arr: [Int]) -> Int? {
    if arr.isEmpty {
        return nil
    }
    
    var product = 1
    var sum = 0
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        }
        if arr[i] > 0 {
            sum += arr[i]
        } else if arr[i] < 0 {
            sum -= arr[i]
        }
        product *= arr[i]
    }
    return sum * product
}
```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? {
    if arr.isEmpty {
        return nil
    }
    
    var product = 1
    var sum = 0
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        }
        if arr[i] > 0 {
            sum += arr[i]
        } else if arr[i] < 0 {
            sum -= arr[i]
        }
        product *= arr[i]
    }
    return sum * product
}
```
 // XCTAssertTrue failed

func minPath(grid: [[Int]], k: Int) -> [Int] {
    // TODO: implement me
}
```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] {
    // TODO: implement me
}
```
} // missing return in global function expected to return '[Int]'

func minPath(grid: [[Int]], k: Int) -> [Int] {
    // TODO: Implement me!
}
```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] {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return '[Int]'

func minPath(grid: [[Int]], k: Int) -> [Int] {
    // TODO: Write your code here
}
```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] {
    // TODO: Write your code here
}
```
} // missing return in global function expected to return '[Int]'

func minPath(grid: [[Int]], k: Int) -> [Int] {
    // TODO: Implement me!
}
```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] {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return '[Int]'

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var path = [Int]()
    var visited = [Int](repeating: false, count: n*n)
    var queue = [Int]()
    queue.append(0)
    visited[0] = true
    var curr = 0
    var next = 0
    var count = 0
    while count < k {
        curr = queue.removeFirst()
        next = curr + 1
        if next < n*n {
            if!visited[next] {
                queue.append(next)
                visited[next] = true
                path.append(grid[curr/n][curr%n])
                count += 1
            }
        }
        next = curr - 1
        if next >= 0 {
            if!visited[next] {
                queue.append(next)
                visited[next] = true
                path.append(grid[curr/n][curr%n])
                count += 1
            }
        }
        next = curr + n
        if next < n*n {
            if!visited[next] {
                queue.append(next)
                visited[next] = true
                path.append(grid[curr/n][curr%n])
                count += 1
            }
        }
        next = curr - n
        if next >= 0 {
            if!visited[next] {
                queue.append(next)
                visited[next] = true
                path.append(grid[curr/n][curr%n])
                count += 1
            }
        }
    }
    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] {
    let n = grid.count
    var path = [Int]()
    var visited = [Int](repeating: false, count: n*n)
    var queue = [Int]()
    queue.append(0)
    visited[0] = true
    var curr = 0
    var next = 0
    var count = 0
    while count < k {
        curr = queue.removeFirst()
        next = curr + 1
        if next < n*n {
            if!visited[next] {
                queue.append(next)
                visited[next] = true
                path.append(grid[curr/n][curr%n])
                count += 1
            }
        }
        next = curr - 1
        if next >= 0 {
            if!visited[next] {
                queue.append(next)
                visited[next] = true
                path.append(grid[curr/n][curr%n])
                count += 1
            }
        }
        next = curr + n
        if next < n*n {
            if!visited[next] {
                queue.append(next)
                visited[next] = true
                path.append(grid[curr/n][curr%n])
                count += 1
            }
        }
        next = curr - n
        if next >= 0 {
            if!visited[next] {
                queue.append(next)
                visited[next] = true
                path.append(grid[curr/n][curr%n])
                count += 1
            }
        }
    }
    return path
}
```
var visited = [Int](repeating: false, count: n*n) // cannot convert value of type 'Bool' to expected argument type 'Int'
if!visited[next] { // expected expression, var, or let in 'if' condition
if!visited[next] { // expected expression, var, or let in 'if' condition
if!visited[next] { // expected expression, var, or let in 'if' condition
if!visited[next] { // expected expression, var, or let in 'if' condition

func minPath(grid: [[Int]], k: Int) -> [Int] {
    // TODO: Implement me!
}
```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] {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return '[Int]'

func minPath(grid: [[Int]], k: Int) -> [Int] {
    // Write your code here
}
```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] {
    // Write your code here
}
```
} // missing return in global function expected to return '[Int]'

func minPath(grid: [[Int]], k: Int) -> [Int] {
    
    // 计算每个点的最短路径
    var minPath = [Int]()
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            minPath.append(minPath(grid: grid, k: k, i: i, j: j))
        }
    }
    
    // 按照最小路径长度排序
    minPath.sort(by: { (a: Int, b: Int) -> Bool in
        return a > b
    })
    
    // 取出前k个最小路径
    return minPath[0..<k]
}

func minPath(grid: [[Int]], k: Int, i: Int, j: Int) -> Int {
    
    // 如果已经超过了最大路径长度,则返回0
    if k == 0 {
        return 0
    }
    
    // 如果超过了边界,则返回0
    if i < 0 || i >= grid.count || j < 0 || j >= grid[i].count {
        return 0
    }
    
    // 如果已经计算过,则直接返回
    if minPath[i][j]!= 0 {
        return minPath[i][j]
    }
    
    // 计算当前点的最短路径
    var min = 0
    if i > 0 {
        min += minPath(grid: grid, k: k, i: i - 1, j: j)
    }
    if j > 0 {
        min += minPath(grid: grid, k: k, i: i, j: j - 1)
    }
    if i < grid.count - 1 {
        min += minPath(grid: grid, k: k, i: i + 1, j: j)
    }
    if j < grid[i].count - 1 {
        min += minPath(grid: grid, k: k, i: i, j: j + 1)
    }
    
    // 保存当前点的最短路径
    minPath[i][j] = min
    
    // 返回当前点的最短路径
    return min
}
```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 minPath = [Int]()
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            minPath.append(minPath(grid: grid, k: k, i: i, j: j))
        }
    }
    
    // 按照最小路径长度排序
    minPath.sort(by: { (a: Int, b: Int) -> Bool in
        return a > b
    })
    
    // 取出前k个最小路径
    return minPath[0..<k]
}

// 递归计算最短路径
func minPath(grid: [[Int]], k: Int, i: Int, j: Int) -> Int {
    
    // 如果已经超过了最大路径长度,则返回0
    if k == 0 {
        return 0
    }
    
    // 如果超过了边界,则返回0
    if i < 0 || i >= grid.count || j < 0 || j >= grid[i].count {
        return 0
    }
    
    // 如果已经计算过,则直接返回
    if minPath[i][j]!= 0 {
        return minPath[i][j]
    }
    
    // 计算当前点的最短路径
    var min = 0
    if i > 0 {
        min += minPath(grid: grid, k: k, i: i - 1, j: j)
    }
    if j > 0 {
        min += minPath(grid: grid, k: k, i: i, j: j - 1)
    }
    if i < grid.count - 1 {
        min += minPath(grid: grid, k: k, i: i + 1, j: j)
    }
    if j < grid[i].count - 1 {
        min += minPath(grid: grid, k: k, i: i, j: j + 1)
    }
    
    // 保存当前点的最短路径
    minPath[i][j] = min
    
    // 返回当前点的最短路径
    return min
}
```
minPath.append(minPath(grid: grid, k: k, i: i, j: j)) // cannot call value of non-function type '[Int]'
return minPath[0..<k] // no 'subscript' candidates produce the expected contextual result type '[Int]'
if minPath[i][j]!= 0 { // '=' must have consistent whitespace on both sides
if minPath[i][j]!= 0 { // use of '=' in a boolean context, did you mean '=='?
if minPath[i][j]!= 0 { // reference to member 'subscript' cannot be resolved without a contextual type
return minPath[i][j] // reference to member 'subscript' cannot be resolved without a contextual type
minPath[i][j] = min // reference to member 'subscript' cannot be resolved without a contextual type

func minPath(grid: [[Int]], k: Int) -> [Int] {
    // Write your solution here
    var minPath = [Int]()
    var path = [Int]()
    var visited = [Int]()
    var queue = [Int]()
    var count = 0
    var i = 0
    var j = 0
    var cur = 0
    var next = 0
    var curMin = 0
    var nextMin = 0
    
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            visited.append(grid[i][j])
        }
    }
    
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            queue.append(grid[i][j])
        }
    }
    
    while count < k {
        cur = queue.removeFirst()
        path.append(cur)
        count += 1
        
        for i in 0..<grid.count {
            for j in 0..<grid[i].count {
                if visited[i*grid.count+j] == cur {
                    visited[i*grid.count+j] = -1
                    next = grid[i][j]
                    nextMin = min(curMin, next)
                    queue.append(next)
                    
                    if nextMin == curMin {
                        minPath.append(cur)
                    }
                    
                    curMin = nextMin
                }
            }
        }
    }
    
    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] {
    // Write your solution here
    var minPath = [Int]()
    var path = [Int]()
    var visited = [Int]()
    var queue = [Int]()
    var count = 0
    var i = 0
    var j = 0
    var cur = 0
    var next = 0
    var curMin = 0
    var nextMin = 0
    
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            visited.append(grid[i][j])
        }
    }
    
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            queue.append(grid[i][j])
        }
    }
    
    while count < k {
        cur = queue.removeFirst()
        path.append(cur)
        count += 1
        
        for i in 0..<grid.count {
            for j in 0..<grid[i].count {
                if visited[i*grid.count+j] == cur {
                    visited[i*grid.count+j] = -1
                    next = grid[i][j]
                    nextMin = min(curMin, next)
                    queue.append(next)
                    
                    if nextMin == curMin {
                        minPath.append(cur)
                    }
                    
                    curMin = nextMin
                }
            }
        }
    }
    
    return minPath
}
```
var i = 0 // initialization of variable 'i' was never used; consider replacing with assignment to '_' or removing it
var j = 0 // initialization of variable 'j' was never used; consider replacing with assignment to '_' or removing it
 // 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] {
    // Write your solution here
    // 思路:
    // 这个题目的难点在于如何快速找到最短路径,我们可以用一个数组来存储每个点的最短路径,
    // 然后再找到最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来存储最短路径,这样的话,我们可以用一个数组来存储最短路径,这样的话,我们可以
    // 用一个数组来

func tri(n: Int) -> [Int] {
    
}
```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] {
    
}
```
} // missing return in global function expected to return '[Int]'

func tri(n: Int) -> [Int] {
    
    var fibonacci = [Int]()
    
    if n == 0 {
        return fibonacci
    }
    
    fibonacci.append(1)
    
    if n == 1 {
        return fibonacci
    }
    
    fibonacci.append(3)
    
    if n == 2 {
        return fibonacci
    }
    
    for i in 3...n {
        if i % 2 == 0 {
            fibonacci.append(i / 2)
        } else {
            fibonacci.append(fibonacci[i - 1] + fibonacci[i - 2] + fibonacci[i - 3])
        }
    }
    
    return fibonacci
}

func solution(inputArray: [Int]) -> Int {
    
    var moves = 0
    
    for i in 0..<inputArray.count - 1 {
        
        if inputArray[i]!= inputArray[i + 1] {
            
            if inputArray[i] > inputArray[i + 1] {
                inputArray[i] -= 1
            } else {
                inputArray[i] += 1
            }
            
            moves += 1
        }
    }
    
    return moves
}
```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 fibonacci = [Int]()
    
    if n == 0 {
        return fibonacci
    }
    
    fibonacci.append(1)
    
    if n == 1 {
        return fibonacci
    }
    
    fibonacci.append(3)
    
    if n == 2 {
        return fibonacci
    }
    
    for i in 3...n {
        if i % 2 == 0 {
            fibonacci.append(i / 2)
        } else {
            fibonacci.append(fibonacci[i - 1] + fibonacci[i - 2] + fibonacci[i - 3])
        }
    }
    
    return fibonacci
}

// You are given an array of integers. On each move you are allowed to increase 
// or decrease an element by one. Find the minimal number of moves required to 
// transform one element into the next element, i.e. if one element changes to 
// another element, the number of moves is 1.
// Example
// For inputArray = [1, 7, 3], the output should be
// solution(inputArray) = 2.
// [1, 7, 3] can be transformed to [2, 8, 2] in 2 moves.
// For inputArray = [1, 2, 3], the output should be
// solution(inputArray) = 0.
// [1, 2, 3] can be transformed to [1, 2, 3] in 0 moves.
// Input/Output
// [execution time limit] 4 seconds (swift 5.0)
// [input] array.integer inputArray
// A non-empty array of positive integers.
// Guaranteed constraints:
// 1 ≤ inputArray.length ≤ 105,
// 1 ≤ inputArray[i] ≤ 104.
// [output] integer
// The minimal number of moves needed to transform one element into the next.
func solution(inputArray: [Int]) -> Int {
    
    var moves = 0
    
    for i in 0..<inputArray.count - 1 {
        
        if inputArray[i]!= inputArray[i + 1] {
            
            if inputArray[i] > inputArray[i + 1] {
                inputArray[i] -= 1
            } else {
                inputArray[i] += 1
            }
            
            moves += 1
        }
    }
    
    return moves
}

// You are given an array of integers. On each move you are allowed to increase 
// or decrease an element by one. Find the minimal number of moves required to 
// transform one element into the next element, i.e. if one element changes to 
// another element, the number of moves is 1.
// Example
// For inputArray = [1, 7, 3], the output should be
// solution(inputArray) = 2.
// [1, 7, 3] can be transformed to [2, 8, 2] in 2 moves.
// For inputArray = [1, 2, 3], the output should be
// solution(inputArray) = 0.
// [1, 2, 3] can be transformed to [1, 2, 3] in 0 moves.
// Input/Output
// [execution time limit] 4 seconds (swift 5.0)
// [input] array.integer inputArray
// A non-empty array of positive integers.
// Guaranteed constraints:
// 1 ≤ inputArray.length ≤ 105,
// 1 ≤ inputArray[i] ≤ 104.
// [output] integer
// The minimal number of moves needed to transform one element into the next.
func solution(inputArray: [Int]) -> Int {
    
    var moves = 0
    
    for i in 0..<inputArray.count - 1 {
        
        if inputArray[i]!= inputArray[i + 1] {
            
            if inputArray[i] > inputArray[i + 1] {
                inputArray[i] -= 1
            } else {
                inputArray[i] += 1
            }
            
            moves += 1
        }
    }
    
    return moves
}

// You are given an array of integers. On each move you are allowed to increase 
// or decrease an element by one. Find the minimal number of moves required to 
// transform one element into the next element, i.e. if one element changes to 
// another element, the
if inputArray[i]!= inputArray[i + 1] { // use of '=' in a boolean context, did you mean '=='?
if inputArray[i]!= inputArray[i + 1] { // '=' must have consistent whitespace on both sides
if inputArray[i]!= inputArray[i + 1] { // cannot force unwrap value of non-optional type 'Int'
inputArray[i] -= 1 // left side of mutating operator isn't mutable: 'inputArray' is a 'let' constant
inputArray[i] += 1 // left side of mutating operator isn't mutable: 'inputArray' is a 'let' constant

func tri(n: Int) -> [Int] {
    
    var result = [Int]()
    var a = 1
    var b = 3
    var c = 2
    
    result.append(a)
    result.append(b)
    result.append(c)
    
    for i in 3...n {
        let temp = a + b + c
        a = b
        b = c
        c = temp
        result.append(temp)
    }
    
    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 = [Int]()
    var a = 1
    var b = 3
    var c = 2
    
    result.append(a)
    result.append(b)
    result.append(c)
    
    for i in 3...n {
        let temp = a + b + c
        a = b
        b = c
        c = temp
        result.append(temp)
    }
    
    return result
}
```
for i in 3...n { // immutable value 'i' was never used; consider replacing with '_' or removing it
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    var tribonacci = [Int]()
    tribonacci.append(1)
    tribonacci.append(3)
    
    if n == 1 {
        return tribonacci
    }
    
    tribonacci.append(2)
    
    if n == 2 {
        return tribonacci
    }
    
    for i in 3...n {
        if i % 2 == 0 {
            tribonacci.append(tribonacci[i - 1] + tribonacci[i - 2] + tribonacci[i - 3])
        } else {
            tribonacci.append(tribonacci[i - 2] + tribonacci[i - 1])
        }
    }
    
    return tribonacci
}
```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 tribonacci = [Int]()
    tribonacci.append(1)
    tribonacci.append(3)
    
    if n == 1 {
        return tribonacci
    }
    
    tribonacci.append(2)
    
    if n == 2 {
        return tribonacci
    }
    
    for i in 3...n {
        if i % 2 == 0 {
            tribonacci.append(tribonacci[i - 1] + tribonacci[i - 2] + tribonacci[i - 3])
        } else {
            tribonacci.append(tribonacci[i - 2] + tribonacci[i - 1])
        }
    }
    
    return tribonacci
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    var result = [Int]()
    var a = 1
    var b = 1
    var c = 3
    
    result.append(a)
    result.append(b)
    result.append(c)
    
    for _ in 1...n {
        let temp = a + b + c
        a = b
        b = c
        c = temp
        result.append(temp)
    }
    
    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 = [Int]()
    var a = 1
    var b = 1
    var c = 3
    
    result.append(a)
    result.append(b)
    result.append(c)
    
    for _ in 1...n {
        let temp = a + b + c
        a = b
        b = c
        c = temp
        result.append(temp)
    }
    
    return result
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    var tribonacci = [Int]()
    tribonacci.append(1)
    tribonacci.append(3)
    
    for i in 2...n {
        if i % 2 == 0 {
            tribonacci.append(tribonacci[i - 1] + tribonacci[i - 2] + tribonacci[i - 3])
        } else {
            tribonacci.append(tribonacci[i - 1] + tribonacci[i - 2] + tribonacci[i - 3])
        }
    }
    return tribonacci
}
```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 tribonacci = [Int]()
    tribonacci.append(1)
    tribonacci.append(3)
    
    for i in 2...n {
        if i % 2 == 0 {
            tribonacci.append(tribonacci[i - 1] + tribonacci[i - 2] + tribonacci[i - 3])
        } else {
            tribonacci.append(tribonacci[i - 1] + tribonacci[i - 2] + tribonacci[i - 3])
        }
    }
    return tribonacci
}
```
 // Fatal error: Index out of range

func tri(n: Int) -> [Int] {
    // Write your code here
    var tribonacci = [Int]()
    tribonacci.append(1)
    tribonacci.append(3)
    
    if n == 1 {
        return tribonacci
    }
    
    tribonacci.append(2)
    
    for i in 3...n {
        if i % 2 == 0 {
            tribonacci.append(tribonacci[i-1] + tribonacci[i-2] + tribonacci[i-3])
        } else {
            tribonacci.append(tribonacci[i-2] + tribonacci[i-1])
        }
    }
    
    return tribonacci
}
```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] {
    // Write your code here
    var tribonacci = [Int]()
    tribonacci.append(1)
    tribonacci.append(3)
    
    if n == 1 {
        return tribonacci
    }
    
    tribonacci.append(2)
    
    for i in 3...n {
        if i % 2 == 0 {
            tribonacci.append(tribonacci[i-1] + tribonacci[i-2] + tribonacci[i-3])
        } else {
            tribonacci.append(tribonacci[i-2] + tribonacci[i-1])
        }
    }
    
    return tribonacci
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    var result = [Int]()
    result.append(1)
    result.append(3)
    result.append(2)
    if n == 1 {
        return result
    }
    var prev = result
    var prev2 = result
    var prev3 = result
    for _ in 2...n {
        var temp = [Int]()
        for _ in 0...prev.count-1 {
            temp.append(prev[temp.count-1] + prev2[temp.count-1] + prev3[temp.count-1])
        }
        prev3 = prev2
        prev2 = prev
        prev = temp
    }
    return prev
}
```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 = [Int]()
    result.append(1)
    result.append(3)
    result.append(2)
    if n == 1 {
        return result
    }
    var prev = result
    var prev2 = result
    var prev3 = result
    for _ in 2...n {
        var temp = [Int]()
        for _ in 0...prev.count-1 {
            temp.append(prev[temp.count-1] + prev2[temp.count-1] + prev3[temp.count-1])
        }
        prev3 = prev2
        prev2 = prev
        prev = temp
    }
    return prev
}
```
 // Fatal error: Index out of range

func tri(n: Int) -> [Int] {
    // Write your code here
    var result = [Int]()
    var a = 1
    var b = 3
    var c = 2
    
    result.append(a)
    result.append(b)
    result.append(c)
    
    for _ in 1...n {
        if n % 2 == 0 {
            a = b
            b = c
            c = a + b
        } else {
            a = b
            b = c
            c = a + b + result.last!
        }
        result.append(c)
    }
    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] {
    // Write your code here
    var result = [Int]()
    var a = 1
    var b = 3
    var c = 2
    
    result.append(a)
    result.append(b)
    result.append(c)
    
    for _ in 1...n {
        if n % 2 == 0 {
            a = b
            b = c
            c = a + b
        } else {
            a = b
            b = c
            c = a + b + result.last!
        }
        result.append(c)
    }
    return result
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    var result = [Int]()
    result.append(1)
    result.append(3)
    result.append(2)
    
    if n == 1 {
        return result
    }
    
    var previous = result[0]
    var second = result[1]
    var third = result[2]
    
    for _ in 1...n {
        let next = previous + second + third
        result.append(next)
        previous = second
        second = third
        third = next
    }
    
    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 = [Int]()
    result.append(1)
    result.append(3)
    result.append(2)
    
    if n == 1 {
        return result
    }
    
    var previous = result[0]
    var second = result[1]
    var third = result[2]
    
    for _ in 1...n {
        let next = previous + second + third
        result.append(next)
        previous = second
        second = third
        third = next
    }
    
    return result
}
```
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var result = 1
    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
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 1 {
            result *= digit
        }
        n /= 10
    }
    return result
}
```
n /= 10 // left side of mutating operator isn't mutable: 'n' is a 'let' constant

func digits(n: Int) -> Int {
    var product = 1
    var n = n
    while n > 0 {
        let digit = n % 10
        if digit % 2!= 0 {
            product *= digit
        }
        n = 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!= 0 {
            product *= digit
        }
        n = n / 10
    }
    return product
}
```
if digit % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if digit % 2!= 0 { // '=' must have consistent whitespace on both sides
if digit % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if digit % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'

func digits(n: Int) -> Int {
    var result = 1
    var n = n
    while n > 0 {
        var 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 {
        var digit = n % 10
        if digit % 2 == 1 {
            result *= digit
        }
        n /= 10
    }
    return result
}
```
var digit = n % 10 // variable 'digit' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var product = 1
    var n = n
    while n > 0 {
        let digit = n % 10
        if digit % 2!= 0 {
            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!= 0 {
            product *= digit
        }
        n /= 10
    }
    return product
}
```
if digit % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if digit % 2!= 0 { // '=' must have consistent whitespace on both sides
if digit % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if digit % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'

func digits(n: Int) -> Int {
    var product = 1
    var n = n
    while n > 0 {
        let digit = n % 10
        if digit % 2!= 0 {
            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!= 0 {
            product *= digit
        }
        n /= 10
    }
    return product
}
```
if digit % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if digit % 2!= 0 { // '=' must have consistent whitespace on both sides
if digit % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if digit % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'

func digits(n: Int) -> Int {
    var product = 1
    for _ in 1...n {
        if n % 2 == 0 {
            return 0
        }
        product *= n % 10
        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
    for _ in 1...n {
        if n % 2 == 0 {
            return 0
        }
        product *= n % 10
        n /= 10
    }
    return product
}
```
n /= 10 // left side of mutating operator isn't mutable: 'n' is a 'let' constant

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 digits(n: Int) -> Int {
    var product = 1
    for i in 0..<String(n).characters.count {
        if i % 2 == 1 {
            product *= Int(String(n).characters[i])
        }
    }
    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
    for i in 0..<String(n).characters.count {
        if i % 2 == 1 {
            product *= Int(String(n).characters[i])
        }
    }
    return product
}
```
for i in 0..<String(n).characters.count { // 'characters' is unavailable: Please use String directly
product *= Int(String(n).characters[i]) // no exact matches in call to initializer

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 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 isNested(string: String) -> Bool {
    
    // 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 {
    
    // Your code here
}
```
} // missing return in global function expected to return 'Bool'

func isNested(string: String) -> Bool {
    //...
}
```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 {
    //...
}
```
} // missing return in global function expected to return 'Bool'

func isNested(string: String) -> Bool {
    
    // 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 {
    
    // Your code here
}
```
} // missing return in global function expected to return 'Bool'

func isNested(string: String) -> Bool {
    // TODO: implement isNested
}
```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: implement isNested
}
```
} // missing return in global function expected to return 'Bool'

func isNested(string: String) -> Bool {
    
    // 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 {
    
    // Your code here
}
```
} // missing return in global function expected to return 'Bool'

func isNested(string: String) -> Bool {
    
    // 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 {
    
    // Your code here.
}
```
} // missing return in global function expected to return 'Bool'

func isNested(string: String) -> Bool {
    
    // 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 {
    
    // Your code here
}
```
} // missing return in global function expected to return 'Bool'

func isNested(string: String) -> Bool {
    // TODO: Implement isNested
}
```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: Implement isNested
}
```
} // missing return in global function expected to return 'Bool'

func isNested(string: String) -> Bool {
    // TODO: Implement isNested
    
    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: Implement isNested
    
    return false
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    // TODO: Implement isNested
}
```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: Implement isNested
}
```
} // missing return in global function expected to return 'Bool'

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for i in lst {
        sum += Int(ceil(i*i))
    }
    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(i*i))
    }
    return sum
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        sum += Int(ceil(pow(num, 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 num in lst {
        sum += Int(ceil(pow(num, 2)))
    }
    return sum
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for i in lst {
        sum += Int(ceil(i * i))
    }
    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(i * i))
    }
    return sum
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        sum += Int(ceil(pow(num, 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 num in lst {
        sum += Int(ceil(pow(num, 2)))
    }
    return sum
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for i in lst {
        sum += Int(ceil(i * i))
    }
    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(i * i))
    }
    return sum
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for i in lst {
        sum += Int(ceil(i * i))
    }
    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(i * i))
    }
    return sum
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        sum += Int(ceil(num * num))
    }
    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 num in lst {
        sum += Int(ceil(num * num))
    }
    return sum
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for i in lst {
        sum += Int(ceil(i * i))
    }
    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(i * i))
    }
    return sum
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for num in lst {
        sum += Int(ceil(pow(num, 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 num in lst {
        sum += Int(ceil(pow(num, 2)))
    }
    return sum
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    var sum = 0
    for i in lst {
        sum += Int(ceil(i * i))
    }
    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(i * i))
    }
    return sum
}
```
 // XCTAssertTrue failed

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func canArrange(arr: [Int]) -> Int {
    // TODO: Implement this function
}
```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: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: implement me
}
```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: implement me
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Implement me!
}
```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: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Implement me!
}
```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: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Implement me!
}
```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: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Implement me!
}
```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: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Implement me!
}
```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: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Implement me!
}
```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: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Implement me!
}
```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: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func canArrange(arr: [Int]) -> Int {
    // TODO: Implement me!
}
```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: Implement me!
}
```
} // missing return in global function expected to return 'Int'

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int? = nil
    var smallest: Int? = nil
    for i in lst {
        if i > 0 {
            if smallest == nil {
                smallest = i
            } else {
                smallest = min(smallest, i)
            }
        } else if i < 0 {
            if largest == nil {
                largest = i
            } else {
                largest = max(largest, 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 {
            if smallest == nil {
                smallest = i
            } else {
                smallest = min(smallest, i)
            }
        } else if i < 0 {
            if largest == nil {
                largest = i
            } else {
                largest = max(largest, i)
            }
        }
    }
    return (largest, smallest)
}
```
smallest = min(smallest, i) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
largest = max(largest, i) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var max: Int? = nil
    var min: Int? = nil
    for i in lst {
        if i > 0 {
            if min == nil {
                min = i
            } else {
                min = min! < i? i : min!
            }
        } else if i < 0 {
            if max == nil {
                max = i
            } else {
                max = max! > i? max! : i
            }
        }
    }
    return (max, min)
}
```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 max: Int? = nil
    var min: Int? = nil
    for i in lst {
        if i > 0 {
            if min == nil {
                min = i
            } else {
                min = min! < i? i : min!
            }
        } else if i < 0 {
            if max == nil {
                max = i
            } else {
                max = max! > i? max! : i
            }
        }
    }
    return (max, min)
}
```
min = min! < i? i : min! // consecutive statements on a line must be separated by ';'
min = min! < i? i : min! // cannot assign value of type 'Bool' to type 'Int?'
min = min! < i? i : min! // expected expression
min = min! < i? i : min! // expression of type 'Int' is unused
min = min! < i? i : min! // cannot use optional chaining on non-optional value of type 'Int'
min = min! < i? i : min! // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
min = min! < i? i : min! // consecutive statements on a line must be separated by ';'
max = max! > i? max! : i // expected expression
max = max! > i? max! : i // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
max = max! > i? max! : i // cannot use optional chaining on non-optional value of type 'Int'
max = max! > i? max! : i // consecutive statements on a line must be separated by ';'
max = max! > i? max! : i // cannot assign value of type 'Bool' to type 'Int?'
max = max! > i? max! : i // consecutive statements on a line must be separated by ';'
max = max! > i? max! : i // variable is unused

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var max: Int? = nil
    var min: Int? = nil
    for i in lst {
        if i > 0 {
            if min == nil {
                min = i
            } else {
                min = min! < i? i : min!
            }
        } else if i < 0 {
            if max == nil {
                max = i
            } else {
                max = max! > i? max! : i
            }
        }
    }
    return (max, min)
}
```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 max: Int? = nil
    var min: Int? = nil
    for i in lst {
        if i > 0 {
            if min == nil {
                min = i
            } else {
                min = min! < i? i : min!
            }
        } else if i < 0 {
            if max == nil {
                max = i
            } else {
                max = max! > i? max! : i
            }
        }
    }
    return (max, min)
}
```
min = min! < i? i : min! // consecutive statements on a line must be separated by ';'
min = min! < i? i : min! // cannot assign value of type 'Bool' to type 'Int?'
min = min! < i? i : min! // expected expression
min = min! < i? i : min! // expression of type 'Int' is unused
min = min! < i? i : min! // cannot use optional chaining on non-optional value of type 'Int'
min = min! < i? i : min! // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
min = min! < i? i : min! // consecutive statements on a line must be separated by ';'
max = max! > i? max! : i // expected expression
max = max! > i? max! : i // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
max = max! > i? max! : i // cannot use optional chaining on non-optional value of type 'Int'
max = max! > i? max! : i // consecutive statements on a line must be separated by ';'
max = max! > i? max! : i // cannot assign value of type 'Bool' to type 'Int?'
max = max! > i? max! : i // consecutive statements on a line must be separated by ';'
max = max! > i? max! : i // variable is unused

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var max: Int?
    var min: Int?
    for i in lst {
        if i > 0 {
            if min == nil {
                min = i
            } else {
                min = min < i? min : i
            }
        } else if i < 0 {
            if max == nil {
                max = i
            } else {
                max = max > i? max : i
            }
        }
    }
    return (max, min)
}
```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 max: Int?
    var min: Int?
    for i in lst {
        if i > 0 {
            if min == nil {
                min = i
            } else {
                min = min < i? min : i
            }
        } else if i < 0 {
            if max == nil {
                max = i
            } else {
                max = max > i? max : i
            }
        }
    }
    return (max, min)
}
```
min = min < i? min : i // consecutive statements on a line must be separated by ';'
min = min < i? min : i // expected expression
min = min < i? min : i // consecutive statements on a line must be separated by ';'
min = min < i? min : i // cannot use optional chaining on non-optional value of type 'Int'
min = min < i? min : i // variable is unused
min = min < i? min : i // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
min = min < i? min : i // cannot assign value of type 'Bool' to type 'Int?'
min = min < i? min : i // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
max = max > i? max : i // cannot use optional chaining on non-optional value of type 'Int'
max = max > i? max : i // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
max = max > i? max : i // consecutive statements on a line must be separated by ';'
max = max > i? max : i // expected expression
max = max > i? max : i // consecutive statements on a line must be separated by ';'
max = max > i? max : i // cannot assign value of type 'Bool' to type 'Int?'
max = max > i? max : i // variable is unused
max = max > i? max : i // 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 && (smallest == nil || i < smallest!) {
            smallest = i
        }
        if i < 0 && (largest == nil || i > largest!) {
            largest = 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 && (smallest == nil || i < smallest!) {
            smallest = i
        }
        if i < 0 && (largest == nil || i > largest!) {
            largest = i
        }
    }
    return (largest, smallest)
}
```

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var max: Int? = nil
    var min: Int? = nil
    for i in lst {
        if i > 0 && (min == nil || i < min!) {
            min = i
        }
        if i < 0 && (max == nil || i > max!) {
            max = i
        }
    }
    return (max, min)
}
```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 max: Int? = nil
    var min: Int? = nil
    for i in lst {
        if i > 0 && (min == nil || i < min!) {
            min = i
        }
        if i < 0 && (max == nil || i > max!) {
            max = i
        }
    }
    return (max, min)
}
```

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int? = nil
    var smallest: Int? = nil
    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? = nil
    var smallest: Int? = nil
    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 max: Int? = nil
    var min: Int? = nil
    for i in lst {
        if i < 0 {
            if max == nil || i > max! {
                max = i
            }
        } else {
            if min == nil || i < min! {
                min = i
            }
        }
    }
    return (max, min)
}
```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 max: Int? = nil
    var min: Int? = nil
    for i in lst {
        if i < 0 {
            if max == nil || i > max! {
                max = i
            }
        } else {
            if min == nil || i < min! {
                min = i
            }
        }
    }
    return (max, min)
}
```
 // XCTAssertTrue failed

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var max: Int? = nil
    var min: Int? = nil
    for i in lst {
        if i < 0 {
            if max == nil || i > max! {
                max = i
            }
        } else if i > 0 {
            if min == nil || i < min! {
                min = i
            }
        }
    }
    return (max, min)
}
```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 max: Int? = nil
    var min: Int? = nil
    for i in lst {
        if i < 0 {
            if max == nil || i > max! {
                max = i
            }
        } else if i > 0 {
            if min == nil || i < min! {
                min = i
            }
        }
    }
    return (max, min)
}
```

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int? = nil
    var smallest: Int? = nil
    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? = nil
    var smallest: Int? = nil
    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)
}
```

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.intValue(b)
    case (.intValue(let a),.doubleValue(let b)):
        return a > b?.intValue(a) :.doubleValue(b)
    case (.doubleValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.doubleValue(b)
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) :.stringValue(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 (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.intValue(b)
    case (.intValue(let a),.doubleValue(let b)):
        return a > b?.intValue(a) :.doubleValue(b)
    case (.doubleValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.doubleValue(b)
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) :.stringValue(b)
    default:
        return nil
    }
}
```
return a > b?.intValue(a) :.intValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.intValue(b) // expected expression
return a > b?.intValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // value of type 'Int' has no member 'intValue'
return a > b?.intValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.doubleValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.doubleValue(b) // value of type 'Double' has no member 'intValue'
return a > b?.intValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
return a > b?.intValue(a) :.doubleValue(b) // expected expression
return a > b?.intValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) :.doubleValue(b) // expected expression
return a > b?.intValue(a) :.doubleValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.intValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.doubleValue(b) // value of type 'Int' has no member 'intValue'
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
return a > b?.stringValue(a) :.stringValue(b) // expected expression
return a > b?.stringValue(a) :.stringValue(b) // value of optional type 'String?' must be unwrapped to a value of type 'String'
return a > b?.stringValue(a) :.stringValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.stringValue(a) :.stringValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.stringValue(a) :.stringValue(b) // value of type 'String' has no member 'stringValue'
return a > b?.stringValue(a) :.stringValue(b) // cannot use optional chaining on non-optional value of type 'String'

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), let.intValue(b)):
        return a > b?.intValue(a) :.intValue(b)
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (let.stringValue(a), let.stringValue(b)):
        let aFloat = a.doubleValue
        let bFloat = b.doubleValue
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    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), let.intValue(b)):
        return a > b?.intValue(a) :.intValue(b)
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (let.stringValue(a), let.stringValue(b)):
        let aFloat = a.doubleValue
        let bFloat = b.doubleValue
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}
```
return a > b?.intValue(a) :.intValue(b) // value of type 'Int' has no member 'intValue'
return a > b?.intValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.intValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
let aFloat = a.doubleValue // value of type 'String' has no member 'doubleValue'
let bFloat = b.doubleValue // value of type 'String' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of optional type 'Optional<_>' must be unwrapped to a value of type '_'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // cannot convert return expression of type 'Bool' to return type 'Value?'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression

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), let.intValue(b)):
        return a > b?.intValue(a) :.intValue(b)
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (let.stringValue(a), let.stringValue(b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    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), let.intValue(b)):
        return a > b?.intValue(a) :.intValue(b)
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (let.stringValue(a), let.stringValue(b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}
```
return a > b?.intValue(a) :.intValue(b) // value of type 'Int' has no member 'intValue'
return a > b?.intValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.intValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // cannot convert return expression of type 'Bool' to return type 'Value?'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of type 'Double' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // binary operator '>' cannot be applied to operands of type 'Double?' and 'Optional<_>'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.intValue(b)
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (.stringValue(let a),.stringValue(let b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    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 (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.intValue(b)
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (.stringValue(let a),.stringValue(let b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}
```
return a > b?.intValue(a) :.intValue(b) // value of type 'Int' has no member 'intValue'
return a > b?.intValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.intValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // cannot convert return expression of type 'Bool' to return type 'Value?'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of type 'Double' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // binary operator '>' cannot be applied to operands of type 'Double?' and 'Optional<_>'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression

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), let.intValue(b)):
        return a > b?.intValue(a) :.intValue(b)
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (let.stringValue(a), let.stringValue(b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    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), let.intValue(b)):
        return a > b?.intValue(a) :.intValue(b)
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (let.stringValue(a), let.stringValue(b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}
```
return a > b?.intValue(a) :.intValue(b) // value of type 'Int' has no member 'intValue'
return a > b?.intValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.intValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // cannot convert return expression of type 'Bool' to return type 'Value?'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of type 'Double' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // binary operator '>' cannot be applied to operands of type 'Double?' and 'Optional<_>'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.intValue(b)
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (.stringValue(let a),.stringValue(let b)):
        let aFloat = a.doubleValue
        let bFloat = b.doubleValue
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}

func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.intValue(b)
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (.stringValue(let a),.stringValue(let b)):
        let aFloat = a.doubleValue
        let bFloat = b.doubleValue
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}

func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.intValue(b)
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (.stringValue(let a),.stringValue(let b)):
        let aFloat = a.doubleValue
        let bFloat = b.doubleValue
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    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 (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.intValue(b)
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (.stringValue(let a),.stringValue(let b)):
        let aFloat = a.doubleValue
        let bFloat = b.doubleValue
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}

// Create a function that takes two 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 (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.intValue(b)
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (.stringValue(let a),.stringValue(let b)):
        let aFloat = a.doubleValue
        let bFloat = b.doubleValue
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}

// Create a function that takes two 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 (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.intValue(b)
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (.stringValue(let a),.stringValue(let b)):
        let aFloat = a.doubleValue
        let bFloat = b.doubleValue
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}
```
return a > b?.intValue(a) :.intValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.intValue(b) // expected expression
return a > b?.intValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // value of type 'Int' has no member 'intValue'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
let aFloat = a.doubleValue // value of type 'String' has no member 'doubleValue'
let bFloat = b.doubleValue // value of type 'String' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // cannot convert return expression of type 'Bool' to return type 'Value?'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of optional type 'Optional<_>' must be unwrapped to a value of type '_'
return a > b?.intValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.intValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // expected expression
return a > b?.intValue(a) :.intValue(b) // value of type 'Int' has no member 'intValue'
return a > b?.intValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
let aFloat = a.doubleValue // value of type 'String' has no member 'doubleValue'
let bFloat = b.doubleValue // value of type 'String' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of optional type 'Optional<_>' must be unwrapped to a value of type '_'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // cannot convert return expression of type 'Bool' to return type 'Value?'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression
return a > b?.intValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.intValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // value of type 'Int' has no member 'intValue'
return a > b?.intValue(a) :.intValue(b) // expected expression
return a > b?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.doubleValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
let aFloat = a.doubleValue // value of type 'String' has no member 'doubleValue'
let bFloat = b.doubleValue // value of type 'String' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of optional type 'Optional<_>' must be unwrapped to a value of type '_'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // cannot convert return expression of type 'Bool' 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), let.intValue(b)):
        return a > b?.intValue(a) :.intValue(b)
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (let.stringValue(a), let.stringValue(b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    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), let.intValue(b)):
        return a > b?.intValue(a) :.intValue(b)
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (let.stringValue(a), let.stringValue(b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}
```
return a > b?.intValue(a) :.intValue(b) // value of type 'Int' has no member 'intValue'
return a > b?.intValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.intValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // cannot convert return expression of type 'Bool' to return type 'Value?'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of type 'Double' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // binary operator '>' cannot be applied to operands of type 'Double?' and 'Optional<_>'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.intValue(b)
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (.stringValue(let a),.stringValue(let b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    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 (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) :.intValue(b)
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (.stringValue(let a),.stringValue(let b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}
```
return a > b?.intValue(a) :.intValue(b) // value of type 'Int' has no member 'intValue'
return a > b?.intValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.intValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // cannot convert return expression of type 'Bool' to return type 'Value?'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of type 'Double' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // binary operator '>' cannot be applied to operands of type 'Double?' and 'Optional<_>'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression

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), let.intValue(b)):
        return a > b?.intValue(a) :.intValue(b)
    case (let.intValue(a), let.doubleValue(b)):
        return a > b?.intValue(a) :.doubleValue(b)
    case (let.intValue(a), let.stringValue(b)):
        return a > b?.intValue(a) :.stringValue(b)
    case (let.doubleValue(a), let.intValue(b)):
        return a > b?.doubleValue(a) :.intValue(b)
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (let.doubleValue(a), let.stringValue(b)):
        return a > b?.doubleValue(a) :.stringValue(b)
    case (let.stringValue(a), let.intValue(b)):
        return a > b?.stringValue(a) :.intValue(b)
    case (let.stringValue(a), let.doubleValue(b)):
        return a > b?.stringValue(a) :.doubleValue(b)
    case (let.stringValue(a), let.stringValue(b)):
        return a > b?.stringValue(a) :.stringValue(b)
    }
}
```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), let.intValue(b)):
        return a > b?.intValue(a) :.intValue(b)
    case (let.intValue(a), let.doubleValue(b)):
        return a > b?.intValue(a) :.doubleValue(b)
    case (let.intValue(a), let.stringValue(b)):
        return a > b?.intValue(a) :.stringValue(b)
    case (let.doubleValue(a), let.intValue(b)):
        return a > b?.doubleValue(a) :.intValue(b)
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (let.doubleValue(a), let.stringValue(b)):
        return a > b?.doubleValue(a) :.stringValue(b)
    case (let.stringValue(a), let.intValue(b)):
        return a > b?.stringValue(a) :.intValue(b)
    case (let.stringValue(a), let.doubleValue(b)):
        return a > b?.stringValue(a) :.doubleValue(b)
    case (let.stringValue(a), let.stringValue(b)):
        return a > b?.stringValue(a) :.stringValue(b)
    }
}
```
return a > b?.intValue(a) :.intValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.intValue(b) // expected expression
return a > b?.intValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // value of type 'Int' has no member 'intValue'
return a > b?.intValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.doubleValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.doubleValue(b) // value of type 'Double' has no member 'intValue'
return a > b?.intValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
return a > b?.intValue(a) :.doubleValue(b) // expected expression
return a > b?.intValue(a) :.stringValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.stringValue(b) // cannot use optional chaining on non-optional value of type 'String'
return a > b?.intValue(a) :.stringValue(b) // expected expression
return a > b?.intValue(a) :.stringValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.stringValue(b) // value of type 'String' has no member 'intValue'
return a > b?.intValue(a) :.stringValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.doubleValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.doubleValue(a) :.intValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.intValue(b) // expected expression
return a > b?.doubleValue(a) :.intValue(b) // value of type 'Int' has no member 'doubleValue'
return a > b?.doubleValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.doubleValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.stringValue(b) // expected expression
return a > b?.doubleValue(a) :.stringValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.stringValue(b) // value of type 'String' has no member 'doubleValue'
return a > b?.doubleValue(a) :.stringValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.stringValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.stringValue(b) // cannot use optional chaining on non-optional value of type 'String'
return a > b?.stringValue(a) :.intValue(b) // expected expression
return a > b?.stringValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.stringValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.stringValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.stringValue(a) :.intValue(b) // value of type 'Int' has no member 'stringValue'
return a > b?.stringValue(a) :.intValue(b) // value of optional type 'String?' must be unwrapped to a value of type 'String'
return a > b?.stringValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
return a > b?.stringValue(a) :.doubleValue(b) // value of type 'Double' has no member 'stringValue'
return a > b?.stringValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.stringValue(a) :.doubleValue(b) // value of optional type 'String?' must be unwrapped to a value of type 'String'
return a > b?.stringValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.stringValue(a) :.doubleValue(b) // expected expression
return a > b?.stringValue(a) :.stringValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.stringValue(a) :.stringValue(b) // cannot use optional chaining on non-optional value of type 'String'
return a > b?.stringValue(a) :.stringValue(b) // expected expression
return a > b?.stringValue(a) :.stringValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.stringValue(a) :.stringValue(b) // value of optional type 'String?' must be unwrapped to a value of type 'String'
return a > b?.stringValue(a) :.stringValue(b) // value of type 'String' has no member 'stringValue'

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), let.intValue(b)):
        return a > b?.intValue(a) :.intValue(b)
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (let.stringValue(a), let.stringValue(b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    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), let.intValue(b)):
        return a > b?.intValue(a) :.intValue(b)
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) :.doubleValue(b)
    case (let.stringValue(a), let.stringValue(b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}
```
return a > b?.intValue(a) :.intValue(b) // value of type 'Int' has no member 'intValue'
return a > b?.intValue(a) :.intValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) :.intValue(b) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) :.intValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot use optional chaining on non-optional value of type 'Double'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // cannot convert return expression of type 'Bool' to return type 'Value?'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of type 'Double' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // binary operator '>' cannot be applied to operands of type 'Double?' and 'Optional<_>'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression

func isEqualToSumEven(n: Int) -> Bool {
    // TODO: implement isEqualToSumEven(n: Int) -> Bool
}
```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 {
    // TODO: implement isEqualToSumEven(n: Int) -> Bool
}
```
} // missing return in global function expected to return 'Bool'

func isEqualToSumEven(n: Int) -> Bool {
    // TODO: implement isEqualToSumEven
    return false
}
```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 {
    // TODO: implement isEqualToSumEven
    return false
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    // TODO: Implement isEqualToSumEven
    return false
}
```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 {
    // TODO: Implement isEqualToSumEven
    return false
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var sum = 0
    for i in 1...n/2 {
        if n % i == 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 1...n/2 {
        if n % i == 0 {
            sum += i
        }
    }
    return sum == n
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var sum = 0
    for i in 0..<n {
        if i % 2 == 0 {
            sum += i
        }
        if sum > n {
            break
        }
    }
    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 0..<n {
        if i % 2 == 0 {
            sum += i
        }
        if sum > n {
            break
        }
    }
    return sum == n
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    // TODO: Implement isEqualToSumEven
    return false
}
```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 {
    // TODO: Implement isEqualToSumEven
    return false
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var sum = 0
    for i in 0..<n {
        if i % 2 == 0 {
            sum += i
        }
        if sum > n {
            break
        }
    }
    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 0..<n {
        if i % 2 == 0 {
            sum += i
        }
        if sum > n {
            break
        }
    }
    return sum == n
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var sum = 0
    for i in 0..<n {
        if i % 2 == 0 {
            sum += i
        }
        if sum == n {
            return true
        }
    }
    return false
}
```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 0..<n {
        if i % 2 == 0 {
            sum += i
        }
        if sum == n {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var sum = 0
    for i in 1...n/2 {
        if n % i == 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 1...n/2 {
        if n % i == 0 {
            sum += i
        }
    }
    return sum == n
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    var sum = 0
    for i in 0..<n/2 {
        if n - 2 * i > 0 {
            sum += 2 * i
        } else {
            break
        }
    }
    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 0..<n/2 {
        if n - 2 * i > 0 {
            sum += 2 * i
        } else {
            break
        }
    }
    return sum == n
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func specialFactorial(n: Int) -> Int {
    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 {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func specialFactorial(n: Int) -> Int {
    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 {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    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 {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    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 {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func specialFactorial(n: Int) -> Int {
    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 {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    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 {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    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 {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    // TODO: Replace this line with your implementation
    return text.replace(" ", with: "_")
}
```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 {
    // TODO: Replace this line with your implementation
    return text.replace(" ", with: "_")
}
```
return text.replace(" ", with: "_") // cannot use mutating member on immutable value: 'text' is a 'let' constant
return text.replace(" ", with: "_") // cannot convert return expression of type '()' to return type 'String'

func fixSpaces(text: String) -> String {
    var result = ""
    var previousCharacter = ""
    for character in text {
        if character == " " {
            if previousCharacter == " " {
                result += "-"
            } else {
                result += "_"
            }
        } else {
            result += character
        }
        previousCharacter = character
    }
    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 previousCharacter = ""
    for character in text {
        if character == " " {
            if previousCharacter == " " {
                result += "-"
            } else {
                result += "_"
            }
        } else {
            result += character
        }
        previousCharacter = character
    }
    return result
}
```
result += character // cannot convert value of type 'Character' to expected argument type 'String'
previousCharacter = character // cannot assign value of type 'Character' to type 'String'

func fixSpaces(text: String) -> String {
    // TODO: Replace this line with your code
    return text.replaceAll(matching: "\\s+", with: "-")
}
```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 {
    // TODO: Replace this line with your code
    return text.replaceAll(matching: "\\s+", with: "-")
}
```
return text.replaceAll(matching: "\\s+", with: "-") // value of type 'String' has no member 'replaceAll'

func fixSpaces(text: String) -> String {
    return text.replaceSubrange(text.startIndex..<text.endIndex, with: text.replacingOccurrences(of: " ", with: "_"))
}
```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 {
    return text.replaceSubrange(text.startIndex..<text.endIndex, with: text.replacingOccurrences(of: " ", with: "_"))
}
```
return text.replaceSubrange(text.startIndex..<text.endIndex, with: text.replacingOccurrences(of: " ", with: "_")) // cannot convert return expression of type '()' to return type 'String'
return text.replaceSubrange(text.startIndex..<text.endIndex, with: text.replacingOccurrences(of: " ", with: "_")) // cannot use mutating member on immutable value: 'text' is a 'let' constant

func fixSpaces(text: String) -> String {
    let regex = try! NSRegularExpression(
        pattern: "([ ]+)([ ]+)",
        options:.caseInsensitive
    )
    let result = regex.replaceMatches(
        in: text,
        options:.withTransformation,
        with: { (match: NSRange, _) -> String in
            let str = text[match]
            return str.count > 2? "-" : "_"
        }
    )
    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 {
    let regex = try! NSRegularExpression(
        pattern: "([ ]+)([ ]+)",
        options:.caseInsensitive
    )
    let result = regex.replaceMatches(
        in: text,
        options:.withTransformation,
        with: { (match: NSRange, _) -> String in
            let str = text[match]
            return str.count > 2? "-" : "_"
        }
    )
    return result
}
```
let result = regex.replaceMatches( // missing arguments for parameters 'range', 'withTemplate' in call
in: text, // cannot convert value of type 'String' to expected argument type 'NSMutableString'
options:.withTransformation, // type 'NSRegularExpression.MatchingOptions' has no member 'withTransformation'
with: { (match: NSRange, _) -> String in // extra argument 'with' in call
let str = text[match] // subscript 'subscript(_:)' requires that 'NSRange' (aka '_NSRange') conform to 'RangeExpression'
return str.count > 2? "-" : "_" // expected expression
return str.count > 2? "-" : "_" // consecutive statements on a line must be separated by ';'
return str.count > 2? "-" : "_" // consecutive statements on a line must be separated by ';'

func fixSpaces(text: String) -> String {
    var result = ""
    var lastChar = ""
    for char in text {
        if char == " " {
            if lastChar == " " {
                result += "-"
            } else {
                result += "_"
            }
        } else {
            result += char
        }
        lastChar = 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 = ""
    for char in text {
        if char == " " {
            if lastChar == " " {
                result += "-"
            } else {
                result += "_"
            }
        } else {
            result += char
        }
        lastChar = char
    }
    return result
}
```
result += char // cannot convert value of type 'Character' to expected argument type 'String'
lastChar = char // cannot assign value of type 'Character' to type 'String'

func fixSpaces(text: String) -> String {
    var result = ""
    var previousCharacter = " "
    for character in text {
        if character == " " && previousCharacter == " " {
            result += "-"
        } else {
            result += character
        }
        previousCharacter = character
    }
    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 previousCharacter = " "
    for character in text {
        if character == " " && previousCharacter == " " {
            result += "-"
        } else {
            result += character
        }
        previousCharacter = character
    }
    return result
}
```
result += character // cannot convert value of type 'Character' to expected argument type 'String'
previousCharacter = character // cannot assign value of type 'Character' to type 'String'

func fixSpaces(text: String) -> String {
    var result = ""
    var previous = ""
    for character in text {
        if character == " " {
            if previous == " " {
                result += "-"
            } else {
                result += "_"
            }
        } else {
            result += character
        }
        previous = character
    }
    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 previous = ""
    for character in text {
        if character == " " {
            if previous == " " {
                result += "-"
            } else {
                result += "_"
            }
        } else {
            result += character
        }
        previous = character
    }
    return result
}
```
result += character // cannot convert value of type 'Character' to expected argument type 'String'
previous = character // cannot assign value of type 'Character' to type 'String'

func fixSpaces(text: String) -> String {
    return text.replaceOccurrences(of: " ", with: "_")
       .replacingOccurrences(of: "__", with: "-")
}
```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 {
    return text.replaceOccurrences(of: " ", with: "_")
       .replacingOccurrences(of: "__", with: "-")
}
```
return text.replaceOccurrences(of: " ", with: "_") // value of type 'String' has no member 'replaceOccurrences'

func fixSpaces(text: String) -> String {
    var result = ""
    var prevChar = ""
    for char in text {
        if char == " " && prevChar == " " {
            result += "-"
        } else if char == " " {
            result += "_"
        } else {
            result += String(char)
        }
        prevChar = 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 prevChar = ""
    for char in text {
        if char == " " && prevChar == " " {
            result += "-"
        } else if char == " " {
            result += "_"
        } else {
            result += String(char)
        }
        prevChar = String(char)
    }
    return result
}
```
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    // TODO: Implement this function
    let fileNameArray = fileName.split(separator: ".")
    if fileNameArray.count > 3 || fileNameArray.count < 2 {
        return "No"
    }
    let firstPart = fileNameArray[0]
    let secondPart = fileNameArray[1]
    if firstPart.count > 3 || secondPart.count > 3 {
        return "No"
    }
    if!firstPart.hasPrefix(CharacterSet.letters.inverted) {
        return "No"
    }
    if!(secondPart == "txt" || secondPart == "exe" || secondPart == "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 {
    // TODO: Implement this function
    let fileNameArray = fileName.split(separator: ".")
    if fileNameArray.count > 3 || fileNameArray.count < 2 {
        return "No"
    }
    let firstPart = fileNameArray[0]
    let secondPart = fileNameArray[1]
    if firstPart.count > 3 || secondPart.count > 3 {
        return "No"
    }
    if!firstPart.hasPrefix(CharacterSet.letters.inverted) {
        return "No"
    }
    if!(secondPart == "txt" || secondPart == "exe" || secondPart == "dll") {
        return "No"
    }
    return "Yes"
}
```
if!firstPart.hasPrefix(CharacterSet.letters.inverted) { // expected expression, var, or let in 'if' condition
if!(secondPart == "txt" || secondPart == "exe" || secondPart == "dll") { // expected expression, var, or let in 'if' condition

func fileNameCheck(fileName: String) -> String {
    // TODO: Implement this function
    let fileNameArray = fileName.split(separator: ".")
    let fileNameArrayLength = fileNameArray.count
    if fileNameArrayLength > 3 {
        return "No"
    }
    if fileNameArray[0].count > 3 {
        return "No"
    }
    if fileNameArray[1].count == 0 {
        return "No"
    }
    if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "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 {
    // TODO: Implement this function
    let fileNameArray = fileName.split(separator: ".")
    let fileNameArrayLength = fileNameArray.count
    if fileNameArrayLength > 3 {
        return "No"
    }
    if fileNameArray[0].count > 3 {
        return "No"
    }
    if fileNameArray[1].count == 0 {
        return "No"
    }
    if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" {
        return "No"
    }
    return "Yes"
}
```
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // use of '=' in a boolean context, did you mean '=='?
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot force unwrap value of non-optional type 'String.SubSequence' (aka 'Substring')
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot assign value of type '()' to type 'String.SubSequence' (aka 'Substring')
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'Bool'
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'Bool'
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot force unwrap value of non-optional type 'String.SubSequence' (aka 'Substring')
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot force unwrap value of non-optional type 'String.SubSequence' (aka 'Substring')

func fileNameCheck(fileName: String) -> String {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'String'

func fileNameCheck(fileName: String) -> String {
    // TODO: Replace this line with your implementation.
    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 {
    // TODO: Replace this line with your implementation.
    return "Yes"
}
```
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    let regex = try! NSRegularExpression(
        pattern: "^[a-zA-Z][a-zA-Z0-9]{0,2}\\.[a-zA-Z]{3}$",
        options:.caseInsensitive
    )
    return regex.firstMatch(in: fileName, range: NSRange(location: 0, length: fileName.count))!= nil? "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}\\.[a-zA-Z]{3}$",
        options:.caseInsensitive
    )
    return regex.firstMatch(in: fileName, range: NSRange(location: 0, length: fileName.count))!= nil? "Yes" : "No"
}
```
return regex.firstMatch(in: fileName, range: NSRange(location: 0, length: fileName.count))!= nil? "Yes" : "No" // cannot assign through '!': function call returns immutable value
return regex.firstMatch(in: fileName, range: NSRange(location: 0, length: fileName.count))!= nil? "Yes" : "No" // expected expression
return regex.firstMatch(in: fileName, range: NSRange(location: 0, length: fileName.count))!= nil? "Yes" : "No" // cannot convert return expression of type '()' to return type 'String'
return regex.firstMatch(in: fileName, range: NSRange(location: 0, length: fileName.count))!= nil? "Yes" : "No" // cannot assign value of type 'Optional<_>' to type 'NSTextCheckingResult'
return regex.firstMatch(in: fileName, range: NSRange(location: 0, length: fileName.count))!= nil? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return regex.firstMatch(in: fileName, range: NSRange(location: 0, length: fileName.count))!= nil? "Yes" : "No" // '=' must have consistent whitespace on both sides
return regex.firstMatch(in: fileName, range: NSRange(location: 0, length: fileName.count))!= nil? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return regex.firstMatch(in: fileName, range: NSRange(location: 0, length: fileName.count))!= nil? "Yes" : "No" // string literal is unused
return regex.firstMatch(in: fileName, range: NSRange(location: 0, length: fileName.count))!= nil? "Yes" : "No" // 'nil' requires a contextual type

func fileNameCheck(fileName: String) -> String {
    // TODO: Replace this line with your implementation.
    return ""
}
```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 {
    // TODO: Replace this line with your implementation.
    return ""
}
```
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    // TODO: Add your code 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 {
    // TODO: Add your code here
    return "No"
}
```
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    
    // Your code goes here
    
    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 {
    
    // Your code goes here
    
    return "Yes"
}
```
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    
    // Your code goes here
    
    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 {
    
    // Your code goes here
    
    return "Yes"
}
```
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    // TODO: Replace this line with your implementation.
    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 {
    // TODO: Replace this line with your implementation.
    return "Yes"
}
```
 // XCTAssertTrue failed

func wordsInSentence(sentence: String) -> String {
    var words = sentence.split(separator: " ").map { $0.count }
    var result = ""
    for word in words {
        if isPrime(number: word) {
            result.append(String(word))
            result.append(" ")
        }
    }
    return result.trimmingCharacters(in:.whitespaces)
}
```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 {
    var words = sentence.split(separator: " ").map { $0.count }
    var result = ""
    for word in words {
        if isPrime(number: word) {
            result.append(String(word))
            result.append(" ")
        }
    }
    return result.trimmingCharacters(in:.whitespaces)
}
```
var words = sentence.split(separator: " ").map { $0.count } // ambiguous use of 'split(separator:maxSplits:omittingEmptySubsequences:)'

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    var result = ""
    for word in words {
        if isPrime(number: word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```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(number: word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```
if isPrime(number: word.count) { // cannot find 'isPrime' in scope

func wordsInSentence(sentence: String) -> String {
    var words = sentence.components(separatedBy: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result.append(word)
            result.append(" ")
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```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 {
    var words = sentence.components(separatedBy: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result.append(word)
            result.append(" ")
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```
if isPrime(word.count) { // cannot find 'isPrime' in scope

func wordsInSentence(sentence: String) -> String {
    var result = ""
    for word in sentence.split(separator: " ") {
        if isPrime(word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```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 {
    var result = ""
    for word in sentence.split(separator: " ") {
        if isPrime(word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```
if isPrime(word.count) { // cannot find 'isPrime' in scope

func wordsInSentence(sentence: String) -> String {
    // Write your solution here
    var words = sentence.split(separator: " ")
    var result = ""
    for word in words {
        if isPrime(number: word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```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 {
    // Write your solution here
    var words = sentence.split(separator: " ")
    var result = ""
    for word in words {
        if isPrime(number: word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```
if isPrime(number: word.count) { // cannot find 'isPrime' in scope

func wordsInSentence(sentence: String) -> String {
    // Write your solution here
    var result = ""
    let words = sentence.split(separator: " ")
    for word in words {
        if isPrime(number: word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```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 {
    // Write your solution here
    var result = ""
    let words = sentence.split(separator: " ")
    for word in words {
        if isPrime(number: word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```
if isPrime(number: word.count) { // cannot find 'isPrime' in scope

func wordsInSentence(sentence: String) -> String {
    // Write your solution here
    var words = sentence.split(separator: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```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 {
    // Write your solution here
    var words = sentence.split(separator: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```
if isPrime(word.count) { // cannot find 'isPrime' in scope

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    var result = ""
    for word in words {
        if isPrime(number: word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```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(number: word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```
if isPrime(number: word.count) { // cannot find 'isPrime' in scope

func wordsInSentence(sentence: String) -> String {
    // Write your solution here
    var words = sentence.components(separatedBy: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```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 {
    // Write your solution here
    var words = sentence.components(separatedBy: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```
if isPrime(word.count) { // cannot find 'isPrime' in scope

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    var result = ""
    for word in words {
        if isPrime(number: word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```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(number: word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespacesAndNewlines)
}
```
if isPrime(number: word.count) { // cannot find 'isPrime' in scope

func simplify(x: String, n: String) -> Bool {
    // Your code goes here
}
```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 {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    // Your code goes here
}
```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 {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    // Your code goes here
}
```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 {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    // Your code goes here
}
```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 {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    // your code goes here
}
```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 {
    // your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    // your code goes here
}
```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 {
    // your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    // Your code goes here
}
```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 {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    // TODO: Your code goes here
}
```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 {
    // TODO: Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    // your code goes here
}
```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 {
    // your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func simplify(x: String, n: String) -> Bool {
    // Your code goes here
}
```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 {
    // Your code goes here
}
```
} // missing return in global function expected to return 'Bool'

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: implement
}
```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: implement
}
```
} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: implement me
}
```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: implement me
}
```
} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: Implement this method
}
```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: Implement this method
}
```
} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: implement me
}
```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: implement me
}
```
} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: implement me
}
```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: implement me
}
```
} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: implement me
}
```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: implement me
}
```
} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: implement me
}
```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: implement me
}
```
} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: implement me
}
```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: implement me
}
```
} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: implement me
}
```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: implement me
}
```
} // missing return in global function expected to return '[Int]'

func orderByPoints(nums: [Int]) -> [Int] {
    // TODO: implement me
}
```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: implement me
}
```
} // missing return in global function expected to return '[Int]'

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 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 % 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 % 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 % 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 % 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 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 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 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    // Write your code here.
    var count = 0
    for num in nums {
        if num > 10 && num % 2 == 1 {
            if num % 10 == 1 || num % 10 == 3 || num % 10 == 5 || num % 10 == 7 || 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 {
    // Write your code here.
    var count = 0
    for num in nums {
        if num > 10 && num % 2 == 1 {
            if num % 10 == 1 || num % 10 == 3 || num % 10 == 5 || num % 10 == 7 || num % 10 == 9 {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 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 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 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 % 2 == 1 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

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-3 {
        for j in i+1...n-2 {
            for k in j+1...n-1 {
                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-3 {
        for j in i+1...n-2 {
            for k in j+1...n-1 {
                if a[i] + a[j] + a[k] % 3 == 0 {
                    count += 1
                }
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

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-3 {
        for j in i+1...n-2 {
            for k in j+1...n-1 {
                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-3 {
        for j in i+1...n-2 {
            for k in j+1...n-1 {
                if a[i] + a[j] + a[k] % 3 == 0 {
                    count += 1
                }
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

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 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-2 {
        for j in i+1..<n-1 {
            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-2 {
        for j in i+1..<n-1 {
            for k in j+1...n {
                if a[i] + a[j] + a[k] % 3 == 0 {
                    count += 1
                }
            }
        }
    }
    return count
}
```
 // Fatal error: Index out of range

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 getMaxTriples(n: Int) -> Int {
    // Write your code here
    var maxTriples = 0
    var a = [Int]()
    for i in 1...n {
        a.append(i * i - i + 1)
    }
    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 {
                    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 {
    // Write your code here
    var maxTriples = 0
    var a = [Int]()
    for i in 1...n {
        a.append(i * i - i + 1)
    }
    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 {
                    maxTriples += 1
                }
            }
        }
    }
    return maxTriples
}
```
 // Fatal error: Index out of range

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 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 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 getMaxTriples(n: Int) -> Int {
    let a = [Int](repeating: 0, count: n, identity: { i in 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 {
    let a = [Int](repeating: 0, count: n, identity: { i in 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
}
```
let a = [Int](repeating: 0, count: n, identity: { i in i * i - i + 1 }) // extra argument 'identity' in call

func sortedListSum(lst: [String]) -> [String] {
    // TODO: implement me!
}
```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] {
    // TODO: implement me!
}
```
} // missing return in global function expected to return '[String]'

func sortedListSum(lst: [String]) -> [String] {
    // TODO: Implement this function
}
```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] {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return '[String]'

func sortedListSum(lst: [String]) -> [String] {
    var result = lst.sorted(by: {
        (a: String, b: String) -> Bool in
        if a.count == b.count {
            return a < b
        }
        return a.count < b.count
    })
    var newLst = [String]()
    for str in result {
        if str.count % 2!= 0 {
            newLst.append(str)
        }
    }
    return newLst
}
```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.sorted(by: {
        (a: String, b: String) -> Bool in
        if a.count == b.count {
            return a < b
        }
        return a.count < b.count
    })
    var newLst = [String]()
    for str in result {
        if str.count % 2!= 0 {
            newLst.append(str)
        }
    }
    return newLst
}
```
if str.count % 2!= 0 { // '=' must have consistent whitespace on both sides
if str.count % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if str.count % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if str.count % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'

func sortedListSum(lst: [String]) -> [String] {
    var result: [String] = []
    for word in lst {
        if word.count % 2 == 0 {
            result.append(word)
        }
    }
    result.sort()
    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: [String] = []
    for word in lst {
        if word.count % 2 == 0 {
            result.append(word)
        }
    }
    result.sort()
    return result
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    var result: [String] = []
    for word in lst {
        if word.count % 2 == 0 {
            result.append(word)
        }
    }
    result.sort()
    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: [String] = []
    for word in lst {
        if word.count % 2 == 0 {
            result.append(word)
        }
    }
    result.sort()
    return result
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    let sortedLst = lst.sorted(by: { $0.count < $1.count })
    return sortedLst.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 sortedLst = lst.sorted(by: { $0.count < $1.count })
    return sortedLst.filter { $0.count % 2 == 0 }
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    var sortedList = lst.sorted {
        $0.count < $1.count || $0.count == $1.count && $0 < $1
    }
    var result = [String]()
    for word in sortedList {
        if word.count % 2 == 0 {
            result.append(word)
        }
    }
    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 sortedList = lst.sorted {
        $0.count < $1.count || $0.count == $1.count && $0 < $1
    }
    var result = [String]()
    for word in sortedList {
        if word.count % 2 == 0 {
            result.append(word)
        }
    }
    return result
}
```
var sortedList = lst.sorted { // variable 'sortedList' was never mutated; consider changing to 'let' constant

func sortedListSum(lst: [String]) -> [String] {
    let sortedLst = lst.sorted { $0.count < $1.count }
    return sortedLst.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 sortedLst = lst.sorted { $0.count < $1.count }
    return sortedLst.filter { $0.count % 2 == 0 }
}
```
 // XCTAssertTrue failed

func sortedListSum(lst: [String]) -> [String] {
    var result = lst.filter { $0.count % 2 == 0 }
    result.sort(by: { $0.count < $1.count })
    result.sort(by: { $0 < $1 })
    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.filter { $0.count % 2 == 0 }
    result.sort(by: { $0.count < $1.count })
    result.sort(by: { $0 < $1 })
    return result
}
```
 // 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 {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func xOrY(n: Int, x: Int, y: Int) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func xOrY(n: Int, x: Int, y: Int) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func xOrY(n: Int, x: Int, y: Int) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func xOrY(n: Int, x: Int, y: Int) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func xOrY(n: Int, x: Int, y: Int) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func xOrY(n: Int, x: Int, y: Int) -> Int {
    // Your code goes 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 goes here
}
```
} // missing return in global function expected to return 'Int'

func xOrY(n: Int, x: Int, y: Int) -> Int {
    // TODO: implement me!
}
```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 {
    // TODO: implement me!
}
```
} // missing return in global function expected to return 'Int'

func xOrY(n: Int, x: Int, y: Int) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

func xOrY(n: Int, x: Int, y: Int) -> Int {
    if n > 1 {
        for i in 2..<n {
            if n % i == 0 {
                return y
            }
        }
        return x
    }
    return y
}
```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 {
        for i in 2..<n {
            if n % i == 0 {
                return y
            }
        }
        return x
    }
    return y
}
```

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    var sumOfSquares = 0
    for i in lst {
        if i < 0 || i.isInteger == false {
            continue
        }
        sum += i
        sumOfSquares += i * i
    }
    if sum == 0 {
        return 0
    }
    return Int(sumOfSquares - sum * 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
    var sumOfSquares = 0
    for i in lst {
        if i < 0 || i.isInteger == false {
            continue
        }
        sum += i
        sumOfSquares += i * i
    }
    if sum == 0 {
        return 0
    }
    return Int(sumOfSquares - sum * sum)
}
```
if i < 0 || i.isInteger == false { // value of type 'Double' has no member 'isInteger'
sum += i // cannot convert value of type 'Double' to expected argument type 'Int'
sumOfSquares += i * i // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    var oddSum = 0
    for i in lst {
        if i % 2!= 0 {
            oddSum += i
        }
        sum += i
    }
    return Int(pow(Double(oddSum), 2) - pow(Double(sum - oddSum), 2))
}
```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
    var oddSum = 0
    for i in lst {
        if i % 2!= 0 {
            oddSum += i
        }
        sum += i
    }
    return Int(pow(Double(oddSum), 2) - pow(Double(sum - oddSum), 2))
}
```
if i % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if i % 2!= 0 { // cannot force unwrap value of non-optional type 'Double'
if i % 2!= 0 { // '=' must have consistent whitespace on both sides
oddSum += i // cannot convert value of type 'Double' to expected argument type 'Int'
sum += i // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    for i in lst {
        sum += i
    }
    var sumOfSquares = 0
    for i in lst {
        sumOfSquares += i * i
    }
    var sumOfOdd = 0
    for i in lst {
        if i % 2!= 0 {
            sumOfOdd += i
        }
    }
    return Int(sumOfOdd * sumOfOdd - sum * 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 i in lst {
        sum += i
    }
    var sumOfSquares = 0
    for i in lst {
        sumOfSquares += i * i
    }
    var sumOfOdd = 0
    for i in lst {
        if i % 2!= 0 {
            sumOfOdd += i
        }
    }
    return Int(sumOfOdd * sumOfOdd - sum * sum)
}
```
sum += i // cannot convert value of type 'Double' to expected argument type 'Int'
sumOfSquares += i * i // cannot convert value of type 'Double' to expected argument type 'Int'
if i % 2!= 0 { // '=' must have consistent whitespace on both sides
if i % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if i % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2!= 0 { // cannot force unwrap value of non-optional type 'Double'
sumOfOdd += i // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    var oddSum = 0
    for num in lst {
        if num % 2 == 1 {
            oddSum += num
        }
        sum += num
    }
    return Int(pow(Double(oddSum), 2) - pow(Double(sum - oddSum), 2))
}
```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
    var oddSum = 0
    for num in lst {
        if num % 2 == 1 {
            oddSum += num
        }
        sum += num
    }
    return Int(pow(Double(oddSum), 2) - pow(Double(sum - oddSum), 2))
}
```
if num % 2 == 1 { // '%' is unavailable: For floating point numbers use truncatingRemainder instead
oddSum += num // cannot convert value of type 'Double' to expected argument type 'Int'
sum += num // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    var sumOfSquares = 0
    for num in lst {
        if num % 2!= 0 && num >= 0 {
            sum += num
            sumOfSquares += num * num
        }
    }
    return sum * sum - sumOfSquares
}
```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
    var sumOfSquares = 0
    for num in lst {
        if num % 2!= 0 && num >= 0 {
            sum += num
            sumOfSquares += num * num
        }
    }
    return sum * sum - sumOfSquares
}
```
if num % 2!= 0 && num >= 0 { // cannot force unwrap value of non-optional type 'Double'
if num % 2!= 0 && num >= 0 { // expression is not assignable: binary operator returns immutable value
if num % 2!= 0 && num >= 0 { // '=' must have consistent whitespace on both sides
if num % 2!= 0 && num >= 0 { // use of '=' in a boolean context, did you mean '=='?
if num % 2!= 0 && num >= 0 { // integer literal value '0' cannot be used as a boolean; did you mean 'false'?
sum += num // cannot convert value of type 'Double' to expected argument type 'Int'
sumOfSquares += num * num // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    var sumOfSquares = 0
    for i in lst {
        if i % 2!= 0 {
            sum += i
            sumOfSquares += i * i
        }
    }
    return sum * sum - sumOfSquares
}
```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
    var sumOfSquares = 0
    for i in lst {
        if i % 2!= 0 {
            sum += i
            sumOfSquares += i * i
        }
    }
    return sum * sum - sumOfSquares
}
```
if i % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if i % 2!= 0 { // cannot force unwrap value of non-optional type 'Double'
if i % 2!= 0 { // '=' must have consistent whitespace on both sides
sum += i // cannot convert value of type 'Double' to expected argument type 'Int'
sumOfSquares += i * i // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    var sumOfSquares = 0
    for i in lst {
        if i < 0 || i.isInteger == false {
            continue
        }
        sum += i
        sumOfSquares += i * i
    }
    if sum == 0 {
        return 0
    }
    return Int(sumOfSquares - sum * 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
    var sumOfSquares = 0
    for i in lst {
        if i < 0 || i.isInteger == false {
            continue
        }
        sum += i
        sumOfSquares += i * i
    }
    if sum == 0 {
        return 0
    }
    return Int(sumOfSquares - sum * sum)
}
```
if i < 0 || i.isInteger == false { // value of type 'Double' has no member 'isInteger'
sum += i // cannot convert value of type 'Double' to expected argument type 'Int'
sumOfSquares += i * i // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    var oddSum = 0
    for num in lst {
        if num % 2 == 1 {
            oddSum += num
        }
        sum += num
    }
    return Int(pow(Double(oddSum), 2) - pow(Double(sum - oddSum), 2))
}
```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
    var oddSum = 0
    for num in lst {
        if num % 2 == 1 {
            oddSum += num
        }
        sum += num
    }
    return Int(pow(Double(oddSum), 2) - pow(Double(sum - oddSum), 2))
}
```
if num % 2 == 1 { // '%' is unavailable: For floating point numbers use truncatingRemainder instead
oddSum += num // cannot convert value of type 'Double' to expected argument type 'Int'
sum += num // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    var oddSum = 0
    for i in lst {
        if i % 2 == 1 {
            oddSum += i
        }
        sum += i
    }
    return Int(pow(Double(oddSum), 2) - pow(Double(sum - oddSum), 2))
}
```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
    var oddSum = 0
    for i in lst {
        if i % 2 == 1 {
            oddSum += i
        }
        sum += i
    }
    return Int(pow(Double(oddSum), 2) - pow(Double(sum - oddSum), 2))
}
```
if i % 2 == 1 { // '%' is unavailable: For floating point numbers use truncatingRemainder instead
oddSum += i // cannot convert value of type 'Double' to expected argument type 'Int'
sum += i // cannot convert value of type 'Double' to expected argument type 'Int'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    var sumOfSquares = 0
    for num in lst {
        if num % 2 == 1 && num >= 0 {
            sum += num
            sumOfSquares += num * num
        }
    }
    return Int(sumOfSquares - sum * 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
    var sumOfSquares = 0
    for num in lst {
        if num % 2 == 1 && num >= 0 {
            sum += num
            sumOfSquares += num * num
        }
    }
    return Int(sumOfSquares - sum * sum)
}
```
if num % 2 == 1 && num >= 0 { // '%' is unavailable: For floating point numbers use truncatingRemainder instead
sum += num // cannot convert value of type 'Double' to expected argument type 'Int'
sumOfSquares += num * num // cannot convert value of type 'Double' to expected argument type 'Int'

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result: [Int] = []
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```

func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```swift
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine if a person correctly guessed the results of a number of matches.
// You are given two arrays of scores and guesses of equal length, where each index shows a match. 
// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
// the value is 0, and if not, the value is the absolute difference between the guess and the score.
// example:
// compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
// compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2]) == [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<game.count {
        if game[i] == guess[i] {
            result.append(0)
        } else {
            result.append(abs(game[i] - guess[i]))
        }
    }
    return result
}
```

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO: Implement this method
    var maxStrength = 0.0
    var maxExtension = ""
    for extension in extensions {
        var strength = 0.0
        for (index, char) in extension.enumerated() {
            if char.isUpper {
                strength += 1
            } else {
                strength -= 1
            }
        }
        if strength > maxStrength {
            maxStrength = strength
            maxExtension = extension
        }
    }
    return className + "." + maxExtension
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO: Implement this method
    var maxStrength = 0.0
    var maxExtension = ""
    for extension in extensions {
        var strength = 0.0
        for (index, char) in extension.enumerated() {
            if char.isUpper {
                strength += 1
            } else {
                strength -= 1
            }
        }
        if strength > maxStrength {
            maxStrength = strength
            maxExtension = extension
        }
    }
    return className + "." + maxExtension
}
```
for extension in extensions { // expected Sequence expression for for-each loop
for extension in extensions { // expected pattern
for extension in extensions { // expected '{' to start the body of for-each loop
for (index, char) in extension.enumerated() { // expected Sequence expression for for-each loop
for (index, char) in extension.enumerated() { // expected '{' to start the body of for-each loop
maxExtension = extension // expected '{' in extension
maxExtension = extension // expected expression in assignment
maxExtension = extension // declaration is only valid at file scope
} // expected type name in extension declaration

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // Your code here
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    // Your code here
}
```
} // missing return in global function expected to return 'String'

func Strongest_Extension(className: String, extensions: [String]) -> String {
    var maxStrength = 0
    var maxStrengthExtension = ""
    for extension in extensions {
        let strength = calculateStrength(className: className, extension: extension)
        if strength > maxStrength {
            maxStrength = strength
            maxStrengthExtension = extension
        }
    }
    return className + "." + maxStrengthExtension
}

func calculateStrength(className: String, extension: String) -> Int {
    let extensionCapitalCount = extension.filter({ $0.isUpperCase }).count
    let extensionSmallCount = extension.filter({ $0.isLowercase }).count
    return extensionCapitalCount - extensionSmallCount
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    var maxStrength = 0
    var maxStrengthExtension = ""
    for extension in extensions {
        let strength = calculateStrength(className: className, extension: extension)
        if strength > maxStrength {
            maxStrength = strength
            maxStrengthExtension = extension
        }
    }
    return className + "." + maxStrengthExtension
}

func calculateStrength(className: String, extension: String) -> Int {
    let extensionCapitalCount = extension.filter({ $0.isUpperCase }).count
    let extensionSmallCount = extension.filter({ $0.isLowercase }).count
    return extensionCapitalCount - extensionSmallCount
}
```
for extension in extensions { // expected pattern
for extension in extensions { // expected Sequence expression for for-each loop
for extension in extensions { // expected '{' to start the body of for-each loop
let strength = calculateStrength(className: className, extension: extension) // expected '{' in extension
let strength = calculateStrength(className: className, extension: extension) // consecutive statements on a line must be separated by ';'
let strength = calculateStrength(className: className, extension: extension) // missing argument for parameter 'extension' in call
let strength = calculateStrength(className: className, extension: extension) // expected type name in extension declaration
let strength = calculateStrength(className: className, extension: extension) // expected expression in list of expressions
let strength = calculateStrength(className: className, extension: extension) // declaration is only valid at file scope
maxStrengthExtension = extension // expected expression in assignment
maxStrengthExtension = extension // expected '{' in extension
maxStrengthExtension = extension // declaration is only valid at file scope
} // expected type name in extension declaration
let extensionCapitalCount = extension.filter({ $0.isUpperCase }).count // consecutive statements on a line must be separated by ';'
let extensionCapitalCount = extension.filter({ $0.isUpperCase }).count // expected type name in extension declaration
let extensionCapitalCount = extension.filter({ $0.isUpperCase }).count // declaration is only valid at file scope
let extensionCapitalCount = extension.filter({ $0.isUpperCase }).count // expected '{' in extension
let extensionCapitalCount = extension.filter({ $0.isUpperCase }).count // expected initial value after '='
let extensionSmallCount = extension.filter({ $0.isLowercase }).count // consecutive statements on a line must be separated by ';'
let extensionSmallCount = extension.filter({ $0.isLowercase }).count // expected '{' in extension
let extensionSmallCount = extension.filter({ $0.isLowercase }).count // declaration is only valid at file scope
let extensionSmallCount = extension.filter({ $0.isLowercase }).count // expected type name in extension declaration
let extensionSmallCount = extension.filter({ $0.isLowercase }).count // expected initial value after '='
return extensionCapitalCount - extensionSmallCount // cannot convert return expression of type 'Duration' to return type 'Int'

func Strongest_Extension(className: String, extensions: [String]) -> String {
    var maxStrength = 0.0
    var maxExtension = ""
    for extension in extensions {
        let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count
        if strength > maxStrength {
            maxStrength = strength
            maxExtension = extension
        }
    }
    return className + "." + maxExtension
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    var maxStrength = 0.0
    var maxExtension = ""
    for extension in extensions {
        let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count
        if strength > maxStrength {
            maxStrength = strength
            maxExtension = extension
        }
    }
    return className + "." + maxExtension
}
```
for extension in extensions { // expected pattern
for extension in extensions { // expected Sequence expression for for-each loop
for extension in extensions { // expected '{' to start the body of for-each loop
let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count // constant 'strength' inferred to have type '()', which may be unexpected
let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count // expected '{' in extension
let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count // expected '{' in extension
let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count // declaration is only valid at file scope
let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count // expected type name in extension declaration
let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count // declaration is only valid at file scope
let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count // expected type name in extension declaration
let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count // declaration is only valid at file scope
let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count // expected type name in extension declaration
let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count // expected expression in list of expressions
let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count // consecutive statements on a line must be separated by ';'
let strength = (extension.uppercased().count - extension.lowercased().count) / extension.count // expected '{' in extension
maxExtension = extension // declaration is only valid at file scope
maxExtension = extension // expected '{' in extension
maxExtension = extension // expected expression in assignment
} // expected type name in extension declaration

func Strongest_Extension(className: String, extensions: [String]) -> String {
    var maxStrength = 0
    var maxExtension = ""
    for extension in extensions {
        let strength = (extension.countOfUpperCaseLetters - extension.countOfLowerCaseLetters)
        if strength > maxStrength {
            maxStrength = strength
            maxExtension = extension
        }
    }
    return className + "." + maxExtension
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    var maxStrength = 0
    var maxExtension = ""
    for extension in extensions {
        let strength = (extension.countOfUpperCaseLetters - extension.countOfLowerCaseLetters)
        if strength > maxStrength {
            maxStrength = strength
            maxExtension = extension
        }
    }
    return className + "." + maxExtension
}
```
for extension in extensions { // expected pattern
for extension in extensions { // expected '{' to start the body of for-each loop
for extension in extensions { // expected Sequence expression for for-each loop
let strength = (extension.countOfUpperCaseLetters - extension.countOfLowerCaseLetters) // declaration is only valid at file scope
let strength = (extension.countOfUpperCaseLetters - extension.countOfLowerCaseLetters) // constant 'strength' inferred to have type '()', which may be unexpected
let strength = (extension.countOfUpperCaseLetters - extension.countOfLowerCaseLetters) // expected type name in extension declaration
let strength = (extension.countOfUpperCaseLetters - extension.countOfLowerCaseLetters) // declaration is only valid at file scope
let strength = (extension.countOfUpperCaseLetters - extension.countOfLowerCaseLetters) // expected type name in extension declaration
let strength = (extension.countOfUpperCaseLetters - extension.countOfLowerCaseLetters) // expected '{' in extension
let strength = (extension.countOfUpperCaseLetters - extension.countOfLowerCaseLetters) // consecutive statements on a line must be separated by ';'
let strength = (extension.countOfUpperCaseLetters - extension.countOfLowerCaseLetters) // expected '{' in extension
let strength = (extension.countOfUpperCaseLetters - extension.countOfLowerCaseLetters) // expected expression in list of expressions
maxExtension = extension // expected expression in assignment
maxExtension = extension // expected '{' in extension
maxExtension = extension // declaration is only valid at file scope
} // expected type name in extension declaration

func Strongest_Extension(className: String, extensions: [String]) -> String {
    
    var maxStrength = 0.0
    var maxExtension = ""
    
    for extension in extensions {
        let extensionName = extension.split(separator: ".").last
        let extensionNameLength = extensionName.count
        let extensionNameCapitalCount = extensionName.filter({ $0.isUpperCharacter }).count
        let extensionStrength = extensionNameCapitalCount - extensionNameLength
        
        if extensionStrength > maxStrength {
            maxStrength = extensionStrength
            maxExtension = extension
        }
    }
    
    return className + "." + maxExtension
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    
    var maxStrength = 0.0
    var maxExtension = ""
    
    for extension in extensions {
        let extensionName = extension.split(separator: ".").last
        let extensionNameLength = extensionName.count
        let extensionNameCapitalCount = extensionName.filter({ $0.isUpperCharacter }).count
        let extensionStrength = extensionNameCapitalCount - extensionNameLength
        
        if extensionStrength > maxStrength {
            maxStrength = extensionStrength
            maxExtension = extension
        }
    }
    
    return className + "." + maxExtension
}
```
for extension in extensions { // expected Sequence expression for for-each loop
for extension in extensions { // expected pattern
for extension in extensions { // expected '{' to start the body of for-each loop
let extensionName = extension.split(separator: ".").last // declaration is only valid at file scope
let extensionName = extension.split(separator: ".").last // expected '{' in extension
let extensionName = extension.split(separator: ".").last // consecutive statements on a line must be separated by ';'
let extensionName = extension.split(separator: ".").last // expected type name in extension declaration
let extensionName = extension.split(separator: ".").last // expected initial value after '='
maxExtension = extension // expected '{' in extension
maxExtension = extension // declaration is only valid at file scope
maxExtension = extension // expected expression in assignment
} // expected type name in extension declaration

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO: Implement this method
    var max_strength = 0.0
    var max_extension = ""
    for extension in extensions {
        var strength = 0.0
        for (index, char) in extension.enumerated() {
            if char.isUppercase {
                strength += 1.0
            } else {
                strength -= 1.0
            }
            if index == extension.count - 1 {
                strength += 1.0
            }
        }
        if strength > max_strength {
            max_strength = strength
            max_extension = extension
        }
    }
    return className + "." + max_extension
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO: Implement this method
    var max_strength = 0.0
    var max_extension = ""
    for extension in extensions {
        var strength = 0.0
        for (index, char) in extension.enumerated() {
            if char.isUppercase {
                strength += 1.0
            } else {
                strength -= 1.0
            }
            if index == extension.count - 1 {
                strength += 1.0
            }
        }
        if strength > max_strength {
            max_strength = strength
            max_extension = extension
        }
    }
    return className + "." + max_extension
}
```
for extension in extensions { // expected Sequence expression for for-each loop
for extension in extensions { // expected pattern
for extension in extensions { // expected '{' to start the body of for-each loop
for (index, char) in extension.enumerated() { // expected Sequence expression for for-each loop
for (index, char) in extension.enumerated() { // expected '{' to start the body of for-each loop
if index == extension.count - 1 { // expected type name in extension declaration
if index == extension.count - 1 { // declaration is only valid at file scope
if index == extension.count - 1 { // expected '{' in extension
if index == extension.count - 1 { // expected expression after operator
max_extension = extension // expected expression in assignment
max_extension = extension // declaration is only valid at file scope
max_extension = extension // expected '{' in extension
} // expected type name in extension declaration

func Strongest_Extension(className: String, extensions: [String]) -> String {
    var max = 0
    var max_name = ""
    for ext in extensions {
        let cap = ext.filter({$0.isUpper}).count
        let sm = ext.filter({$0.isLower}).count
        let strength = cap - sm
        if strength > max {
            max = strength
            max_name = ext
        }
    }
    return className + "." + max_name
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    var max = 0
    var max_name = ""
    for ext in extensions {
        let cap = ext.filter({$0.isUpper}).count
        let sm = ext.filter({$0.isLower}).count
        let strength = cap - sm
        if strength > max {
            max = strength
            max_name = ext
        }
    }
    return className + "." + max_name
}
```
let cap = ext.filter({$0.isUpper}).count // value of type 'String.Element' (aka 'Character') has no member 'isUpper'
let sm = ext.filter({$0.isLower}).count // value of type 'String.Element' (aka 'Character') has no member 'isLower'

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO: Implement this function
    
    // var maxStrength: Int = 0
    // var maxExtension: String = ""
    // for extension in extensions {
    //     let strength = extension.count(of: "A") - extension.count(of: "a")
    //     if strength > maxStrength {
    //         maxStrength = strength
    //         maxExtension = extension
    //     }
    // }
    // return className + "." + maxExtension
    
    var maxStrength: Int = 0
    var maxExtension: String = ""
    for extension in extensions {
        let strength = extension.count(of: "A") - extension.count(of: "a")
        if strength > maxStrength {
            maxStrength = strength
            maxExtension = extension
        }
    }
    return className + "." + maxExtension
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO: Implement this function
    
    // var maxStrength: Int = 0
    // var maxExtension: String = ""
    // for extension in extensions {
    //     let strength = extension.count(of: "A") - extension.count(of: "a")
    //     if strength > maxStrength {
    //         maxStrength = strength
    //         maxExtension = extension
    //     }
    // }
    // return className + "." + maxExtension
    
    var maxStrength: Int = 0
    var maxExtension: String = ""
    for extension in extensions {
        let strength = extension.count(of: "A") - extension.count(of: "a")
        if strength > maxStrength {
            maxStrength = strength
            maxExtension = extension
        }
    }
    return className + "." + maxExtension
}
```
for extension in extensions { // expected Sequence expression for for-each loop
for extension in extensions { // expected '{' to start the body of for-each loop
for extension in extensions { // expected pattern
let strength = extension.count(of: "A") - extension.count(of: "a") // expected '{' in extension
let strength = extension.count(of: "A") - extension.count(of: "a") // declaration is only valid at file scope
let strength = extension.count(of: "A") - extension.count(of: "a") // expected type name in extension declaration
let strength = extension.count(of: "A") - extension.count(of: "a") // declaration is only valid at file scope
let strength = extension.count(of: "A") - extension.count(of: "a") // expected type name in extension declaration
let strength = extension.count(of: "A") - extension.count(of: "a") // consecutive statements on a line must be separated by ';'
let strength = extension.count(of: "A") - extension.count(of: "a") // expected '{' in extension
let strength = extension.count(of: "A") - extension.count(of: "a") // expected initial value after '='
maxExtension = extension // expected expression in assignment
maxExtension = extension // declaration is only valid at file scope
maxExtension = extension // expected '{' in extension
} // expected type name in extension declaration

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO:
    return ""
}
```swift
// You will be given the name of a class (a string) and an array of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercase
// letters in the extension's name, and let SM be the number of lowercase letters 
// in the extension's name, the strength is given by the fraction CAP - SM. 
// You should find the strongest extension and return a string in this 
// format: ClassName.StrongestExtensionName.
// If there are two or more extensions with the same strength, you should
// choose the one that comes first in the array.
// For example, if you are given "Slices" as the class and an array of the
// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension 
// (its strength is -1).
// Example:
// Strongest_Extension(className: "myClass", extensions: ["AA", "Be", "CC"]) == "my_class.AA"
func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO:
    return ""
}
```
 // XCTAssertTrue failed

func cycpatternCheck(a: String, b: String) -> Bool {
    let aLen = a.characters.count
    let bLen = b.characters.count
    if aLen < bLen {
        return false
    }
    let bRotations = [b, String(repeating: b[0], count: bLen) + b]
    for rotation in bRotations {
        if a.rangeOfString(rotation)!= nil {
            return true
        }
    }
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    let aLen = a.characters.count
    let bLen = b.characters.count
    if aLen < bLen {
        return false
    }
    let bRotations = [b, String(repeating: b[0], count: bLen) + b]
    for rotation in bRotations {
        if a.rangeOfString(rotation)!= nil {
            return true
        }
    }
    return false
}
```
let aLen = a.characters.count // 'characters' is unavailable: Please use String directly
let bLen = b.characters.count // 'characters' is unavailable: Please use String directly
let bRotations = [b, String(repeating: b[0], count: bLen) + b] // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if a.rangeOfString(rotation)!= nil { // value of type 'String' has no member 'rangeOfString'
if a.rangeOfString(rotation)!= nil { // use of '=' in a boolean context, did you mean '=='?
if a.rangeOfString(rotation)!= nil { // '=' must have consistent whitespace on both sides

func cycpatternCheck(a: String, b: String) -> Bool {
    let aLen = a.characters.count
    let bLen = b.characters.count
    if aLen < bLen {
        return false
    }
    for i in 0..<bLen {
        let bRotated = String(a.characters.dropFirst(i).append(a.characters.dropLast(aLen - i)))
        if bRotated.rangeOfString(b)!= nil {
            return true
        }
    }
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    let aLen = a.characters.count
    let bLen = b.characters.count
    if aLen < bLen {
        return false
    }
    for i in 0..<bLen {
        let bRotated = String(a.characters.dropFirst(i).append(a.characters.dropLast(aLen - i)))
        if bRotated.rangeOfString(b)!= nil {
            return true
        }
    }
    return false
}
```
let aLen = a.characters.count // 'characters' is unavailable: Please use String directly
let bLen = b.characters.count // 'characters' is unavailable: Please use String directly
let bRotated = String(a.characters.dropFirst(i).append(a.characters.dropLast(aLen - i))) // value of type 'DropFirstSequence<String>' has no member 'append'
if bRotated.rangeOfString(b)!= nil { // use of '=' in a boolean context, did you mean '=='?
if bRotated.rangeOfString(b)!= nil { // '=' must have consistent whitespace on both sides

func cycpatternCheck(a: String, b: String) -> Bool {
    let aLen = a.characters.count
    let bLen = b.characters.count
    if aLen < bLen {
        return false
    }
    for i in 0..<aLen-bLen+1 {
        if a.substringWithRange(NSMakeRange(i, bLen)) == b {
            return true
        }
    }
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    let aLen = a.characters.count
    let bLen = b.characters.count
    if aLen < bLen {
        return false
    }
    for i in 0..<aLen-bLen+1 {
        if a.substringWithRange(NSMakeRange(i, bLen)) == b {
            return true
        }
    }
    return false
}
```
let aLen = a.characters.count // 'characters' is unavailable: Please use String directly
let bLen = b.characters.count // 'characters' is unavailable: Please use String directly
if a.substringWithRange(NSMakeRange(i, bLen)) == b { // value of type 'String' has no member 'substringWithRange'

func cycpatternCheck(a: String, b: String) -> Bool {
    var a = a
    var b = b
    var bRotated = ""
    
    for _ in 0..<b.count {
        bRotated = bRotated + String(b.characters.dropLast()) + String(b.characters.dropFirst())
    }
    
    return bRotated.contains(a)
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    var a = a
    var b = b
    var bRotated = ""
    
    for _ in 0..<b.count {
        bRotated = bRotated + String(b.characters.dropLast()) + String(b.characters.dropFirst())
    }
    
    return bRotated.contains(a)
}
```
var a = a // variable 'a' was never mutated; consider changing to 'let' constant
var b = b // variable 'b' was never mutated; consider changing to 'let' constant
bRotated = bRotated + String(b.characters.dropLast()) + String(b.characters.dropFirst()) // 'characters' is unavailable: Please use String directly
bRotated = bRotated + String(b.characters.dropLast()) + String(b.characters.dropFirst()) // 'characters' is unavailable: Please use String directly

func cycpatternCheck(a: String, b: String) -> Bool {
    var a = a.characters.map { String($0) }
    var b = b.characters.map { String($0) }
    
    for i in 0..<b.count {
        if a.contains(b[i..<b.count]) {
            return true
        }
    }
    
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    var a = a.characters.map { String($0) }
    var b = b.characters.map { String($0) }
    
    for i in 0..<b.count {
        if a.contains(b[i..<b.count]) {
            return true
        }
    }
    
    return false
}
```
var a = a.characters.map { String($0) } // 'characters' is unavailable: Please use String directly
var a = a.characters.map { String($0) } // variable 'a' was never mutated; consider changing to 'let' constant
var b = b.characters.map { String($0) } // 'characters' is unavailable: Please use String directly
var b = b.characters.map { String($0) } // variable 'b' was never mutated; consider changing to 'let' constant

func cycpatternCheck(a: String, b: String) -> Bool {
    let aLen = a.characters.count
    let bLen = b.characters.count
    if aLen < bLen {
        return false
    }
    for i in 0..<bLen {
        if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: NSMakeRange(i, bLen))!= nil {
            return true
        }
    }
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    let aLen = a.characters.count
    let bLen = b.characters.count
    if aLen < bLen {
        return false
    }
    for i in 0..<bLen {
        if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: NSMakeRange(i, bLen))!= nil {
            return true
        }
    }
    return false
}
```
let aLen = a.characters.count // 'characters' is unavailable: Please use String directly
let bLen = b.characters.count // 'characters' is unavailable: Please use String directly
if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: NSMakeRange(i, bLen))!= nil { // use of '=' in a boolean context, did you mean '=='?
if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: NSMakeRange(i, bLen))!= nil { // value of type 'String' has no member 'rangeOfString'
if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: NSMakeRange(i, bLen))!= nil { // '=' must have consistent whitespace on both sides
if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: NSMakeRange(i, bLen))!= nil { // type 'NSStringCompareOptions' has no member 'CaseInsensitiveSearch'

func cycpatternCheck(a: String, b: String) -> Bool {
    var a = a.characters.map { String($0) }
    var b = b.characters.map { String($0) }
    
    for i in 0..<b.count {
        if a.contains(b[i...a.count]) {
            return true
        }
    }
    
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    var a = a.characters.map { String($0) }
    var b = b.characters.map { String($0) }
    
    for i in 0..<b.count {
        if a.contains(b[i...a.count]) {
            return true
        }
    }
    
    return false
}
```
var a = a.characters.map { String($0) } // 'characters' is unavailable: Please use String directly
var a = a.characters.map { String($0) } // variable 'a' was never mutated; consider changing to 'let' constant
var b = b.characters.map { String($0) } // 'characters' is unavailable: Please use String directly
var b = b.characters.map { String($0) } // variable 'b' was never mutated; consider changing to 'let' constant

func cycpatternCheck(a: String, b: String) -> Bool {
    // TODO: Implement me
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    // TODO: Implement me
    return false
}
```
 // XCTAssertTrue failed

func cycpatternCheck(a: String, b: String) -> Bool {
    // TODO: implement
    return false
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    // TODO: implement
    return false
}
```
 // XCTAssertTrue failed

func cycpatternCheck(a: String, b: String) -> Bool {
    var a = a
    var b = b
    var bRotated = ""
    var bRotatedLength = 0
    var bLength = b.length
    var aLength = a.length
    
    while bRotatedLength < bLength {
        bRotated = bRotated + String(a[aLength - bRotatedLength - 1])
        bRotatedLength = bRotated.length
    }
    
    return bRotated.rangeOfString(b)!= nil
}
```swift
// You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
// cycpatternCheck(a: "abcd", b: "abd") == false
// cycpatternCheck(a: "hello", b: "ell") == true
// cycpatternCheck(a: "whassup", b: "psus") == false
// cycpatternCheck(a: "abab", b: "baa") == true
// cycpatternCheck(a: "efef", b: "eeff") == false
// cycpatternCheck(a: "himenss", b: "simen") == true
func cycpatternCheck(a: String, b: String) -> Bool {
    var a = a
    var b = b
    var bRotated = ""
    var bRotatedLength = 0
    var bLength = b.length
    var aLength = a.length
    
    while bRotatedLength < bLength {
        bRotated = bRotated + String(a[aLength - bRotatedLength - 1])
        bRotatedLength = bRotated.length
    }
    
    return bRotated.rangeOfString(b)!= nil
}
```
var bLength = b.length // value of type 'String' has no member 'length'
var aLength = a.length // value of type 'String' has no member 'length'
bRotatedLength = bRotated.length // value of type 'String' has no member 'length'
return bRotated.rangeOfString(b)!= nil // '=' must have consistent whitespace on both sides
return bRotated.rangeOfString(b)!= nil // value of type 'String' has no member 'rangeOfString'
return bRotated.rangeOfString(b)!= nil // use of '=' in a boolean context, did you mean '=='?

func evenOddCount(num: Int) -> (Int, Int) {
    let digits = String(num).split(separator: "")
    var evenCount = 0
    var oddCount = 0
    for digit in digits {
        if digit.isOdd {
            oddCount += 1
        } else {
            evenCount += 1
        }
    }
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    let digits = String(num).split(separator: "")
    var evenCount = 0
    var oddCount = 0
    for digit in digits {
        if digit.isOdd {
            oddCount += 1
        } else {
            evenCount += 1
        }
    }
    return (evenCount, oddCount)
}
```
if digit.isOdd { // value of type 'String.SubSequence' (aka 'Substring') has no member 'isOdd'

func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    
    while num > 0 {
        if num % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num /= 10
    }
    
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    
    while num > 0 {
        if num % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num /= 10
    }
    
    return (evenCount, oddCount)
}
```
num /= 10 // left side of mutating operator isn't mutable: 'num' is a 'let' constant

func evenOddCount(num: Int) -> (Int, Int) {
    let digits = String(num).split(separator: "")
    var evenCount = 0
    var oddCount = 0
    for digit in digits {
        if digit.isOdd {
            oddCount += 1
        } else {
            evenCount += 1
        }
    }
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    let digits = String(num).split(separator: "")
    var evenCount = 0
    var oddCount = 0
    for digit in digits {
        if digit.isOdd {
            oddCount += 1
        } else {
            evenCount += 1
        }
    }
    return (evenCount, oddCount)
}
```
if digit.isOdd { // value of type 'String.SubSequence' (aka 'Substring') has no member 'isOdd'

func evenOddCount(num: Int) -> (Int, Int) {
    let countEven = num.divide(num, remainder: &num)
    let countOdd = num.divide(num, remainder: &num)
    return (countEven, countOdd)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    let countEven = num.divide(num, remainder: &num)
    let countOdd = num.divide(num, remainder: &num)
    return (countEven, countOdd)
}
```
let countEven = num.divide(num, remainder: &num) // value of type 'Int' has no member 'divide'
let countEven = num.divide(num, remainder: &num) // cannot pass immutable value as inout argument: 'num' is a 'let' constant
let countOdd = num.divide(num, remainder: &num) // value of type 'Int' has no member 'divide'
let countOdd = num.divide(num, remainder: &num) // cannot pass immutable value as inout argument: 'num' is a 'let' constant

func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    
    while num!= 0 {
        if num % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num = num / 10
    }
    
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    
    while num!= 0 {
        if num % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num = num / 10
    }
    
    return (evenCount, oddCount)
}
```
while num!= 0 { // '=' must have consistent whitespace on both sides
while num!= 0 { // cannot force unwrap value of non-optional type 'Int'
while num!= 0 { // use of '=' in a boolean context, did you mean '=='?
num = num / 10 // cannot assign to value: 'num' is a 'let' constant

func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    
    while num > 0 {
        if num % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num /= 10
    }
    
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    
    while num > 0 {
        if num % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num /= 10
    }
    
    return (evenCount, oddCount)
}
```
num /= 10 // left side of mutating operator isn't mutable: 'num' is a 'let' constant

func evenOddCount(num: Int) -> (Int, Int) {
    let digits = String(num).characters.map { Int($0) }
    var even = 0, odd = 0
    for digit in digits {
        if digit % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
    }
    return (even, odd)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    let digits = String(num).characters.map { Int($0) }
    var even = 0, odd = 0
    for digit in digits {
        if digit % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
    }
    return (even, odd)
}
```
let digits = String(num).characters.map { Int($0) } // no exact matches in call to initializer

func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    
    var numString = String(num)
    
    for i in 0..<numString.characters.count {
        if numString[i] % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    
    var numString = String(num)
    
    for i in 0..<numString.characters.count {
        if numString[i] % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    
    return (evenCount, oddCount)
}
```
for i in 0..<numString.characters.count { // 'characters' is unavailable: Please use String directly
if numString[i] % 2 == 0 { // cannot convert value of type 'Character' to expected argument type 'Int'

func evenOddCount(num: Int) -> (Int, Int) {
    let str = String(num)
    var evenCount = 0
    var oddCount = 0
    for i in 0..<str.characters.count {
        if str[i] % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    let str = String(num)
    var evenCount = 0
    var oddCount = 0
    for i in 0..<str.characters.count {
        if str[i] % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    return (evenCount, oddCount)
}
```
for i in 0..<str.characters.count { // 'characters' is unavailable: Please use String directly
if str[i] % 2 == 0 { // cannot convert value of type 'Character' to expected argument type 'Int'

func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    
    var numStr = String(num)
    
    for i in 0..<numStr.count {
        if numStr[i] % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    
    return (evenCount, oddCount)
}
```swift
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
// evenOddCount(num: -12) == (1, 1)
// evenOddCount(num: 123) == (1, 2)
func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    
    var numStr = String(num)
    
    for i in 0..<numStr.count {
        if numStr[i] % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    
    return (evenCount, oddCount)
}
```
if numStr[i] % 2 == 0 { // cannot convert value of type 'Character' to expected argument type 'Int'

func intToMiniRoman(number: Int) -> String {
    // TODO: Implement me!
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func intToMiniRoman(number: Int) -> String {
    // TODO: Implement this function
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'String'

func intToMiniRoman(number: Int) -> String {
    var roman = ""
    var i = number
    var prev = 0
    var curr = 0
    var next = 0
    var digit = 0
    var romanDigit = ""
    var romanDigits = [String]()
    var romanDigitsMap = [Int: String]()
    romanDigitsMap[1] = "i"
    romanDigitsMap[5] = "v"
    romanDigitsMap[10] = "x"
    romanDigitsMap[50] = "l"
    romanDigitsMap[100] = "c"
    romanDigitsMap[500] = "d"
    romanDigitsMap[1000] = "m"
    while i > 0 {
        digit = i % 10
        if digit == 4 {
            romanDigit = romanDigitsMap[4]
        } else if digit == 9 {
            romanDigit = romanDigitsMap[9]
        } else if digit == 5 {
            romanDigit = romanDigitsMap[5]
        } else if digit == 6 {
            romanDigit = romanDigitsMap[6]
        } else if digit == 7 {
            romanDigit = romanDigitsMap[7]
        } else if digit == 8 {
            romanDigit = romanDigitsMap[8]
        } else if digit == 0 {
            romanDigit = ""
        } else {
            romanDigit = romanDigitsMap[digit]
        }
        romanDigits.append(romanDigit)
        i = i / 10
    }
    for i in romanDigits.reverse() {
        roman = roman + i
    }
    return roman
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    var roman = ""
    var i = number
    var prev = 0
    var curr = 0
    var next = 0
    var digit = 0
    var romanDigit = ""
    var romanDigits = [String]()
    var romanDigitsMap = [Int: String]()
    romanDigitsMap[1] = "i"
    romanDigitsMap[5] = "v"
    romanDigitsMap[10] = "x"
    romanDigitsMap[50] = "l"
    romanDigitsMap[100] = "c"
    romanDigitsMap[500] = "d"
    romanDigitsMap[1000] = "m"
    while i > 0 {
        digit = i % 10
        if digit == 4 {
            romanDigit = romanDigitsMap[4]
        } else if digit == 9 {
            romanDigit = romanDigitsMap[9]
        } else if digit == 5 {
            romanDigit = romanDigitsMap[5]
        } else if digit == 6 {
            romanDigit = romanDigitsMap[6]
        } else if digit == 7 {
            romanDigit = romanDigitsMap[7]
        } else if digit == 8 {
            romanDigit = romanDigitsMap[8]
        } else if digit == 0 {
            romanDigit = ""
        } else {
            romanDigit = romanDigitsMap[digit]
        }
        romanDigits.append(romanDigit)
        i = i / 10
    }
    for i in romanDigits.reverse() {
        roman = roman + i
    }
    return roman
}
```
romanDigit = romanDigitsMap[4] // value of optional type 'String?' must be unwrapped to a value of type 'String'
romanDigit = romanDigitsMap[9] // value of optional type 'String?' must be unwrapped to a value of type 'String'
romanDigit = romanDigitsMap[5] // value of optional type 'String?' must be unwrapped to a value of type 'String'
romanDigit = romanDigitsMap[6] // value of optional type 'String?' must be unwrapped to a value of type 'String'
romanDigit = romanDigitsMap[7] // value of optional type 'String?' must be unwrapped to a value of type 'String'
romanDigit = romanDigitsMap[8] // value of optional type 'String?' must be unwrapped to a value of type 'String'
romanDigit = romanDigitsMap[digit] // value of optional type 'String?' must be unwrapped to a value of type 'String'
for i in romanDigits.reverse() { // for-in loop requires '()' to conform to 'Sequence'

func intToMiniRoman(number: Int) -> String {
    // TODO: Implement me!
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func intToMiniRoman(number: Int) -> String {
    var result = ""
    var remainder = number
    var lastDigit = 0
    var lastValue = 0
    var value = 0
    var digit = 0
    
    while remainder > 0 {
        digit = remainder % 10
        remainder = remainder / 10
        value = digit * (1 + lastDigit)
        if value == lastValue {
            result.append(".")
        }
        result.append(String(romanDigits[digit]))
        lastDigit = digit
        lastValue = value
    }
    
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    var result = ""
    var remainder = number
    var lastDigit = 0
    var lastValue = 0
    var value = 0
    var digit = 0
    
    while remainder > 0 {
        digit = remainder % 10
        remainder = remainder / 10
        value = digit * (1 + lastDigit)
        if value == lastValue {
            result.append(".")
        }
        result.append(String(romanDigits[digit]))
        lastDigit = digit
        lastValue = value
    }
    
    return result
}
```
result.append(String(romanDigits[digit])) // cannot find 'romanDigits' in scope

func intToMiniRoman(number: Int) -> String {
    let roman = [
        "M": 1000,
        "CM": 900,
        "D": 500,
        "CD": 400,
        "C": 100,
        "XC": 90,
        "L": 50,
        "XL": 40,
        "X": 10,
        "IX": 9,
        "V": 5,
        "IV": 4,
        "I": 1
    ]
    var result = ""
    var remainder = number
    for (key, value) in roman {
        while remainder >= value {
            result += key
            remainder -= value
        }
    }
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    let roman = [
        "M": 1000,
        "CM": 900,
        "D": 500,
        "CD": 400,
        "C": 100,
        "XC": 90,
        "L": 50,
        "XL": 40,
        "X": 10,
        "IX": 9,
        "V": 5,
        "IV": 4,
        "I": 1
    ]
    var result = ""
    var remainder = number
    for (key, value) in roman {
        while remainder >= value {
            result += key
            remainder -= value
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func intToMiniRoman(number: Int) -> String {
    var result = ""
    var num = number
    var i = 0
    var roman = ["I", "V", "X", "L", "C", "D", "M"]
    var romanValue = [1, 5, 10, 50, 100, 500, 1000]
    var romanIndex = [0, 1, 2, 3, 4, 5, 6]
    
    while num > 0 {
        if num >= romanValue[romanIndex[i]] {
            num -= romanValue[romanIndex[i]]
            result += roman[romanIndex[i]]
        } else {
            i += 1
        }
    }
    
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    var result = ""
    var num = number
    var i = 0
    var roman = ["I", "V", "X", "L", "C", "D", "M"]
    var romanValue = [1, 5, 10, 50, 100, 500, 1000]
    var romanIndex = [0, 1, 2, 3, 4, 5, 6]
    
    while num > 0 {
        if num >= romanValue[romanIndex[i]] {
            num -= romanValue[romanIndex[i]]
            result += roman[romanIndex[i]]
        } else {
            i += 1
        }
    }
    
    return result
}
```
var roman = ["I", "V", "X", "L", "C", "D", "M"] // variable 'roman' was never mutated; consider changing to 'let' constant
var romanValue = [1, 5, 10, 50, 100, 500, 1000] // variable 'romanValue' was never mutated; consider changing to 'let' constant
var romanIndex = [0, 1, 2, 3, 4, 5, 6] // variable 'romanIndex' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func intToMiniRoman(number: Int) -> String {
    var result = ""
    var num = number
    
    // 1. Convert the number to a string
    var numString = String(num)
    
    // 2. Loop through the string and add the roman numeral to the result
    for i in 0..<numString.characters.count {
        
        // 2.1 Get the current character
        var currentChar = numString[i]
        
        // 2.2 Get the next character
        var nextChar = ""
        if i < numString.characters.count - 1 {
            nextChar = numString[i + 1]
        }
        
        // 2.3 Get the current roman numeral
        var currentRomanNumeral = ""
        switch currentChar {
        case "1":
            currentRomanNumeral = "i"
        case "2":
            currentRomanNumeral = "ii"
        case "3":
            currentRomanNumeral = "iii"
        case "4":
            currentRomanNumeral = "iv"
        case "5":
            currentRomanNumeral = "v"
        case "6":
            currentRomanNumeral = "vi"
        case "7":
            currentRomanNumeral = "vii"
        case "8":
            currentRomanNumeral = "viii"
        case "9":
            currentRomanNumeral = "ix"
        default:
            break
        }
        
        // 2.4 Get the next roman numeral
        var nextRomanNumeral = ""
        switch nextChar {
        case "1":
            nextRomanNumeral = "i"
        case "2":
            nextRomanNumeral = "ii"
        case "3":
            nextRomanNumeral = "iii"
        case "4":
            nextRomanNumeral = "iv"
        case "5":
            nextRomanNumeral = "v"
        case "6":
            nextRomanNumeral = "vi"
        case "7":
            nextRomanNumeral = "vii"
        case "8":
            nextRomanNumeral = "viii"
        case "9":
            nextRomanNumeral = "ix"
        default:
            break
        }
        
        // 2.5 If the current roman numeral is greater than the next roman numeral,
        // subtract the current roman numeral from the next roman numeral
        if currentRomanNumeral > nextRomanNumeral {
            result += nextRomanNumeral
            numString.removeRange(start: i + 1, length: 1)
        } else {
            result += currentRomanNumeral
        }
    }
    
    return result
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    var result = ""
    var num = number
    
    // 1. Convert the number to a string
    var numString = String(num)
    
    // 2. Loop through the string and add the roman numeral to the result
    for i in 0..<numString.characters.count {
        
        // 2.1 Get the current character
        var currentChar = numString[i]
        
        // 2.2 Get the next character
        var nextChar = ""
        if i < numString.characters.count - 1 {
            nextChar = numString[i + 1]
        }
        
        // 2.3 Get the current roman numeral
        var currentRomanNumeral = ""
        switch currentChar {
        case "1":
            currentRomanNumeral = "i"
        case "2":
            currentRomanNumeral = "ii"
        case "3":
            currentRomanNumeral = "iii"
        case "4":
            currentRomanNumeral = "iv"
        case "5":
            currentRomanNumeral = "v"
        case "6":
            currentRomanNumeral = "vi"
        case "7":
            currentRomanNumeral = "vii"
        case "8":
            currentRomanNumeral = "viii"
        case "9":
            currentRomanNumeral = "ix"
        default:
            break
        }
        
        // 2.4 Get the next roman numeral
        var nextRomanNumeral = ""
        switch nextChar {
        case "1":
            nextRomanNumeral = "i"
        case "2":
            nextRomanNumeral = "ii"
        case "3":
            nextRomanNumeral = "iii"
        case "4":
            nextRomanNumeral = "iv"
        case "5":
            nextRomanNumeral = "v"
        case "6":
            nextRomanNumeral = "vi"
        case "7":
            nextRomanNumeral = "vii"
        case "8":
            nextRomanNumeral = "viii"
        case "9":
            nextRomanNumeral = "ix"
        default:
            break
        }
        
        // 2.5 If the current roman numeral is greater than the next roman numeral,
        // subtract the current roman numeral from the next roman numeral
        if currentRomanNumeral > nextRomanNumeral {
            result += nextRomanNumeral
            numString.removeRange(start: i + 1, length: 1)
        } else {
            result += currentRomanNumeral
        }
    }
    
    return result
}
```
for i in 0..<numString.characters.count { // 'characters' is unavailable: Please use String directly
var currentChar = numString[i] // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if i < numString.characters.count - 1 { // 'characters' is unavailable: Please use String directly
nextChar = numString[i + 1] // cannot assign value of type 'Character' to type 'String'
numString.removeRange(start: i + 1, length: 1) // value of type 'String' has no member 'removeRange'

```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    var roman = ""
    var num = number
    var i = 0
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums = [Int]()
    var romans = [String]()
    var romanNums = [String]()
    var romanNum = ""
    var nums
XCTAssertTrue(intToMiniRoman(number: 19) == "xix") // cannot find 'intToMiniRoman' in scope
XCTAssertTrue(intToMiniRoman(number: 152) == "clii") // cannot find 'intToMiniRoman' in scope
XCTAssertTrue(intToMiniRoman(number: 251) == "ccli") // cannot find 'intToMiniRoman' in scope
XCTAssertTrue(intToMiniRoman(number: 426) == "cdxxvi") // cannot find 'intToMiniRoman' in scope
XCTAssertTrue(intToMiniRoman(number: 500) == "d") // cannot find 'intToMiniRoman' in scope
XCTAssertTrue(intToMiniRoman(number: 1) == "i") // cannot find 'intToMiniRoman' in scope
XCTAssertTrue(intToMiniRoman(number: 4) == "iv") // cannot find 'intToMiniRoman' in scope
XCTAssertTrue(intToMiniRoman(number: 43) == "xliii") // cannot find 'intToMiniRoman' in scope
XCTAssertTrue(intToMiniRoman(number: 90) == "xc") // cannot find 'intToMiniRoman' in scope
XCTAssertTrue(intToMiniRoman(number: 94) == "xciv") // cannot find 'intToMiniRoman' in scope
XCTAssertTrue(intToMiniRoman(number: 532) == "dxxxii") // cannot find 'intToMiniRoman' in scope
XCTAssertTrue(intToMiniRoman(number: 900) == "cm") // cannot find 'intToMiniRoman' in scope
XCTAssertTrue(intToMiniRoman(number: 994) == "cmxciv") // cannot find 'intToMiniRoman' in scope
XCTAssertTrue(intToMiniRoman(number: 1000) == "m") // cannot find 'intToMiniRoman' in scope

func intToMiniRoman(number: Int) -> String {
    var roman = ""
    var i = number
    var last = 0
    var current = 0
    var diff = 0
    while i > 0 {
        last = current
        current = i % 10
        diff = current - last
        if diff == 1 {
            roman = String(roman.characters.count + 1,
                           UnicodeScalar(roman.characters.last)!.value + 1) + roman
        } else if diff == -1 {
            roman = String(roman.characters.count + 1,
                           UnicodeScalar(roman.characters.last)!.value - 1) + roman
        } else if diff == 0 {
            roman = String(roman.characters.count + 1,
                           UnicodeScalar(roman.characters.last)!.value) + roman
        }
        i = i / 10
    }
    return roman
}
```swift
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
// intToMiniRoman(number: 19) == "xix"
// intToMiniRoman(number: 152) == "clii"
// intToMiniRoman(number: 426) == "cdxxvi"
func intToMiniRoman(number: Int) -> String {
    var roman = ""
    var i = number
    var last = 0
    var current = 0
    var diff = 0
    while i > 0 {
        last = current
        current = i % 10
        diff = current - last
        if diff == 1 {
            roman = String(roman.characters.count + 1,
                           UnicodeScalar(roman.characters.last)!.value + 1) + roman
        } else if diff == -1 {
            roman = String(roman.characters.count + 1,
                           UnicodeScalar(roman.characters.last)!.value - 1) + roman
        } else if diff == 0 {
            roman = String(roman.characters.count + 1,
                           UnicodeScalar(roman.characters.last)!.value) + roman
        }
        i = i / 10
    }
    return roman
}
```

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    // TODO: Implement this function
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Bool'

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    // TODO: Implement me!
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'Bool'

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a * a + b * b == c * c
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a * a + b * b == c * c
}
```
 // XCTAssertTrue failed

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a*a + b*b == c*c
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a*a + b*b == c*c
}
```
 // XCTAssertTrue failed

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    // Your implementation goes here
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    // Your implementation goes here
}
```
} // missing return in global function expected to return 'Bool'

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a*a + b*b == c*c
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a*a + b*b == c*c
}
```
 // XCTAssertTrue failed

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a * a + b * b == c * c
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a * a + b * b == c * c
}
```
 // XCTAssertTrue failed

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a*a + b*b == c*c
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a*a + b*b == c*c
}
```
 // XCTAssertTrue failed

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a * a + b * b == c * c
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a * a + b * b == c * c
}
```
 // XCTAssertTrue failed

func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a * a + b * b == c * c
}
```swift
// Given the lengths of the three sides of a triangle. Return true if the three
// sides form a right-angled triangle, false otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or 
// 90 degree.
// Example:
// rightAngleTriangle(a: 3, b: 4, c: 5) == true
// rightAngleTriangle(a: 1, b: 2, c: 3) == false
func rightAngleTriangle(a: Int, b: Int, c: Int) -> Bool {
    return a * a + b * b == c * c
}
```
 // XCTAssertTrue failed

func findMax(words: [String]) -> String {
    // TODO: Implement me!
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func findMax(words: [String]) -> String {
    // TODO: Implement me!
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func findMax(words: [String]) -> String {
    // TODO: implement me
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'String'

func findMax(words: [String]) -> String {
    var max = ""
    var maxCount = 0
    for word in words {
        let count = word.characters.reduce(0) {
            if $0 > 1 {
                return $0
            }
            return $0 + 1
        }
        if count > maxCount {
            max = word
            maxCount = count
        }
    }
    return max
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    var max = ""
    var maxCount = 0
    for word in words {
        let count = word.characters.reduce(0) {
            if $0 > 1 {
                return $0
            }
            return $0 + 1
        }
        if count > maxCount {
            max = word
            maxCount = count
        }
    }
    return max
}
```
let count = word.characters.reduce(0) { // contextual closure type '(Int, String.Element) throws -> Int' (aka '(Int, Character) throws -> Int') expects 2 arguments, but 1 was used in closure body

func findMax(words: [String]) -> String {
    // TODO: Implement me!
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func findMax(words: [String]) -> String {
    var max = ""
    var maxCount = 0
    for word in words {
        var count = 0
        for char in word {
            if!word.contains(char) {
                count += 1
            }
        }
        if count > maxCount {
            max = word
            maxCount = count
        }
    }
    return max
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    var max = ""
    var maxCount = 0
    for word in words {
        var count = 0
        for char in word {
            if!word.contains(char) {
                count += 1
            }
        }
        if count > maxCount {
            max = word
            maxCount = count
        }
    }
    return max
}
```
if!word.contains(char) { // expected expression, var, or let in 'if' condition

func findMax(words: [String]) -> String {
    // TODO: Implement me!
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func findMax(words: [String]) -> String {
    // TODO: Implement me!
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func findMax(words: [String]) -> String {
    // TODO: Implement me!
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    // TODO: Implement me!
}
```
} // missing return in global function expected to return 'String'

func findMax(words: [String]) -> String {
    // TODO: implement me
}
```swift
// Write a function that accepts an array of strings.
// The array contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one which comes first in lexicographical order.
// findMax(words: ["name", "of", "string"]) == "string"
// findMax(words: ["name", "enam", "game"]) == "enam"
// findMax(words: ["aaaaaaa", "bb", "cc"]) == "aaaaaaa"
func findMax(words: [String]) -> String {
    // TODO: implement me
}
```
} // missing return in global function expected to return 'String'

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    // your code goes here
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    // your code goes here
}
```
} // missing return in global function expected to return '[Int]'

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    let eaten = number + need
    let left = remaining - eaten
    return [eaten, left]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    let eaten = number + need
    let left = remaining - eaten
    return [eaten, left]
}
```
 // XCTAssertTrue failed

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number + need
    var left = remaining - eaten
    return [eaten, left]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number + need
    var left = remaining - eaten
    return [eaten, left]
}
```
var eaten = number + need // variable 'eaten' was never mutated; consider changing to 'let' constant
var left = remaining - eaten // variable 'left' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    return [number + need, remaining - need]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    return [number + need, remaining - need]
}
```
 // XCTAssertTrue failed

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    return [number + need, remaining - need]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    return [number + need, remaining - need]
}
```
 // XCTAssertTrue failed

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number + need
    var left = remaining - eaten
    return [eaten, left]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number + need
    var left = remaining - eaten
    return [eaten, left]
}
```
var eaten = number + need // variable 'eaten' was never mutated; consider changing to 'let' constant
var left = remaining - eaten // variable 'left' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    return [number + need, remaining - need]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    return [number + need, remaining - need]
}
```
 // XCTAssertTrue failed

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    let eaten = number + need
    let left = remaining - eaten
    return [eaten, left]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    let eaten = number + need
    let left = remaining - eaten
    return [eaten, left]
}
```
 // XCTAssertTrue failed

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    return [number + need, remaining - need]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    return [number + need, remaining - need]
}
```
 // XCTAssertTrue failed

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number + need
    var left = remaining - eaten
    return [eaten, left]
}
```swift
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
// the number of carrots left after your meals ]
// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
// Example:
// Variables:
// @number : integer
// the number of carrots that you have eaten.
// @need : integer
// the number of carrots that you need to eat.
// @remaining : integer
// the number of remaining carrots thet exist in stock
// Constrain:
// * 0 <= number <= 1000
// * 0 <= need <= 1000
// * 0 <= remaining <= 1000
// Have fun :)
// eat(number: 5, need: 6, remaining: 10) == [11, 4]
// eat(number: 4, need: 8, remaining: 9) == [12, 1]
// eat(number: 1, need: 10, remaining: 10) == [11, 0]
// eat(number: 2, need: 11, remaining: 5) == [7, 0]
func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number + need
    var left = remaining - eaten
    return [eaten, left]
}
```
var eaten = number + need // variable 'eaten' was never mutated; consider changing to 'let' constant
var left = remaining - eaten // variable 'left' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 1..<operands.count {
        switch operators[i-1] {
        case "+":
            result += operands[i]
        case "-":
            result -= operands[i]
        case "*":
            result *= operands[i]
        case "//":
            result /= operands[i]
        case "**":
            result = result ** operands[i]
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 1..<operands.count {
        switch operators[i-1] {
        case "+":
            result += operands[i]
        case "-":
            result -= operands[i]
        case "*":
            result *= operands[i]
        case "//":
            result /= operands[i]
        case "**":
            result = result ** operands[i]
        default:
            break
        }
    }
    return result
}
```
result = result ** operands[i] // no operator '**' is defined; did you mean 'pow(_:_:)'?

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = 0
    for i in 0..<operators.count {
        if operators[i] == "+" {
            result += operands[i]
        } else if operators[i] == "-" {
            result -= operands[i]
        } else if operators[i] == "*" {
            result *= operands[i]
        } else if operators[i] == "//" {
            result /= operands[i]
        } else if operators[i] == "**" {
            result = pow(result, operands[i])
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = 0
    for i in 0..<operators.count {
        if operators[i] == "+" {
            result += operands[i]
        } else if operators[i] == "-" {
            result -= operands[i]
        } else if operators[i] == "*" {
            result *= operands[i]
        } else if operators[i] == "//" {
            result /= operands[i]
        } else if operators[i] == "**" {
            result = pow(result, operands[i])
        }
    }
    return result
}
```
result = pow(result, operands[i]) // cannot convert value of type 'Int' to expected argument type 'Decimal'
result = pow(result, operands[i]) // cannot assign value of type 'Decimal' to type 'Int'

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    let result = operators.reduce(0) { (sum, operator) -> Int in
        switch operator {
        case "+":
            return sum + operands.removeFirst()
        case "-":
            return sum - operands.removeFirst()
        case "*":
            return sum * operands.removeFirst()
        case "//":
            return sum // operands.removeFirst()
        case "**":
            return sum ** operands.removeFirst()
        default:
            return sum
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    let result = operators.reduce(0) { (sum, operator) -> Int in
        switch operator {
        case "+":
            return sum + operands.removeFirst()
        case "-":
            return sum - operands.removeFirst()
        case "*":
            return sum * operands.removeFirst()
        case "//":
            return sum // operands.removeFirst()
        case "**":
            return sum ** operands.removeFirst()
        default:
            return sum
        }
    }
    return result
}
```
switch operator { // expected expression in 'switch' statement
switch operator { // expected operator name in operator declaration

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = 0
    for (index, operator) in operators.enumerated() {
        let operand = operands[index + 1]
        switch operator {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "//":
            result /= operand
        case "**":
            result = pow(result, operand)
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = 0
    for (index, operator) in operators.enumerated() {
        let operand = operands[index + 1]
        switch operator {
        case "+":
            result += operand
        case "-":
            result -= operand
        case "*":
            result *= operand
        case "//":
            result /= operand
        case "**":
            result = pow(result, operand)
        default:
            break
        }
    }
    return result
}
```
for (index, operator) in operators.enumerated() { // expected '{' to start the body of for-each loop
for (index, operator) in operators.enumerated() { // expected 'in' after for-each pattern
for (index, operator) in operators.enumerated() { // expected Sequence expression for for-each loop
for (index, operator) in operators.enumerated() { // expected pattern
switch operator { // expected operator name in operator declaration
switch operator { // expected expression in 'switch' statement

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = 0
    for i in 0..<operators.count {
        switch operators[i] {
        case "+":
            result += operands[i]
        case "-":
            result -= operands[i]
        case "*":
            result *= operands[i]
        case "//":
            result /= operands[i]
        case "**":
            result = pow(result, operands[i])
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = 0
    for i in 0..<operators.count {
        switch operators[i] {
        case "+":
            result += operands[i]
        case "-":
            result -= operands[i]
        case "*":
            result *= operands[i]
        case "//":
            result /= operands[i]
        case "**":
            result = pow(result, operands[i])
        default:
            break
        }
    }
    return result
}
```
result = pow(result, operands[i]) // cannot convert value of type 'Int' to expected argument type 'Decimal'
result = pow(result, operands[i]) // cannot assign value of type 'Decimal' to type 'Int'

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = 0
    for i in 0..<operators.count {
        if operators[i] == "+" {
            result += operands[i]
        } else if operators[i] == "-" {
            result -= operands[i]
        } else if operators[i] == "*" {
            result *= operands[i]
        } else if operators[i] == "//" {
            result /= operands[i]
        } else if operators[i] == "**" {
            result = pow(result, operands[i])
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = 0
    for i in 0..<operators.count {
        if operators[i] == "+" {
            result += operands[i]
        } else if operators[i] == "-" {
            result -= operands[i]
        } else if operators[i] == "*" {
            result *= operands[i]
        } else if operators[i] == "//" {
            result /= operands[i]
        } else if operators[i] == "**" {
            result = pow(result, operands[i])
        }
    }
    return result
}
```
result = pow(result, operands[i]) // cannot convert value of type 'Int' to expected argument type 'Decimal'
result = pow(result, operands[i]) // cannot assign value of type 'Decimal' to type 'Int'

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = 0
    for i in 0..<operators.count {
        switch operators[i] {
        case "+":
            result += operands[i]
        case "-":
            result -= operands[i]
        case "*":
            result *= operands[i]
        case "//":
            result /= operands[i]
        case "**":
            result = pow(result, operands[i])
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = 0
    for i in 0..<operators.count {
        switch operators[i] {
        case "+":
            result += operands[i]
        case "-":
            result -= operands[i]
        case "*":
            result *= operands[i]
        case "//":
            result /= operands[i]
        case "**":
            result = pow(result, operands[i])
        default:
            break
        }
    }
    return result
}
```
result = pow(result, operands[i]) // cannot convert value of type 'Int' to expected argument type 'Decimal'
result = pow(result, operands[i]) // cannot assign value of type 'Decimal' to type 'Int'

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = 0
    for i in 0..<operators.count {
        switch operators[i] {
        case "+":
            result += operands[i]
        case "-":
            result -= operands[i]
        case "*":
            result *= operands[i]
        case "//":
            result = result // operands[i]
        case "**":
            result = result ** operands[i]
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = 0
    for i in 0..<operators.count {
        switch operators[i] {
        case "+":
            result += operands[i]
        case "-":
            result -= operands[i]
        case "*":
            result *= operands[i]
        case "//":
            result = result // operands[i]
        case "**":
            result = result ** operands[i]
        default:
            break
        }
    }
    return result
}
```
result = result // operands[i] // assigning a variable to itself
result = result ** operands[i] // no operator '**' is defined; did you mean 'pow(_:_:)'?

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 1..<operands.count {
        switch operators[i-1] {
        case "+":
            result += operands[i]
        case "-":
            result -= operands[i]
        case "*":
            result *= operands[i]
        case "//":
            result /= operands[i]
        case "**":
            result = result ** operands[i]
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 1..<operands.count {
        switch operators[i-1] {
        case "+":
            result += operands[i]
        case "-":
            result -= operands[i]
        case "*":
            result *= operands[i]
        case "//":
            result /= operands[i]
        case "**":
            result = result ** operands[i]
        default:
            break
        }
    }
    return result
}
```
result = result ** operands[i] // no operator '**' is defined; did you mean 'pow(_:_:)'?

func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        switch operators[i] {
        case "+":
            result += operands[i+1]
        case "-":
            result -= operands[i+1]
        case "*":
            result *= operands[i+1]
        case "//":
            result = result / operands[i+1]
        case "**":
            result = result ** operands[i+1]
        default:
            break
        }
    }
    return result
}
```swift
// Given two arrays operators, and operands. The first array has basic algebra operations, and 
// the second array is an array of integers. Use the two given arrays to build the algebric 
// expression and return the evaluation of this expression.
// The basic algebra operations:
// Addition ( + ) 
// Subtraction ( - ) 
// Multiplication ( * ) 
// Floor division ( // ) 
// Exponentiation ( ** ) 
// Example:
// operator['+', '*', '-']
// array = [2, 3, 4, 5]
// result = 2 + 3 * 4 - 5
// => result = 9
// Note:
// The length of operator array is equal to the length of operand array minus one.
// Operand is an array of of non-negative integers.
// Operator array has at least one operator, and operand array has at least two operands.
func doAlgebra(operators: [String], operands: [Int]) -> Int {
    var result = operands[0]
    for i in 0..<operators.count {
        switch operators[i] {
        case "+":
            result += operands[i+1]
        case "-":
            result -= operands[i+1]
        case "*":
            result *= operands[i+1]
        case "//":
            result = result / operands[i+1]
        case "**":
            result = result ** operands[i+1]
        default:
            break
        }
    }
    return result
}
```
result = result ** operands[i+1] // no operator '**' is defined; did you mean 'pow(_:_:)'?

func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased))
            } else {
                result.append(String(c.lowercased))
            }
        } else {
            result.append(c)
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased))
            } else {
                result.append(String(c.lowercased))
            }
        } else {
            result.append(c)
        }
    }
    return result
}
```
result.append(String(c.uppercased)) // no exact matches in call to initializer
result.append(String(c.lowercased)) // no exact matches in call to initializer

func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased))
            } else {
                result.append(String(c.lowercased))
            }
        } else {
            result.append(c)
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased))
            } else {
                result.append(String(c.lowercased))
            }
        } else {
            result.append(c)
        }
    }
    return result
}
```
result.append(String(c.uppercased)) // no exact matches in call to initializer
result.append(String(c.lowercased)) // no exact matches in call to initializer

func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(c)
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(c)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased))
            } else {
                result.append(String(c.lowercased))
            }
        } else {
            result.append(String(c))
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased))
            } else {
                result.append(String(c.lowercased))
            }
        } else {
            result.append(String(c))
        }
    }
    return result
}
```
result.append(String(c.uppercased)) // no exact matches in call to initializer
result.append(String(c.lowercased)) // no exact matches in call to initializer

func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(String(c))
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(String(c))
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(String(c))
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(String(c))
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(c)
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(c)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(String(c))
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(String(c))
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(c)
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(c)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(String(c))
        }
    }
    return result
}
```swift
// You are given a string s.
// if s[i] is a letter, reverse its case from lower to upper or vise versa, 
// otherwise keep it as it is.
// If the string contains no letters, reverse the string.
// The function should return the resulted string.
// Examples
// solve(s: "1234") == "4321"
// solve(s: "ab") == "AB"
// solve(s: "#a@C") == "#A@c"
func solve(s: String) -> String {
    var result = ""
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(String(c))
        }
    }
    return result
}
```
 // XCTAssertTrue failed

import CommonCrypto

func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.stringValue
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.stringValue
}
```
let md5 = text.md5() // value of type 'String' has no member 'md5'

import CommonCrypto

func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.stringValue
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.stringValue
}
```
let md5 = text.md5() // value of type 'String' has no member 'md5'

import CommonCrypto

func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.stringValue
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.stringValue
}
```
let md5 = text.md5() // value of type 'String' has no member 'md5'

import CommonCrypto

func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.stringValue
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.stringValue
}
```
let md5 = text.md5() // value of type 'String' has no member 'md5'

import CommonCrypto

func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5
    return md5.stringValue
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5
    return md5.stringValue
}
```
let md5 = text.md5 // value of type 'String' has no member 'md5'

import CommonCrypto

func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5
    return md5.stringValue
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5
    return md5.stringValue
}
```
let md5 = text.md5 // value of type 'String' has no member 'md5'

import CommonCrypto

func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5
    return md5.stringValue
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5
    return md5.stringValue
}
```
let md5 = text.md5 // value of type 'String' has no member 'md5'

import CommonCrypto

func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.hexString
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.hexString
}
```
let md5 = text.md5() // value of type 'String' has no member 'md5'

import CommonCrypto

func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.stringValue
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.stringValue
}
```
let md5 = text.md5() // value of type 'String' has no member 'md5'

import CommonCrypto

func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.stringValue
}
```swift
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return nil.
// stringToMd5(text: "Hello world") == "3e25960a79dbc69b674cd4ec67a72c62"
func stringToMd5(text: String) -> String? {
    if text.isEmpty {
        return nil
    }
    let md5 = text.md5()
    return md5.stringValue
}
```
let md5 = text.md5() // value of type 'String' has no member 'md5'

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    var current: Int = a
    while current <= b {
        if current % 2 == 0 {
            result.append(current)
        }
        current += 1
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    var current: Int = a
    while current <= b {
        if current % 2 == 0 {
            result.append(current)
        }
        current += 1
    }
    return result
}
```
 // XCTAssertTrue failed

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    var i = a
    while i <= b {
        if i % 2 == 0 {
            result.append(i)
        }
        i += 1
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    var i = a
    while i <= b {
        if i % 2 == 0 {
            result.append(i)
        }
        i += 1
    }
    return result
}
```
 // XCTAssertTrue failed

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    var i = a
    while i <= b {
        if i % 2 == 0 {
            result.append(i)
        }
        i += 1
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    var i = a
    while i <= b {
        if i % 2 == 0 {
            result.append(i)
        }
        i += 1
    }
    return result
}
```
 // XCTAssertTrue failed

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    if a > b {
        return result
    }
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    if a > b {
        return result
    }
    for i in a...b {
        if i % 2 == 0 {
            result.append(i)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    var i = a
    while i <= b {
        if i % 2 == 0 {
            result.append(i)
        }
        i += 1
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result = [Int]()
    var i = a
    while i <= b {
        if i % 2 == 0 {
            result.append(i)
        }
        i += 1
    }
    return result
}
```
 // XCTAssertTrue failed

func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    var current = a
    while current <= b {
        if current % 2 == 0 {
            result.append(current)
        }
        current += 1
    }
    return result
}
```swift
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
// generateIntegers(a: 2, b: 8) == [2, 4, 6, 8]
// generateIntegers(a: 8, b: 2) == [2, 4, 6, 8]
// generateIntegers(a: 10, b: 14) == [] as [Int]
func generateIntegers(a: Int, b: Int) -> [Int] {
    var result: [Int] = []
    var current = a
    while current <= b {
        if current % 2 == 0 {
            result.append(current)
        }
        current += 1
    }
    return result
}
```
 // XCTAssertTrue failed