Metadata

Key Value
engine modal
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 { // 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 '=='?
if i!= j && abs(numbers[i] - numbers[j]) < threshold { // '=' must have consistent whitespace on both sides

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 {
            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 {
            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 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]()
    
    for c in parenString.characters {
        if c == "(" {
            parenStack.append(String(c))
        } else if c == ")" {
            var parenGroup = ""
            while parenStack.count > 0 {
                parenGroup.append(parenStack.removeLast())
                if parenGroup.count % 2 == 0 {
                    break
                }
            }
            result.append(parenGroup)
        }
    }
    
    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 c in parenString.characters {
        if c == "(" {
            parenStack.append(String(c))
        } else if c == ")" {
            var parenGroup = ""
            while parenStack.count > 0 {
                parenGroup.append(parenStack.removeLast())
                if parenGroup.count % 2 == 0 {
                    break
                }
            }
            result.append(parenGroup)
        }
    }
    
    return result
}
```
for c in parenString.characters { // 'characters' is unavailable: Please use String directly

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

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 {
        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-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 parseNestedParens(parenString: String) -> [Int] {
    var parenStack = [Int]()
    var parenLevels = [Int]()
    var parenIndex = 0
    
    for char in parenString {
        switch char {
        case "(":
            parenStack.append(parenIndex)
        case ")":
            if parenStack.isEmpty {
                fatalError("Unbalanced parentheses")
            }
            let openParenIndex = parenStack.removeLast()
            parenLevels.append(parenIndex - openParenIndex)
        default:
            fatalError("Invalid character")
        }
        parenIndex += 1
    }
    
    if!parenStack.isEmpty {
        fatalError("Unbalanced parentheses")
    }
    
    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]()
    var parenIndex = 0
    
    for char in parenString {
        switch char {
        case "(":
            parenStack.append(parenIndex)
        case ")":
            if parenStack.isEmpty {
                fatalError("Unbalanced parentheses")
            }
            let openParenIndex = parenStack.removeLast()
            parenLevels.append(parenIndex - openParenIndex)
        default:
            fatalError("Invalid character")
        }
        parenIndex += 1
    }
    
    if!parenStack.isEmpty {
        fatalError("Unbalanced parentheses")
    }
    
    return parenLevels
}
```
if!parenStack.isEmpty { // expected expression, var, or let in 'if' condition

func parseNestedParens(parenString: String) -> [Int] {
    var parenStack = [Int]()
    var parenLevels = [Int]()
    for paren in parenString.split(" ") {
        if paren.hasPrefix("(") {
            parenStack.append(parenLevels.count)
        } else {
            let 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 parenLevels = [Int]()
    for paren in parenString.split(" ") {
        if paren.hasPrefix("(") {
            parenStack.append(parenLevels.count)
        } else {
            let 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 parenStack = [Int]()
    var parenLevels = [Int]()
    for paren in parenString.characters.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevels.count)
        } else if paren == ")" {
            let lastParenLevel = parenStack.removeLast()
            parenLevels.append(lastParenLevel)
        }
    }
    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.characters.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevels.count)
        } else if paren == ")" {
            let lastParenLevel = parenStack.removeLast()
            parenLevels.append(lastParenLevel)
        }
    }
    return parenLevels
}
```
for paren in parenString.characters.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
            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 char in parenString.characters {
        switch char {
        case "(":
            parenStack.append(1)
        case ")":
            parenStack.removeLast()
        default:
            continue
        }
        if parenStack.isEmpty {
            continue
        }
        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 {
            continue
        }
        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 parenLevels = [Int]()
    for paren in parenString.split(whitespace: true) {
        switch paren {
        case "(":
            parenStack.append(parenLevels.count)
        case ")":
            if parenStack.isEmpty {
                fatalError("Unbalanced parentheses")
            }
            let lastParenLevel = parenStack.removeLast()
            parenLevels.append(parenLevels.count - lastParenLevel)
        default:
            fatalError("Invalid parentheses")
        }
    }
    if!parenStack.isEmpty {
        fatalError("Unbalanced parentheses")
    }
    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(whitespace: true) {
        switch paren {
        case "(":
            parenStack.append(parenLevels.count)
        case ")":
            if parenStack.isEmpty {
                fatalError("Unbalanced parentheses")
            }
            let lastParenLevel = parenStack.removeLast()
            parenLevels.append(parenLevels.count - lastParenLevel)
        default:
            fatalError("Invalid parentheses")
        }
    }
    if!parenStack.isEmpty {
        fatalError("Unbalanced parentheses")
    }
    return parenLevels
}
```
for paren in parenString.split(whitespace: true) { // no exact matches in call to instance method 'split'
if!parenStack.isEmpty { // expected expression, var, or let in 'if' condition

func parseNestedParens(parenString: String) -> [Int] {
    var parenStack = [Int]()
    var parenLevels = [Int]()
    var parenLevel = 0
    for paren in parenString.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            parenLevels.append(parenLevel)
            parenStack.removeLast()
        }
    }
    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]()
    var parenLevel = 0
    for paren in parenString.split(" ") {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            parenLevels.append(parenLevel)
            parenStack.removeLast()
        }
    }
    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(" ") {
        switch paren {
        case "":
            break
        case "(":
            parenStack.append(0)
        case ")":
            parenStack.removeLast()
        default:
            parenStack.append(paren.toInt()!)
        }
        if parenStack.count == 0 {
            result.append(parenStack.last!)
        }
    }
    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(" ") {
        switch paren {
        case "":
            break
        case "(":
            parenStack.append(0)
        case ")":
            parenStack.removeLast()
        default:
            parenStack.append(paren.toInt()!)
        }
        if parenStack.count == 0 {
            result.append(parenStack.last!)
        }
    }
    return result
}
```
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(" ").map(String.init) {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            parenStack.removeLast()
        }
        
        if parenLevel > parenStack.maxElement() {
            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(" ").map(String.init) {
        if paren == "(" {
            parenStack.append(parenLevel)
            parenLevel += 1
        } else if paren == ")" {
            parenLevel -= 1
            parenStack.removeLast()
        }
        
        if parenLevel > parenStack.maxElement() {
            parenLevels.append(parenLevel)
        }
    }
    
    return parenLevels
}
```
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 parenLevel: Int = 0
    var parenLevels: [Int] = []
    for char in parenString.characters {
        switch char {
        case "(":
            parenStack.append(parenLevel)
            parenLevel += 1
        case ")":
            parenLevel -= 1
            if parenStack.count > 0 {
                parenLevel = parenStack.removeLast()
            }
        default:
            break
        }
        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 char in parenString.characters {
        switch char {
        case "(":
            parenStack.append(parenLevel)
            parenLevel += 1
        case ")":
            parenLevel -= 1
            if parenStack.count > 0 {
                parenLevel = parenStack.removeLast()
            }
        default:
            break
        }
        parenLevels.append(parenLevel)
    }
    return parenLevels
}
```
for char in parenString.characters { // 'characters' is unavailable: Please use String directly

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.contains(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.contains(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```

func filterBySubstring(strings: [String], substring: String) -> [String] {
    var filteredStrings = [] as [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 = [] as [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 = [] as [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 = [] as [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.contains(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.contains(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```

func filterBySubstring(strings: [String], substring: String) -> [String] {
    var filteredStrings = [String]()
    for string in strings {
        if string.contains(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.contains(substring) {
            filteredStrings.append(string)
        }
    }
    return filteredStrings
}
```

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: Int = 0
    var product: Int = 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: Int = 0
    var product: Int = 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 result = [Int]()
    var max = 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 = 0
    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 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 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 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 = 0
    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 result = [Int]()
    var max = 0
    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 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 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 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 makePalindrome(string: String) -> String {
    // Find the longest postfix of supplied string that is a palindrome.
    let palindrome = string.reversed().prefix(while: { $0 == $0.lowercased() })
    // Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
    return string + String(palindrome.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.
    let palindrome = string.reversed().prefix(while: { $0 == $0.lowercased() })
    // Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
    return string + String(palindrome.reversed())
}
```
let palindrome = string.reversed().prefix(while: { $0 == $0.lowercased() }) // binary operator '==' cannot be applied to operands of type 'String.Element' (aka 'Character') and 'String'

func makePalindrome(string: String) -> String {
    // Find the longest postfix of supplied string that is a palindrome.
    let palindromicSuffix = string.reversed().prefix(while: {!$0.isEmpty })
    // Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
    return string + String(palindromicSuffix.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.
    let palindromicSuffix = string.reversed().prefix(while: {!$0.isEmpty })
    // Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
    return string + String(palindromicSuffix.reversed())
}
```
let palindromicSuffix = string.reversed().prefix(while: {!$0.isEmpty }) // value of type 'String.Element' (aka 'Character') has no member 'isEmpty'

func makePalindrome(string: String) -> String {
    var palindrome = string
    var reversed = string.reversed()
    var i = string.count
    while i > 0 {
        if string.hasPrefix(reversed.prefix(i)) {
            palindrome.append(reversed.prefix(i).reversed())
            break
        }
        i -= 1
    }
    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 i = string.count
    while i > 0 {
        if string.hasPrefix(reversed.prefix(i)) {
            palindrome.append(reversed.prefix(i).reversed())
            break
        }
        i -= 1
    }
    return palindrome
}
```
if string.hasPrefix(reversed.prefix(i)) { // cannot convert value of type 'ReversedCollection<String>.SubSequence' (aka 'Slice<ReversedCollection<String>>') to expected argument type 'String'
palindrome.append(reversed.prefix(i).reversed()) // no exact matches in call to instance method 'append'

func makePalindrome(string: String) -> String {
    var palindrome = string
    var palindromeLength = string.count
    var palindromePrefix = ""
    var palindromeSuffix = ""
    
    // Find the longest palindromic suffix.
    for i in string.count-1 downto 0 {
        if isPalindrome(string: string.substring(withRange: NSRange(location: 0, length: i+1))) {
            palindromeLength = i+1
            palindromeSuffix = string.substring(withRange: NSRange(location: i+1, length: string.count-i-1))
            break
        }
    }
    
    // Find the longest palindromic prefix.
    for i in string.count-1 downto 0 {
        if isPalindrome(string: string.substring(withRange: NSRange(location: 0, length: i+1))) {
            palindromeLength = i+1
            palindromePrefix = string.substring(withRange: NSRange(location: 0, length: i+1))
            break
        }
    }
    
    // Append the reverse of the prefix to the end of the palindrome.
    palindrome = palindrome + String(palindromePrefix.reversed())
    
    // Append the suffix to the end of the palindrome.
    palindrome = palindrome + palindromeSuffix
    
    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 palindromeLength = string.count
    var palindromePrefix = ""
    var palindromeSuffix = ""
    
    // Find the longest palindromic suffix.
    for i in string.count-1 downto 0 {
        if isPalindrome(string: string.substring(withRange: NSRange(location: 0, length: i+1))) {
            palindromeLength = i+1
            palindromeSuffix = string.substring(withRange: NSRange(location: i+1, length: string.count-i-1))
            break
        }
    }
    
    // Find the longest palindromic prefix.
    for i in string.count-1 downto 0 {
        if isPalindrome(string: string.substring(withRange: NSRange(location: 0, length: i+1))) {
            palindromeLength = i+1
            palindromePrefix = string.substring(withRange: NSRange(location: 0, length: i+1))
            break
        }
    }
    
    // Append the reverse of the prefix to the end of the palindrome.
    palindrome = palindrome + String(palindromePrefix.reversed())
    
    // Append the suffix to the end of the palindrome.
    palindrome = palindrome + palindromeSuffix
    
    return palindrome
}
```
for i in string.count-1 downto 0 { // for-in loop requires 'Int' to conform to 'Sequence'
for i in string.count-1 downto 0 { // expected '{' to start the body of for-each loop
for i in string.count-1 downto 0 { // expected '{' to start the body of for-each loop
for i in string.count-1 downto 0 { // for-in loop requires 'Int' to conform to 'Sequence'

func makePalindrome(string: String) -> String {
    // Find the longest postfix of supplied string that is a palindrome.
    let palindrome = string.reversed().prefix(while: { $0 == $1 })
    // Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
    return string + String(palindrome.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.
    let palindrome = string.reversed().prefix(while: { $0 == $1 })
    // Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
    return string + String(palindrome.reversed())
}
```
let palindrome = string.reversed().prefix(while: { $0 == $1 }) // contextual closure type '(String.Element) throws -> Bool' (aka '(Character) throws -> Bool') expects 1 argument, but 2 were used in closure body

func makePalindrome(string: String) -> String {
    // Find the longest postfix of supplied string that is a palindrome.
    let palindromicSuffix = string.reversed().prefix(while: { $0 == $1 })
    // Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
    return string + String(palindromicSuffix.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.
    let palindromicSuffix = string.reversed().prefix(while: { $0 == $1 })
    // Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
    return string + String(palindromicSuffix.reversed())
}
```
let palindromicSuffix = string.reversed().prefix(while: { $0 == $1 }) // contextual closure type '(String.Element) throws -> Bool' (aka '(Character) throws -> Bool') expects 1 argument, but 2 were used in closure body

func makePalindrome(string: String) -> String {
    let palindrome = string.reversed()
    let prefix = string.prefix(while: { $0 == palindrome.first })
    return String(prefix) + String(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 {
    let palindrome = string.reversed()
    let prefix = string.prefix(while: { $0 == palindrome.first })
    return String(prefix) + String(palindrome)
}
```
 // XCTAssertTrue failed

func makePalindrome(string: String) -> String {
    let reversedString = string.reversed()
    let longestPalindrome = string.prefix(whileUsing: { reversedString.hasPrefix($0) })
    let palindrome = String(longestPalindrome) + String(reversedString.prefix(length: longestPalindrome.count))
    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 {
    let reversedString = string.reversed()
    let longestPalindrome = string.prefix(whileUsing: { reversedString.hasPrefix($0) })
    let palindrome = String(longestPalindrome) + String(reversedString.prefix(length: longestPalindrome.count))
    return palindrome
}
```
let longestPalindrome = string.prefix(whileUsing: { reversedString.hasPrefix($0) }) // no exact matches in call to instance method 'prefix'
let longestPalindrome = string.prefix(whileUsing: { reversedString.hasPrefix($0) }) // value of type 'ReversedCollection<String>' has no member 'hasPrefix'
let palindrome = String(longestPalindrome) + String(reversedString.prefix(length: longestPalindrome.count)) // no exact matches in call to instance method 'prefix'

func makePalindrome(string: String) -> String {
    // Find the longest palindromic suffix of the supplied string.
    let palindromicSuffix = findLongestPalindromicSuffix(string: string)
    // Find the longest palindromic prefix of the supplied string.
    let palindromicPrefix = findLongestPalindromicPrefix(string: string)
    // Append to the end of the string the reverse of the prefix that comes before the palindromic suffix.
    return string + String(reversed: palindromicPrefix) + palindromicSuffix
}
```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 = findLongestPalindromicSuffix(string: string)
    // Find the longest palindromic prefix of the supplied string.
    let palindromicPrefix = findLongestPalindromicPrefix(string: string)
    // Append to the end of the string the reverse of the prefix that comes before the palindromic suffix.
    return string + String(reversed: palindromicPrefix) + palindromicSuffix
}
```
let palindromicSuffix = findLongestPalindromicSuffix(string: string) // cannot find 'findLongestPalindromicSuffix' in scope
let palindromicPrefix = findLongestPalindromicPrefix(string: string) // cannot find 'findLongestPalindromicPrefix' in scope
return string + String(reversed: palindromicPrefix) + palindromicSuffix // no exact matches in call to initializer

func makePalindrome(string: String) -> String {
    let palindromicSuffix = findLongestPalindromicSuffix(string)
    let palindromicPrefix = findPalindromicPrefix(string, palindromicSuffix)
    return string + String(reversed: palindromicPrefix) + palindromicSuffix
}

func findLongestPalindromicSuffix(string: String) -> String {
    var palindromicSuffix = string
    while!isPalindrome(palindromicSuffix) {
        palindromicSuffix.removeLast()
    }
    return palindromicSuffix
}

func findPalindromicPrefix(string: String, palindromicSuffix: String) -> String {
    var palindromicPrefix = ""
    while!isPalindrome(string.suffix(string.index(string.endIndex - 1))) {
        string.removeLast()
        palindromicPrefix.append(string.last)
    }
    return palindromicPrefix
}

func isPalindrome(string: String) -> Bool {
    while string.startIndex!= string.endIndex {
        if string.first!= string.last {
            return false
        }
        string.removeFirst()
        string.removeLast()
    }
    return true
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    let palindromicSuffix = findLongestPalindromicSuffix(string)
    let palindromicPrefix = findPalindromicPrefix(string, palindromicSuffix)
    return string + String(reversed: palindromicPrefix) + palindromicSuffix
}

// Find the longest palindromic suffix of a supplied string.
// Algorithm idea is simple:
// - Find the longest palindromic suffix of a string.
// - If the longest palindromic suffix is a prefix of the string, return it.
// - Otherwise, remove the last character of the string and repeat.
// findLongestPalindromicSuffix(string: "") == ""
// findLongestPalindromicSuffix(string: "cat") == "t"
// findLongestPalindromicSuffix(string: "cata") == "ata"
func findLongestPalindromicSuffix(string: String) -> String {
    var palindromicSuffix = string
    while!isPalindrome(palindromicSuffix) {
        palindromicSuffix.removeLast()
    }
    return palindromicSuffix
}

// Find the longest palindromic prefix of a supplied string.
// Algorithm idea is simple:
// - Find the longest palindromic prefix of a string.
// - If the longest palindromic prefix is a suffix of the string, return it.
// - Otherwise, remove the last character of the string and repeat.
// findPalindromicPrefix(string: "", palindromicSuffix: "") == ""
// findPalindromicPrefix(string: "cat", palindromicSuffix: "t") == "c"
// findPalindromicPrefix(string: "cata", palindromicSuffix: "ata") == "c"
func findPalindromicPrefix(string: String, palindromicSuffix: String) -> String {
    var palindromicPrefix = ""
    while!isPalindrome(string.suffix(string.index(string.endIndex - 1))) {
        string.removeLast()
        palindromicPrefix.append(string.last)
    }
    return palindromicPrefix
}

// Determine if a supplied string is a palindrome.
// Algorithm idea is simple:
// - Compare the first and last characters of the string.
// - If they are equal, remove the first and last characters and repeat.
// isPalindrome(string: "") == true
// isPalindrome(string: "cat") == false
// isPalindrome(string: "cata") == true
func isPalindrome(string: String) -> Bool {
    while string.startIndex!= string.endIndex {
        if string.first!= string.last {
            return false
        }
        string.removeFirst()
        string.removeLast()
    }
    return true
}
```
let palindromicSuffix = findLongestPalindromicSuffix(string) // missing argument label 'string:' in call
let palindromicPrefix = findPalindromicPrefix(string, palindromicSuffix) // missing argument labels 'string:palindromicSuffix:' in call
return string + String(reversed: palindromicPrefix) + palindromicSuffix // no exact matches in call to initializer
while!isPalindrome(palindromicSuffix) { // expected expression, var, or let in 'while' condition
while!isPalindrome(string.suffix(string.index(string.endIndex - 1))) { // expected expression, var, or let in 'while' condition
while string.startIndex!= string.endIndex { // cannot force unwrap value of non-optional type 'String.Index'
while string.startIndex!= string.endIndex { // '=' must have consistent whitespace on both sides
while string.startIndex!= string.endIndex { // use of '=' in a boolean context, did you mean '=='?
if string.first!= string.last { // '=' must have consistent whitespace on both sides
if string.first!= string.last { // cannot assign through '!': 'first' is a get-only property
if string.first!= string.last { // use of '=' in a boolean context, did you mean '=='?
if string.first!= string.last { // value of optional type 'String.Element?' (aka 'Optional<Character>') must be unwrapped to a value of type 'String.Element' (aka 'Character')
string.removeFirst() // cannot use mutating member on immutable value: 'string' is a 'let' constant
string.removeLast() // cannot use mutating member on immutable value: 'string' is a 'let' constant

func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        if a[i]!= b[i] {
            result += "1"
        } else {
            result += "0"
        }
    }
    return result
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        if a[i]!= b[i] {
            result += "1"
        } else {
            result += "0"
        }
    }
    return result
}
```
if a[i]!= b[i] { // '=' must have consistent whitespace on both sides
if a[i]!= b[i] { // use of '=' in a boolean context, did you mean '=='?
if a[i]!= b[i] { // cannot force unwrap value of non-optional type 'Character'

func stringXor(a: String, b: String) -> String {
    var result = ""
    for index in 0..<a.count {
        if a[index]!= b[index] {
            result += "1"
        } else {
            result += "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 in 0..<a.count {
        if a[index]!= b[index] {
            result += "1"
        } else {
            result += "0"
        }
    }
    return result
}
```
if a[index]!= b[index] { // use of '=' in a boolean context, did you mean '=='?
if a[index]!= b[index] { // cannot force unwrap value of non-optional type 'Character'
if a[index]!= b[index] { // '=' must have consistent whitespace on both sides

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

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 {
    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 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.append(aBit == bBit? "0" : "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..<max(a.count, b.count) {
        let aBit = a.count > i? a[i] : "0"
        let bBit = b.count > i? b[i] : "0"
        result.append(aBit == bBit? "0" : "1")
    }
    return result
}
```
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" // expected expression
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" // expression of type 'Character' is unused
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" // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
let aBit = a.count > i? a[i] : "0" // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
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" // cannot use optional chaining on non-optional value of type 'Int'
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" // 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" // expression of type 'Character' is unused

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 i in 0..<a.count {
        if a[i]!= b[i] {
            result += "1"
        } else {
            result += "0"
        }
    }
    return result
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        if a[i]!= b[i] {
            result += "1"
        } else {
            result += "0"
        }
    }
    return result
}
```
if a[i]!= b[i] { // '=' must have consistent whitespace on both sides
if a[i]!= b[i] { // use of '=' in a boolean context, did you mean '=='?
if a[i]!= b[i] { // cannot force unwrap value of non-optional type 'Character'

func stringXor(a: String, b: String) -> String {
    var a = a.unicodeScalars
    var b = b.unicodeScalars
    var result = [String]()
    for i in 0..<max(a.count, b.count) {
        if i < a.count {
            a[i] ^= b[i]
        }
        if i < b.count {
            b[i] ^= a[i]
        }
        if a[i] == 0 {
            result.append("0")
        } else {
            result.append("1")
        }
    }
    return String(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 a = a.unicodeScalars
    var b = b.unicodeScalars
    var result = [String]()
    for i in 0..<max(a.count, b.count) {
        if i < a.count {
            a[i] ^= b[i]
        }
        if i < b.count {
            b[i] ^= a[i]
        }
        if a[i] == 0 {
            result.append("0")
        } else {
            result.append("1")
        }
    }
    return String(result)
}
```
a[i] ^= b[i] // binary operator '^=' cannot be applied to two 'Unicode.Scalar' operands
a[i] ^= b[i] // no exact matches in call to subscript
a[i] ^= b[i] // no exact matches in call to subscript
b[i] ^= a[i] // no exact matches in call to subscript
b[i] ^= a[i] // no exact matches in call to subscript
b[i] ^= a[i] // binary operator '^=' cannot be applied to two 'Unicode.Scalar' operands
if a[i] == 0 { // referencing operator function '==' on 'BinaryInteger' requires that 'Unicode.Scalar' conform to 'BinaryInteger'
if a[i] == 0 { // no exact matches in call to subscript
return String(result) // no exact matches in call to initializer

func stringXor(a: String, b: String) -> String {
    return a.map {
        if a == "0" {
            return b[0]
        } else {
            return b[1]
        }
    }.joined()
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    return a.map {
        if a == "0" {
            return b[0]
        } else {
            return b[1]
        }
    }.joined()
}
```
return a.map { // contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored
return b[0] // cannot convert value of type 'Character' to closure result type 'String'

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

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? {
    if strings.isEmpty {
        return nil
    }
    
    var longestString = strings[0]
    for string in strings {
        if string.count > longestString.count {
            longestString = string
        }
    }
    
    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? {
    if strings.isEmpty {
        return nil
    }
    
    var longestString = strings[0]
    for string in strings {
        if string.count > longestString.count {
            longestString = string
        }
    }
    
    return longestString
}
```

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 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 = nil
    for string in strings {
        if longestString == nil || string.count > longestString.count {
            longestString = string
        }
    }
    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 = nil
    for string in strings {
        if longestString == nil || string.count > longestString.count {
            longestString = string
        }
    }
    return longestString
}
```
var longestString = nil // 'nil' requires a contextual type

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 { // cannot use optional chaining on non-optional 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 { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

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

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

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

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

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 prefixes = [String]()
    for i in 0..<string.count {
        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.count {
        prefixes.append(string.prefix(i))
    }
    return prefixes
}
```
prefixes.append(string.prefix(i)) // 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 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 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 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 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+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 {
        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 countDistinctCharacters(string: String) -> Int {
    let lowercaseString = string.lowerCase()
    var count = 0
    for character in lowercaseString.characters {
        if!lowercaseString.containsString(character) {
            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 {
    let lowercaseString = string.lowerCase()
    var count = 0
    for character in lowercaseString.characters {
        if!lowercaseString.containsString(character) {
            count += 1
        }
    }
    return count
}
```
let lowercaseString = string.lowerCase() // value of type 'String' has no member 'lowerCase'
if!lowercaseString.containsString(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 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 {
    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 {
    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 characters = lowercaseString.characters
    var count = 0
    for character in characters {
        if!characters.contains(character) {
            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 {
    let lowercaseString = string.lowerCased()
    let characters = lowercaseString.characters
    var count = 0
    for character in characters {
        if!characters.contains(character) {
            count += 1
        }
    }
    return count
}
```
let lowercaseString = string.lowerCased() // value of type 'String' has no member 'lowerCased'
if!characters.contains(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 countDistinctCharacters(string: String) -> Int {
    let lowercaseString = string.lowerCased()
    let characters = lowercaseString.characters
    let uniqueCharacters = characters.reduce(into: [Character](), combine: {
        if $0.contains($1) {
            return
        }
        $0.append($1)
    })
    return uniqueCharacters.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 characters = lowercaseString.characters
    let uniqueCharacters = characters.reduce(into: [Character](), combine: {
        if $0.contains($1) {
            return
        }
        $0.append($1)
    })
    return uniqueCharacters.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 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] {
    // TODO: implement me
}
```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: implement me
}
```
} // 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 parsedMusic = [Int]()
    var currentBeat = 0
    var currentNote = ""
    for character in musicString {
        if character == "o" {
            currentBeat += 4
        } else if character == "o|" {
            currentBeat += 2
        } else if character == "." {
            currentBeat += 1
        } else if character == "|" {
            parsedMusic.append(currentBeat)
            currentBeat = 0
        }
    }
    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
    var currentNote = ""
    for character in musicString {
        if character == "o" {
            currentBeat += 4
        } else if character == "o|" {
            currentBeat += 2
        } else if character == "." {
            currentBeat += 1
        } else if character == "|" {
            parsedMusic.append(currentBeat)
            currentBeat = 0
        }
    }
    parsedMusic.append(currentBeat)
    return parsedMusic
}
```
} else if character == "o|" { // binary operator '==' cannot be applied to operands of type 'Character' and 'String'

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 currentBeat = 0
    for character in musicString {
        switch character {
        case 'o':
            currentBeat += 4
        case '|':
            currentBeat /= 2
        case '.':
            currentBeat -= 1
        default:
            break
        }
        notes.append(currentBeat)
    }
    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':
            currentBeat += 4
        case '|':
            currentBeat /= 2
        case '.':
            currentBeat -= 1
        default:
            break
        }
        notes.append(currentBeat)
    }
    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] {
    var result: [Int] = []
    var currentBeat = 0
    for character in musicString {
        switch character {
        case 'o':
            currentBeat += 4
        case '|':
            currentBeat /= 2
        case '.':
            currentBeat /= 4
        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 /= 4
        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] {
    var beats = [Int]()
    var currentBeat = 0
    for character in musicString {
        switch character {
        case 'o':
            beats.append(4)
            currentBeat += 4
        case '|':
            beats.append(2)
            currentBeat += 2
        case '.':
            beats.append(1)
            currentBeat += 1
        default:
            fatalError("Invalid character in music string")
        }
    }
    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 character in musicString {
        switch character {
        case 'o':
            beats.append(4)
            currentBeat += 4
        case '|':
            beats.append(2)
            currentBeat += 2
        case '.':
            beats.append(1)
            currentBeat += 1
        default:
            fatalError("Invalid character in music string")
        }
    }
    return beats
}
```
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 result: [Int] = []
    var currentBeat: Int = 0
    var currentNote: String = ""
    for character in musicString {
        if character == "o" {
            currentBeat += 4
        } else if character == "o|" {
            currentBeat += 2
        } else if character == "." {
            currentBeat += 1
        } else {
            // If character is not one of the above, it is a note separator.
            // We need to add the current note to the result and reset the currentBeat.
            result.append(currentBeat)
            currentBeat = 0
            currentNote = ""
        }
    }
    // Add the last note to the result.
    result.append(currentBeat)
    return result
}
```swift
// Input to this function is a string representing musical notes in a special ASCII format.
// Your task is to parse this string and return array of integers corresponding to how many beats does each
// not last.
// Here is a legend:
// 'o' - whole note, lasts four beats
// 'o|' - half note, lasts two beats
// '.|' - quater note, lasts one beat
// parseMusic(musicString: "o o|.| o| o|.|.|.|.| o o") == [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
func parseMusic(musicString: String) -> [Int] {
    var result: [Int] = []
    var currentBeat: Int = 0
    var currentNote: String = ""
    for character in musicString {
        if character == "o" {
            currentBeat += 4
        } else if character == "o|" {
            currentBeat += 2
        } else if character == "." {
            currentBeat += 1
        } else {
            // If character is not one of the above, it is a note separator.
            // We need to add the current note to the result and reset the currentBeat.
            result.append(currentBeat)
            currentBeat = 0
            currentNote = ""
        }
    }
    // Add the last note to the result.
    result.append(currentBeat)
    return result
}
```
} else if character == "o|" { // binary operator '==' cannot be applied to operands of type 'Character' and 'String'

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 { // use of '=' in a boolean context, did you mean '=='?
while index!= string.endIndex { // '=' must have consistent whitespace on both sides
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 {
    let substringLength = substring.length
    var count = 0
    for i in 0..<string.length {
        if string.substring(from: i, to: i + substringLength) == 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 substringLength = substring.length
    var count = 0
    for i in 0..<string.length {
        if string.substring(from: i, to: i + substringLength) == substring {
            count += 1
        }
    }
    return count
}
```
let substringLength = substring.length // value of type 'String' has no member 'length'
for i in 0..<string.length { // value of type 'String' has no member 'length'

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 { // use of '=' in a boolean context, did you mean '=='?
while index!= string.endIndex { // '=' must have consistent whitespace on both sides
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 {
    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) // value of type 'String' has no member 'rangeOfString'
let range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch) // type 'NSStringCompareOptions' has no member 'CaseInsensitiveSearch'
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 {
    let range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch)
    var count = 0
    while range.startIndex!= NSNotFound {
        count += 1
        range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch, range: range)
    }
    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.startIndex!= NSNotFound {
        count += 1
        range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch, range: range)
    }
    return count
}
```
let range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch) // value of type 'String' has no member 'rangeOfString'
let range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch) // type 'NSStringCompareOptions' has no member 'CaseInsensitiveSearch'
while range.startIndex!= NSNotFound { // '=' must have consistent whitespace on both sides
while range.startIndex!= NSNotFound { // use of '=' in a boolean context, did you mean '=='?
range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch, range: range) // value of type 'String' has no member 'rangeOfString'
range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch, range: range) // type 'NSStringCompareOptions' has no member 'CaseInsensitiveSearch'

func howManyTimes(string: String, substring: String) -> Int {
    let range = string.rangeOfString(substring)
    var count = 0
    while range.startIndex!= string.endIndex {
        count += 1
        range = string.rangeOfString(substring, options:.ByStartingWith, range: range.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 {
    let range = string.rangeOfString(substring)
    var count = 0
    while range.startIndex!= string.endIndex {
        count += 1
        range = string.rangeOfString(substring, options:.ByStartingWith, range: range.advancedBy(substring.characters.count))
    }
    return count
}
```
let range = string.rangeOfString(substring) // value of type 'String' has no member 'rangeOfString'
while range.startIndex!= string.endIndex { // '=' must have consistent whitespace on both sides
while range.startIndex!= string.endIndex { // use of '=' in a boolean context, did you mean '=='?
range = string.rangeOfString(substring, options:.ByStartingWith, range: range.advancedBy(substring.characters.count)) // cannot infer contextual base in reference to member 'ByStartingWith'
range = string.rangeOfString(substring, options:.ByStartingWith, range: range.advancedBy(substring.characters.count)) // value of type 'String' has no member 'rangeOfString'

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

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 { // use of '=' in a boolean context, did you mean '=='?
while index!= string.endIndex { // '=' must have consistent whitespace on both sides
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: 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 { // use of '=' in a boolean context, did you mean '=='?
while index!= string.endIndex { // '=' must have consistent whitespace on both sides
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 {
    let range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch)
    var count = 0
    while range.startIndex!= NSNotFound {
        count += 1
        range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch, range: range)
    }
    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.startIndex!= NSNotFound {
        count += 1
        range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch, range: range)
    }
    return count
}
```
let range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch) // value of type 'String' has no member 'rangeOfString'
let range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch) // type 'NSStringCompareOptions' has no member 'CaseInsensitiveSearch'
while range.startIndex!= NSNotFound { // '=' must have consistent whitespace on both sides
while range.startIndex!= NSNotFound { // use of '=' in a boolean context, did you mean '=='?
range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch, range: range) // value of type 'String' has no member 'rangeOfString'
range = string.rangeOfString(substring, options: NSStringCompareOptions.CaseInsensitiveSearch, range: range) // type 'NSStringCompareOptions' has no member 'CaseInsensitiveSearch'

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

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

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 sortNumbers(numbers: String) -> String {
    let numberArray = numbers.split(separator: " ").map { Int($0) }
    return numberArray.sorted().map { String($0) }.joined(separator: " ")
}
```swift
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five','six','seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to largest
// sortNumbers(numbers: "three one five") == "one three five"
func sortNumbers(numbers: String) -> String {
    let numberArray = numbers.split(separator: " ").map { Int($0) }
    return numberArray.sorted().map { String($0) }.joined(separator: " ")
}
```
return numberArray.sorted().map { String($0) }.joined(separator: " ") // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return numberArray.sorted().map { String($0) }.joined(separator: " ") // referencing instance method 'sorted()' on 'Sequence' requires that 'Int?' conform to 'Comparable'

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 smallestDifference = Double.greatestFiniteMagnitude
    var closestElements = (0.0, 0.0)
    for (firstIndex, firstNumber) in numbers.enumerated() {
        for (secondIndex, secondNumber) in numbers.enumerated() {
            if firstIndex!= secondIndex {
                let difference = abs(firstNumber - secondNumber)
                if difference < smallestDifference {
                    smallestDifference = difference
                    closestElements = (firstNumber, secondNumber)
                }
            }
        }
    }
    return closestElements
}
```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 smallestDifference = Double.greatestFiniteMagnitude
    var closestElements = (0.0, 0.0)
    for (firstIndex, firstNumber) in numbers.enumerated() {
        for (secondIndex, secondNumber) in numbers.enumerated() {
            if firstIndex!= secondIndex {
                let difference = abs(firstNumber - secondNumber)
                if difference < smallestDifference {
                    smallestDifference = difference
                    closestElements = (firstNumber, secondNumber)
                }
            }
        }
    }
    return closestElements
}
```
if firstIndex!= secondIndex { // use of '=' in a boolean context, did you mean '=='?
if firstIndex!= secondIndex { // '=' must have consistent whitespace on both sides
if firstIndex!= secondIndex { // cannot force unwrap value of non-optional type 'Int'

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

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
    })
    let scale = max - min
    return numbers.map { (num: Double) -> Double in
        return (num - min) / 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.greatestFiniteMagnitude, { min, num in
        return min < num? min : num
    })
    let max = numbers.reduce(Double.leastNonMagnitude, { max, num in
        return max > num? max : num
    })
    let scale = max - min
    return numbers.map { (num: Double) -> Double in
        return (num - min) / scale
    }
}
```
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'
return min < num? min : num // consecutive statements on a line must be separated by ';'
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'
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 // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return max > num? max : num // cannot use optional chaining on non-optional 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(0.0, combine: { (min: Double, number: Double) -> Double in
        return min > number? number : min
    })
    let max = numbers.reduce(0.0, combine: { (max: Double, number: Double) -> Double in
        return max < number? number : max
    })
    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? number : min
    })
    let max = numbers.reduce(0.0, combine: { (max: Double, number: Double) -> Double in
        return max < number? number : max
    })
    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? number : min // consecutive statements on a line must be separated by ';'
return min > number? number : min // expected expression
return min > number? number : min // consecutive statements on a line must be separated by ';'
return min > number? number : min // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return min > number? number : min // cannot convert value of type 'Bool' to closure result type 'Double'
return min > number? number : min // cannot use optional chaining on non-optional value of type 'Double'
let max = numbers.reduce(0.0, combine: { (max: Double, number: Double) -> Double in // extraneous argument label 'combine:' in call
return max < number? number : max // cannot convert value of type 'Bool' to closure result type 'Double'
return max < number? number : max // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return max < number? number : max // consecutive statements on a line must be separated by ';'
return max < number? number : max // expected expression
return max < number? number : max // cannot use optional chaining on non-optional value of type 'Double'
return max < number? number : max // 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 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(Double.infinity, <)
    let max = numbers.reduce(Double.mininum, >)
    let range = max - min
    return numbers.map { (number: Double) -> Double in
        return (number - min) / range
    }
}
```
let min = numbers.reduce(Double.infinity, <) // cannot convert value of type 'Double' to expected argument type 'Bool'
let min = numbers.reduce(Double.infinity, <) // no exact matches in reference to operator function '<'
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 scale = max - min
    return numbers.map { (number: Double) -> Double in
        return (number - min) / 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(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 scale = max - min
    return numbers.map { (number: Double) -> Double in
        return (number - min) / scale
    }
}
```
let min = numbers.reduce(0.0, combine: { (min: Double, number: Double) -> Double in // extraneous argument label 'combine:' in call
return min < number? min : number // cannot use optional chaining on non-optional value of type 'Double'
return min < number? min : number // expected expression
return min < number? min : number // cannot convert value of type 'Bool' to closure result type 'Double'
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 // consecutive statements on a line must be separated by ';'
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 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 // cannot convert value of type 'Bool' to closure result type 'Double'
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 ';'
return max > number? max : number // expected expression

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

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

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 _ 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 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 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 = n
    for 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
    for divisor > 1 {
        if n % divisor == 0 {
            return divisor
        }
        divisor -= 1
    }
    return 1
}
```
for divisor > 1 { // '>' is not a prefix unary operator
for divisor > 1 { // unary operator cannot be separated from its operand
for divisor > 1 { // expected 'in' after for-each pattern

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 {
    guard n > 1 else { return 1 }
    
    for i in (2...n/2).reversed() {
        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 {
    guard n > 1 else { return 1 }
    
    for i in (2...n/2).reversed() {
        if n % i == 0 {
            return i
        }
    }
    return 1
}
```
 // Fatal error: Range requires lowerBound <= upperBound

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

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 {
    var largest = n
    for i in 2...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 2...n {
        if n % i == 0 {
            largest = i
        }
    }
    return largest
}
```
 // 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 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 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 factorize(n: Int) -> [Int] {
    var factors: [Int] = []
    var i = 2
    while n > 1 {
        if n % i == 0 {
            factors.append(i)
            n = 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 = n / i
        } else {
            i += 1
        }
    }
    return factors
}
```
n = n / i // cannot assign to value: '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
            }
            for _ in 0...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
            }
            for _ in 0...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 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 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 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]()
    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 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] = []
    for i in 2...Int(sqrt(Double(n))) {
        if n % i == 0 {
            var count = 1
            for j in 2...Int(sqrt(Double(n / i))) {
                if i * j == n {
                    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...Int(sqrt(Double(n))) {
        if n % i == 0 {
            var count = 1
            for j in 2...Int(sqrt(Double(n / i))) {
                if i * j == n {
                    count += 1
                }
            }
            factors.append(count)
            factors.append(i)
        }
    }
    return factors
}
```
 // Fatal error: Range requires lowerBound <= upperBound

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 // result of operator '+' is unused
seen[number] = seen[number]?.advancedBy(1)?? 0 + 1 // consecutive statements on a line must be separated by ';'

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] {
    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 // integer literal is unused
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 // 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'

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var last = 0
    for i in 0..<numbers.count {
        if numbers[i]!= numbers[last] {
            result.append(numbers[i])
            last = i
        }
    }
    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 last = 0
    for i in 0..<numbers.count {
        if numbers[i]!= numbers[last] {
            result.append(numbers[i])
            last = i
        }
    }
    return result
}
```
if numbers[i]!= numbers[last] { // use of '=' in a boolean context, did you mean '=='?
if numbers[i]!= numbers[last] { // '=' must have consistent whitespace on both sides
if numbers[i]!= numbers[last] { // cannot force unwrap value of non-optional 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 // integer literal is unused
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 // 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'

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

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 // integer literal is unused
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 // 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'

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

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 {
    // 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.replacingOccurrences(of: uppercase, with: lowercase)
}
```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.replacingOccurrences(of: uppercase, with: lowercase)
}
```
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 {
    let lowercase = string.lowercaseString
    let uppercase = string.uppercaseString
    return lowercase.enumerate().reduce("") {
        (acc, element) -> String in
        if element.0.isLowercase {
            return acc + uppercase[element.0]
        } else {
            return acc + 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("") {
        (acc, element) -> String in
        if element.0.isLowercase {
            return acc + uppercase[element.0]
        } else {
            return acc + 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 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 {
    return string.map {
        if $0.isLowercase {
            return String($0.uppercased())
        } else {
            return String($0.lowercased())
        }
    }
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    return string.map {
        if $0.isLowercase {
            return String($0.uppercased())
        } else {
            return String($0.lowercased())
        }
    }
}
```
return string.map { // cannot convert return expression of type '[String]' to return type 'String'

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 {
    return string.uppercased().lowercased()
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    return string.uppercased().lowercased()
}
```
 // XCTAssertTrue failed

func flipCase(string: String) -> String {
    return string.map {
        if $0.isLowercase {
            return String($0.uppercaseString)
        } else {
            return String($0.lowercaseString)
        }
    }
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    return string.map {
        if $0.isLowercase {
            return String($0.uppercaseString)
        } else {
            return String($0.lowercaseString)
        }
    }
}
```
return string.map { // cannot convert return expression of type '[T]' to return type 'String'
return String($0.uppercaseString) // value of type 'String.Element' (aka 'Character') has no member 'uppercaseString'

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 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 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 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 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 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 < 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 <= 3 {
        return true
    }
    if n % 2 == 0 || n % 3 == 0 {
        return false
    }
    for i in 5..<Int.max/n {
        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/n {
        if i * i > n {
            break
        }
        if n % i == 0 || n % (i + 2) == 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 <= 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 <= 1 {
        return false
    }
    if n <= 3 {
        return true
    }
    if n % 2 == 0 || n % 3 == 0 {
        return false
    }
    for i in start:end {
        if i * i > n {
            break
        }
        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 <= 3 {
        return true
    }
    if n % 2 == 0 || n % 3 == 0 {
        return false
    }
    for i in start:end {
        if i * i > n {
            break
        }
        if n % i == 0 {
            return false
        }
    }
    return true
}
```
for i in start:end { // expected '{' to start the body of for-each loop
for i in start:end { // cannot find 'start' in scope

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

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

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

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

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

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

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

func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        if!result.contains(i) {
            result.append(i)
        }
    }
    return result
}
```swift
// Return sorted unique elements in an array
// unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {
    var result = [Int]()
    for i in l {
        if!result.contains(i) {
            result.append(i)
        }
    }
    return result
}
```
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 x in l {
        if!seen.contains(x) {
            result.append(x)
            seen.append(x)
        }
    }
    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 x in l {
        if!seen.contains(x) {
            result.append(x)
            seen.append(x)
        }
    }
    return result
}
```
if!seen.contains(x) { // 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 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 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 {
        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 - 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 fizzBuzz(n: Int) -> Int {
    var count = 0
    for i in 0...n-1 {
        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 0...n-1 {
        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
            }
            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 0..<n {
        if i % 11 == 0 || i % 13 == 0 {
            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 {
        if i % 11 == 0 || i % 13 == 0 {
            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
            }
            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
            }
            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 0...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 0...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 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 lPrime = [Int]()
    for (i, v) in enumerate(l) {
        if i % 2 == 0 {
            lPrime.append(v)
        }
    }
    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 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 lPrime = [Int]()
    for (i, v) in enumerate(l) {
        if i % 2 == 0 {
            lPrime.append(v)
        }
    }
    lPrime.sort()
    return lPrime
}
```
for (i, v) in enumerate(l) { // cannot find 'enumerate' in scope

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

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

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

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

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

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

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

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 = 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 = i + 1
        }
    }
    return c
}
```
if isPrime(c) { // cannot find 'isPrime' in scope

func primeFib(n: Int) -> Int {
    let fib = fibonacci(n)
    let prime = primeFactors(fib)
    return 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 {
    let fib = fibonacci(n)
    let prime = primeFactors(fib)
    return prime
}
```
let fib = fibonacci(n) // cannot find 'fibonacci' in scope
let prime = primeFactors(fib) // cannot find 'primeFactors' in scope

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

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

func primeFib(n: Int) -> Int {
    var fib = fibonacci(n)
    var prime = primeNumber(fib)
    return 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 = primeNumber(fib)
    return prime
}
```
var fib = fibonacci(n) // cannot find 'fibonacci' in scope
var prime = primeNumber(fib) // cannot find 'primeNumber' in scope

func primeFib(n: Int) -> Int {
    if n == 1 {
        return 2
    } else if n == 2 {
        return 3
    }
    
    var fib = [Int]()
    fib.append(2)
    fib.append(3)
    
    var i = 0
    var j = 1
    
    while fib[i] + fib[j] <= n {
        if isPrime(fib[i] + fib[j]) {
            fib.append(fib[i] + fib[j])
        }
        i += 1
        j += 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 {
    if n == 1 {
        return 2
    } else if n == 2 {
        return 3
    }
    
    var fib = [Int]()
    fib.append(2)
    fib.append(3)
    
    var i = 0
    var j = 1
    
    while fib[i] + fib[j] <= n {
        if isPrime(fib[i] + fib[j]) {
            fib.append(fib[i] + fib[j])
        }
        i += 1
        j += 1
    }
    
    return fib[n - 1]
}
```
if isPrime(fib[i] + fib[j]) { // 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 {
    let fib = fibonacci(n)
    let prime = primeFactors(fib)
    return 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 {
    let fib = fibonacci(n)
    let prime = primeFactors(fib)
    return prime
}
```
let fib = fibonacci(n) // cannot find 'fibonacci' in scope
let prime = primeFactors(fib) // cannot find 'primeFactors' 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 {
    // 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 {
    // 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 {
    // 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
    return false
}
```swift
// triples_sum_to_zero takes an array of integers as an input.
// it returns true if there are three distinct elements in the array that
// sum to zero, and false otherwise.
// triplesSumToZero(l: [1, 3, 5, 0]) == false
// triplesSumToZero(l: [1, 3, -2, 1]) == true
// triplesSumToZero(l: [1, 2, 3, 7]) == false
// triplesSumToZero(l: [2, 4, -5, 3, 9, 7]) == true
// triplesSumToZero(l: [1]) == false
func triplesSumToZero(l: [Int]) -> Bool {
    // TODO: implement me
    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'

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

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

func carRaceCollision(n: Int) -> Int {
    // TODO: Implement this function.
    // Hint: You can use the built-in function "abs" to get the absolute value of an Int.
    // Hint: You can use the built-in function "min" to get the minimum of two Int values.
    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.
    // Hint: You can use the built-in function "abs" to get the absolute value of an Int.
    // Hint: You can use the built-in function "min" to get the minimum of two Int values.
    return 0
}
```
 // XCTAssertTrue failed

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

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

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

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

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

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

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

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

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

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

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

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 { // '=' must have consistent whitespace on both sides
if i!= j { // use of '=' in a boolean context, did you mean '=='?
if i!= j { // cannot force unwrap value of non-optional type 'Int'

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

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var y = x
    while y > 0 {
        result = String(UnicodeScalar(Int(y % base))) + result
        y = y / 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 y = x
    while y > 0 {
        result = String(UnicodeScalar(Int(y % base))) + result
        y = y / base
    }
    return result
}
```
result = String(UnicodeScalar(Int(y % base))) + 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 {
    var result = ""
    var number = x
    var baseString = "0123456789ABCDEF"
    
    while number > 0 {
        result = baseString[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 baseString = "0123456789ABCDEF"
    
    while number > 0 {
        result = baseString[number % base] + result
        number /= base
    }
    
    return result
}
```
result = baseString[number % base] + result // no exact matches in call to subscript

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 {
    let digits = "0123456789ABCDEF"
    var result = ""
    var number = x
    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 {
    let digits = "0123456789ABCDEF"
    var result = ""
    var number = x
    while number > 0 {
        result = String(digits[number % base]) + result
        number /= base
    }
    return result
}
```
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 {
    let digits = "0123456789ABCDEF"
    var result = ""
    var number = x
    
    repeat {
        result = String(digits[number % base]) + result
        number /= base
    } while number > 0
    
    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 {
    let digits = "0123456789ABCDEF"
    var result = ""
    var number = x
    
    repeat {
        result = String(digits[number % base]) + result
        number /= base
    } while number > 0
    
    return result
}
```
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 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 y = x
    while y > 0 {
        result = String(UnicodeScalar(Int(y % base))) + result
        y = y / 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 y = x
    while y > 0 {
        result = String(UnicodeScalar(Int(y % base))) + result
        y = y / base
    }
    return result
}
```
result = String(UnicodeScalar(Int(y % base))) + 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 {
    var result = ""
    var y = x
    while y > 0 {
        result = String(format: "%d%@", y % base, result)
        y = y / 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 y = x
    while y > 0 {
        result = String(format: "%d%@", y % base, result)
        y = y / base
    }
    return result
}
```

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var temp = x
    var i = 0
    while temp > 0 {
        var remainder = temp % base
        if remainder < 10 {
            result = String(remainder) + result
        } else {
            result = String(remainder - 10 + "A") + 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 {
    var result = ""
    var temp = x
    var i = 0
    while temp > 0 {
        var remainder = temp % base
        if remainder < 10 {
            result = String(remainder) + result
        } else {
            result = String(remainder - 10 + "A") + result
        }
        temp = temp / base
    }
    return result
}
```
result = String(remainder - 10 + "A") + result // binary operator '+' cannot be applied to operands of type 'Int' and 'String'

func changeBase(x: Int, base: Int) -> String {
    // TODO: implement changeBase
    // return ""
    var result = ""
    var temp = x
    var i = 0
    while temp > 0 {
        var remainder = temp % base
        if remainder < 10 {
            result = String(remainder) + result
        } else {
            result = String(remainder - 10 + "a") + 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: implement changeBase
    // return ""
    var result = ""
    var temp = x
    var i = 0
    while temp > 0 {
        var remainder = temp % base
        if remainder < 10 {
            result = String(remainder) + result
        } else {
            result = String(remainder - 10 + "a") + result
        }
        temp = temp / base
    }
    return result
}
```
result = String(remainder - 10 + "a") + result // binary operator '+' cannot be applied to operands of type 'Int' and 'String'

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

// 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 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 fib4 = [Int]()
    fib4.append(0)
    fib4.append(0)
    fib4.append(2)
    
    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 {
    
    var fib4 = [Int]()
    fib4.append(0)
    fib4.append(0)
    fib4.append(2)
    
    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 fib4(n: Int) -> Int {
    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 {
    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 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 {
    
    // Your code 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 {
    
    // Your code here.
    
    return 0
}
```
 // XCTAssertTrue failed

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

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

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 {
    var sum = 0.0
    for i in l {
        sum += Double(i)
    }
    return sum / Double(l.count)
}
```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 sum = 0.0
    for i in l {
        sum += Double(i)
    }
    return sum / Double(l.count)
}
```
 // XCTAssertTrue failed

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 {
    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 sum = 0.0
    for i in l {
        sum += Double(i)
    }
    return sum / Double(l.count)
}
```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 sum = 0.0
    for i in l {
        sum += Double(i)
    }
    return sum / Double(l.count)
}
```
 // XCTAssertTrue failed

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 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 {
    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 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 modp(n: Int, p: Int) -> Int {
    return pow(n, 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 pow(n, p) % p
}
```
return pow(n, p) % p // cannot convert value of type 'Decimal' to expected argument type 'Int'
return pow(n, p) % p // cannot convert value of type 'Int' to expected argument type 'Decimal'

func modp(n: Int, p: Int) -> Int {
    var result = n
    for result >= p {
        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 -= p
    }
    return result
}

// 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 -= p
    }
    return result
}

// 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 -= p
    }
    return result
}

// 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 -= p
    }
    return result
}

// 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 -= p
    }
    return result
}

// 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 -= p
    }
    return result
}

// 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 -= p
    }
    return result
}

// 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 -= p
    }
    return result
}

// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(
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 pow(n, 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 pow(n, p) % p
}
```
return pow(n, p) % p // cannot convert value of type 'Decimal' to expected argument type 'Int'
return pow(n, p) % p // cannot convert value of type 'Int' to expected argument type 'Decimal'

func modp(n: Int, p: Int) -> Int {
    return pow(n, 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 pow(n, p) % p
}
```
return pow(n, p) % p // cannot convert value of type 'Decimal' to expected argument type 'Int'
return pow(n, p) % p // cannot convert value of type 'Int' to expected argument type 'Decimal'

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 result = n
    var i = p - 1
    while i > 0 {
        if (n & i) == 0 {
            n = n >> 1
        } else {
            n = n ^ p
        }
        i = i >> 1
    }
    return n
}
```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
    var i = p - 1
    while i > 0 {
        if (n & i) == 0 {
            n = n >> 1
        } else {
            n = n ^ p
        }
        i = i >> 1
    }
    return n
}
```
n = n >> 1 // cannot assign to value: 'n' is a 'let' constant
n = n ^ p // cannot assign to value: 'n' is a 'let' constant

func modp(n: Int, p: Int) -> Int {
    return pow(n, 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 pow(n, p) % p
}
```
return pow(n, p) % p // cannot convert value of type 'Decimal' to expected argument type 'Int'
return pow(n, p) % p // cannot convert value of type 'Int' to expected argument type 'Decimal'

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 + 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 {
    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 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" { // 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
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" { // '=' must have consistent whitespace on both sides
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" { // 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" { // '=' 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 convert value of type 'Character' 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" { // '=' 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 'String' to expected argument type 'Bool'

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 {
    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 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" { // 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
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" { // '=' must have consistent whitespace on both sides
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" { // 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" { // '=' 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 convert value of type 'Character' 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" { // '=' 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 'String' to expected argument type 'Bool'

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

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 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" { // 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
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" { // '=' must have consistent whitespace on both sides
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" { // 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" { // '=' 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 convert value of type 'Character' 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" { // '=' 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 'String' to expected argument type 'Bool'

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 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" { // 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
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" { // '=' must have consistent whitespace on both sides
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" { // 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" { // '=' 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 convert value of type 'Character' 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" { // '=' 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 'String' to expected argument type 'Bool'

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 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" { // 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
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" { // '=' must have consistent whitespace on both sides
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" { // 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" { // '=' 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 convert value of type 'Character' 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" { // '=' 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 'String' to expected argument type 'Bool'

func removeVowels(text: String) -> String {
    // TODO: Implement removeVowels(text: String) -> String
    return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" }
}
```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
    return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" }
}
```
return text.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
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type '()' to expected argument type 'Bool'
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // '=' must have consistent whitespace on both sides
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // expression is not assignable: '&&' returns immutable value
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // expression is not assignable: '&&' returns immutable value
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // '=' must have consistent whitespace on both sides
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type 'String' to expected argument type 'Bool'
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert return expression of type '[String.Element]' (aka 'Array<Character>') to return type 'String'
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type 'String' to expected argument type 'Bool'
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type 'String' to expected argument type 'Bool'
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type 'String' to expected argument type 'Bool'
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type '()' to expected argument type 'Bool'
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // '=' must have consistent whitespace on both sides
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot assign through '!': '$0' is immutable
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type '()' to expected argument type 'Bool'
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // '=' must have consistent whitespace on both sides
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // expression is not assignable: '&&' returns immutable value
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // cannot convert value of type '()' to expected argument type 'Bool'
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // '=' must have consistent whitespace on both sides
return text.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" } // expression is not assignable: '&&' returns immutable value

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 {
    var result = ""
    for character in text.characters {
        if character.isVowel() {
            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 {
    var result = ""
    for character in text.characters {
        if character.isVowel() {
            continue
        }
        result.append(character)
    }
    return result
}
```
for character in text.characters { // 'characters' is unavailable: Please use String directly
if character.isVowel() { // value of type '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 {
    return l.reduce(true) { $0 && $1 < t }
}
```swift
// Return true if all numbers in the array l are below threshold t.
// belowThreshold(l: [1, 2, 4, 10], t: 100) == true
// belowThreshold(l: [1, 20, 4, 10], t: 5) == false
func belowThreshold(l: [Int], t: Int) -> Bool {
    return l.reduce(true) { $0 && $1 < t }
}
```

func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i >= t {
            return false
        }
    }
    return true
}
```swift
// Return true if all numbers in the array l are below threshold t.
// belowThreshold(l: [1, 2, 4, 10], t: 100) == true
// belowThreshold(l: [1, 20, 4, 10], t: 5) == false
func belowThreshold(l: [Int], t: Int) -> Bool {
    for i in l {
        if i >= t {
            return false
        }
    }
    return true
}
```

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 s0_chars = s0.characters
    var s1_chars = s1.characters
    var s0_chars_count = s0.characters.count
    var s1_chars_count = s1.characters.count
    var s0_chars_index = 0
    var s1_chars_index = 0
    var s0_char = s0_chars[s0_chars_index]
    var s1_char = s1_chars[s1_chars_index]
    while s0_chars_index < s0_chars_count && s1_chars_index < s1_chars_count {
        if s0_char!= s1_char {
            return false
        }
        s0_chars_index += 1
        s1_chars_index += 1
        s0_char = s0_chars[s0_chars_index]
        s1_char = s1_chars[s1_chars_index]
    }
    return s0_chars_index == s0_chars_count && s1_chars_index == s1_chars_count
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    var s0_chars = s0.characters
    var s1_chars = s1.characters
    var s0_chars_count = s0.characters.count
    var s1_chars_count = s1.characters.count
    var s0_chars_index = 0
    var s1_chars_index = 0
    var s0_char = s0_chars[s0_chars_index]
    var s1_char = s1_chars[s1_chars_index]
    while s0_chars_index < s0_chars_count && s1_chars_index < s1_chars_count {
        if s0_char!= s1_char {
            return false
        }
        s0_chars_index += 1
        s1_chars_index += 1
        s0_char = s0_chars[s0_chars_index]
        s1_char = s1_chars[s1_chars_index]
    }
    return s0_chars_index == s0_chars_count && s1_chars_index == s1_chars_count
}
```
var s0_chars = s0.characters // 'characters' is unavailable: Please use String directly
var s1_chars = s1.characters // 'characters' is unavailable: Please use String directly
var s0_chars_count = s0.characters.count // 'characters' is unavailable: Please use String directly
var s1_chars_count = s1.characters.count // 'characters' is unavailable: Please use String directly
var s0_char = s0_chars[s0_chars_index] // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
var s1_char = s1_chars[s1_chars_index] // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if s0_char!= s1_char { // use of '=' in a boolean context, did you mean '=='?
if s0_char!= s1_char { // '=' must have consistent whitespace on both sides
if s0_char!= s1_char { // cannot force unwrap value of non-optional type 'Character'
s0_char = s0_chars[s0_chars_index] // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
s1_char = s1_chars[s1_chars_index] // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

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

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

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 { // '=' 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 { // '=' must have consistent whitespace on both sides
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 { // 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'
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 '=='?
if s0[i0]!= s1[i1] { // cannot force unwrap value of non-optional type 'Character'
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
    var j = 0
    while i < s0.length && j < s1.length {
        if s0[i]!= s1[j] {
            return false
        }
        i += 1
        j += 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
    var j = 0
    while i < s0.length && j < s1.length {
        if s0[i]!= s1[j] {
            return false
        }
        i += 1
        j += 1
    }
    return true
}
```
while i < s0.length && j < s1.length { // value of type 'String' has no member 'length'
while i < s0.length && j < s1.length { // value of type 'String' has no member 'length'
if s0[i]!= s1[j] { // use of '=' in a boolean context, did you mean '=='?
if s0[i]!= s1[j] { // cannot force unwrap value of non-optional type 'Character'
if s0[i]!= s1[j] { // '=' must have consistent whitespace on both sides

func sameChars(s0: String, s1: String) -> Bool {
    let s0_arr = s0.characters.map { $0 }
    let s1_arr = s1.characters.map { $0 }
    let s0_set = Set(s0_arr)
    let s1_set = Set(s1_arr)
    return s0_set == s1_set
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    let s0_arr = s0.characters.map { $0 }
    let s1_arr = s1.characters.map { $0 }
    let s0_set = Set(s0_arr)
    let s1_set = Set(s1_arr)
    return s0_set == s1_set
}
```
let s0_arr = s0.characters.map { $0 } // 'characters' is unavailable: Please use String directly
let s1_arr = s1.characters.map { $0 } // 'characters' is unavailable: Please use String directly

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 {
    // TODO: Implement this function.
    return false
}
```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 {
    // TODO: Implement this function.
    return false
}
```
 // XCTAssertTrue failed

func sameChars(s0: String, s1: String) -> Bool {
    var s0_chars = s0.characters.map { $0 }
    var s1_chars = s1.characters.map { $0 }
    return s0_chars.isEqual(to: s1_chars)
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    var s0_chars = s0.characters.map { $0 }
    var s1_chars = s1.characters.map { $0 }
    return s0_chars.isEqual(to: s1_chars)
}
```
var s0_chars = s0.characters.map { $0 } // 'characters' is unavailable: Please use String directly
var s1_chars = s1.characters.map { $0 } // 'characters' is unavailable: Please use String directly
return s0_chars.isEqual(to: s1_chars) // value of type '[String.Element]' (aka 'Array<Character>') has no member 'isEqual'

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 || 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
    }
    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
    } else if n == 2 {
        return 1
    } else {
        return fib(n: n - 1) + fib(n: n - 2)
    }
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    if n == 1 {
        return 1
    } else if n == 2 {
        return 1
    } else {
        return fib(n: n - 1) + fib(n: n - 2)
    }
}
```

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 || 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 {
        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
    } else if n == 2 {
        return 1
    } else {
        return fib(n: n - 1) + fib(n: n - 2)
    }
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    if n == 1 {
        return 1
    } else if n == 2 {
        return 1
    } else {
        return fib(n: n - 1) + fib(n: n - 2)
    }
}
```

func fib(n: Int) -> Int {
    if n == 1 {
        return 1
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    if n == 1 {
        return 1
    }
    return fib(n: n - 1) + fib(n: n - 2)
}
```

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.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.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 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.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.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 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 isIncreasing = true
    for i in 1..<l.count {
        if l[i] < l[i-1] {
            isIncreasing = false
            break
        }
    }
    return isIncreasing
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    var isIncreasing = true
    for i in 1..<l.count {
        if l[i] < l[i-1] {
            isIncreasing = false
            break
        }
    }
    return isIncreasing
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    var i = 0
    var prev = l[0]
    while i < l.count {
        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 {
        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 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 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 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 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 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] = []
    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 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 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
    var common = [Int]()
    
    // Sort both arrays.
    l1.sort()
    l2.sort()
    
    // Iterate through both arrays.
    for i in 0..<l1.count {
        if l1[i] == l2[i] {
            common.append(l1[i])
        } else {
            break
        }
    }
    
    return common
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    var l1 = l1
    var l2 = l2
    var common = [Int]()
    
    // Sort both arrays.
    l1.sort()
    l2.sort()
    
    // Iterate through both arrays.
    for i in 0..<l1.count {
        if l1[i] == l2[i] {
            common.append(l1[i])
        } else {
            break
        }
    }
    
    return common
}
```
 // XCTAssertTrue failed

func common(l1: [Int], l2: [Int]) -> [Int] {
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    var result = [Int]()
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] == l2[j] {
            result.append(l1[i])
            i += 1
            j += 1
        } else if l1[i] < l2[j] {
            i += 1
        } else {
            j += 1
        }
    }
    return result
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    var result = [Int]()
    var i = 0
    var j = 0
    while i < l1.count && j < l2.count {
        if l1[i] == l2[j] {
            result.append(l1[i])
            i += 1
            j += 1
        } else if l1[i] < l2[j] {
            i += 1
        } else {
            j += 1
        }
    }
    return result
}
```

func common(l1: [Int], l2: [Int]) -> [Int] {
    var l1Set = Set(l1)
    var l2Set = Set(l2)
    var commonSet = Set<Int>()
    for i in l1Set.intersection(l2Set) {
        commonSet.insert(i)
    }
    return Array(commonSet)
}
```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 l1Set = Set(l1)
    var l2Set = Set(l2)
    var commonSet = Set<Int>()
    for i in l1Set.intersection(l2Set) {
        commonSet.insert(i)
    }
    return Array(commonSet)
}
```
var l1Set = Set(l1) // variable 'l1Set' was never mutated; consider changing to 'let' constant
var l2Set = Set(l2) // variable 'l2Set' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

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 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 me!
}
```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 me!
}
```
} // missing return in global function expected to return 'Int'

func largestPrimeFactor(n: Int) -> Int {
    var largest = 1
    var i = 2
    while i * i <= n {
        if n % i == 0 {
            n /= i
            largest = i
        } else {
            i += 1
        }
    }
    return largest * n
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var largest = 1
    var i = 2
    while i * i <= n {
        if n % i == 0 {
            n /= i
            largest = i
        } else {
            i += 1
        }
    }
    return largest * n
}
```
n /= i // left side of mutating operator isn't mutable: 'n' is a 'let' constant

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

func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```

func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```

func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```

func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    var sum = 0
    for i in 1...n {
        sum += i
    }
    return sum
}
```

func sumToN(n: Int) -> Int {
    var 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 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 correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for character in brackets.characters {
        if character == "(" {
            stack.append(character)
        } 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 character in brackets.characters {
        if character == "(" {
            stack.append(character)
        } else {
            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 {
        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 character in brackets {
        if character == "(" {
            stack.append(character)
        } else if character == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack: [Character] = []
    for character in brackets {
        if character == "(" {
            stack.append(character)
        } else if character == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

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

func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<xs.count {
        if i > 0 {
            result.append(xs[i] * i)
        } 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)
        } else {
            result.append(xs[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] * i)
        } 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)
        } else {
            result.append(xs[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] * Int(i))
        } 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] * Int(i))
        } else {
            result.append(xs[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 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
}
```
for i in 1..xs.count { // cannot find operator '..' in scope; did you mean '...'?

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 {
        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 - 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 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 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 {
    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 {
    // 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
    }
    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 {
    // 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 {
    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 {
    // TODO: Implement this function.
}
```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.
}
```
} // missing return in global function expected to return 'Int'

func vowelsCount(s: String) -> Int {
    var count = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            count += 1
        } else if c == "y" && s.count > 1 && s[s.count-1] == "y" {
            count += 1
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    var count = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            count += 1
        } else if c == "y" && s.count > 1 && s[s.count-1] == "y" {
            count += 1
        }
    }
    return count
}
```
} else 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 count = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            count += 1
        } else if c == "y" && s.count > 1 && s[s.count-1] == "y" {
            count += 1
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    var count = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            count += 1
        } else if c == "y" && s.count > 1 && s[s.count-1] == "y" {
            count += 1
        }
    }
    return count
}
```
} else 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 {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            count += 1
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    var count = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    var vowels = 0
    for c in s.unicodeScalars {
        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.unicodeScalars {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            vowels += 1
        }
    }
    return vowels
}
```
 // 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
        } else 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
        } else if c == "y" && s.count > 1 && s[s.count - 1] == "y" {
            vowels += 1
        }
    }
    return vowels
}
```
} else 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 {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            count += 1
        }
    }
    return count
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    var count = 0
    for c in s {
        if c == "a" || c == "e" || c == "i" || c == "o" || c == "u" {
            count += 1
        }
    }
    return count
}
```
 // 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 vowelsCount(s: String) -> Int {
    let vowels = "aeiouy"
    var vowelsCount = 0
    for letter in s {
        if vowels.contains(letter) {
            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 {
    let vowels = "aeiouy"
    var vowelsCount = 0
    for letter in s {
        if vowels.contains(letter) {
            vowelsCount += 1
        }
    }
    return vowelsCount
}
```
 // XCTAssertTrue failed

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let length = digits.characters.count
    let shiftCount = shift % length
    let reversed = digits.characters.reverse()
    let shifted = Array(reversed.prefix(length - shiftCount)) + Array(reversed.suffix(shiftCount))
    return String(shifted.reverse())
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let length = digits.characters.count
    let shiftCount = shift % length
    let reversed = digits.characters.reverse()
    let shifted = Array(reversed.prefix(length - shiftCount)) + Array(reversed.suffix(shiftCount))
    return String(shifted.reverse())
}
```
let length = digits.characters.count // 'characters' is unavailable: Please use String directly
let reversed = digits.characters.reverse() // value of type 'String' has no member 'reverse'

func circularShift(x: Int, shift: Int) -> String {
    let str = String(x)
    let len = str.characters.count
    let shiftCount = shift % len
    let reversed = str.characters.reverse()
    let shifted = Array(reversed.prefix(len - shiftCount)) + Array(reversed.suffix(shiftCount))
    return String(shifted.reverse())
}
```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 str = String(x)
    let len = str.characters.count
    let shiftCount = shift % len
    let reversed = str.characters.reverse()
    let shifted = Array(reversed.prefix(len - shiftCount)) + Array(reversed.suffix(shiftCount))
    return String(shifted.reverse())
}
```
let len = str.characters.count // 'characters' is unavailable: Please use String directly
let reversed = str.characters.reverse() // value of type 'String' has no member 'reverse'

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x)
    let reversed = digits.reversed()
    let shifted = reversed.prefix(shift) + reversed.suffix(reversed.count - shift)
    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.reversed()
    let shifted = reversed.prefix(shift) + reversed.suffix(reversed.count - shift)
    return shifted
}
```
return shifted // cannot convert return expression of type '[ReversedCollection<String>.Element]' (aka 'Array<Character>') to return type 'String'

func circularShift(x: Int, shift: Int) -> String {
    // TODO: Finish this function
}
```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
}
```
} // 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 shiftDigits = shift % xLength
    let xStringReversed = xString.characters.reverse().reduce("") { (result, character) -> String in
        return result + String(character)
    }
    let xStringShifted = xStringReversed.characters.dropFirst(shiftDigits).map { String($0) }.reduce("") { (result, character) -> String in
        return result + character
    }
    return xStringShifted.characters.reverse().reduce("") { (result, character) -> String in
        return result + String(character)
    }
}
```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 shiftDigits = shift % xLength
    let xStringReversed = xString.characters.reverse().reduce("") { (result, character) -> String in
        return result + String(character)
    }
    let xStringShifted = xStringReversed.characters.dropFirst(shiftDigits).map { String($0) }.reduce("") { (result, character) -> String in
        return result + character
    }
    return xStringShifted.characters.reverse().reduce("") { (result, character) -> String in
        return result + String(character)
    }
}
```
let xLength = xString.characters.count // 'characters' is unavailable: Please use String directly
let xStringReversed = xString.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
}
```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
}
```
} // missing return in global function expected to return 'String'

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

func circularShift(x: Int, shift: Int) -> String {
    // TODO: Implement this function.
    return ""
}
```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 this function.
    return ""
}
```
 // XCTAssertTrue failed

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 {
    var digits = String(x)
    var reversed = ""
    for i in digits.characters.reverse() {
        reversed.append(i)
    }
    if shift > digits.characters.count {
        return reversed
    }
    return digits.characters.slice(digits.startIndex, digits.startIndex + shift) +
        digits.characters.slice(digits.startIndex + shift, digits.endIndex)
}
```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)
    }
    if shift > digits.characters.count {
        return reversed
    }
    return digits.characters.slice(digits.startIndex, digits.startIndex + shift) +
        digits.characters.slice(digits.startIndex + shift, digits.endIndex)
}
```
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
return digits.characters.slice(digits.startIndex, digits.startIndex + shift) + // value of type 'String' has no member 'slice'
return digits.characters.slice(digits.startIndex, digits.startIndex + shift) + // binary operator '+' cannot be applied to operands of type 'String.Index' and 'Int'
digits.characters.slice(digits.startIndex + shift, digits.endIndex) // value of type 'String' has no member 'slice'

func digitSum(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII {
            sum += Int(c)
        }
    }
    return sum
}

func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isLowercase {
            sum += Int(c)
        }
    }
    return sum
}

func digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isUppercase {
            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
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 90
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 90
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isLowercase {
            sum += Int(c)
        }
    }
    return sum
}

// 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 digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isUppercase {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 90
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 90
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isLowercase {
            sum += Int(c)
        }
    }
    return sum
}

// 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 digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isUppercase {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 90
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 90
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isLowercase {
            sum += Int(c)
        }
    }
    return sum
}

// 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")
sum += Int(c) // no exact matches in call to initializer
if c.isASCII && c.isLowercase { // value of type 'Unicode.Scalar' has no member 'isLowercase'
sum += Int(c) // no exact matches in call to initializer
if c.isASCII && c.isUppercase { // value of type 'Unicode.Scalar' has no member 'isUppercase'
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
}

func digitSumLower(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
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 101
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 101
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s {
        if!c.isUpper {
            sum += Int(c.rawValue)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 101
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 101
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s {
        if!c.isUpper {
            sum += Int(c.rawValue)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 101
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 101
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s {
        if!c.isUpper {
            sum += Int(c.rawValue)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 101
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 101
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s {
        if!c.isUpper {
            sum += Int(c.rawValue)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 101
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 101
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s {
        if!c.isUpper {
            sum += Int(c.rawValue)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 101
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 101
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(
if c.isUpper { // value of type 'Character' has no member 'isUpper'
sum += Int(c.rawValue) // value of type 'Character' has no member 'rawValue'
if!c.isUpper { // expected expression, var, or let in 'if' condition

func digitSum(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII {
            sum += Int(c)
        }
    }
    return sum
}

func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII &&!c.isUpper {
            sum += Int(c)
        }
    }
    return sum
}

func digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && 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.isASCII {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower 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 digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII &&!c.isUpper {
            sum += Int(c)
        }
    }
    return sum
}

// 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 digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isUpper {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower 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 digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII &&!c.isUpper {
            sum += Int(c)
        }
    }
    return sum
}

// 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 digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isUpper {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower 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 digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII &&!c.isUpper {
            sum += Int(c)
        }
    }
    return sum
}

// 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
//
sum += Int(c) // no exact matches in call to initializer
if c.isASCII &&!c.isUpper { // expected '{' after 'if' condition
sum += Int(c) // no exact matches in call to initializer
if c.isASCII && 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
}

func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isLowercase {
            sum += Int(c)
        }
    }
    return sum
}

func digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isUppercase {
            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
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 91
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 91
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isLowercase {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 91
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 91
// digitSum(s: "aAaaaXa") == 153
func digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isUppercase {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 91
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 91
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isLowercase {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 91
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 91
// digitSum(s: "aAaaaXa") == 153
func digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isUppercase {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 91
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 91
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isLowercase {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 91
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE")
sum += Int(c) // no exact matches in call to initializer
if c.isASCII && c.isLowercase { // value of type 'Unicode.Scalar' has no member 'isLowercase'
sum += Int(c) // no exact matches in call to initializer
if c.isASCII && c.isUppercase { // value of type 'Unicode.Scalar' has no member 'isUppercase'
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
}

func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s {
        if!c.isUpper {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

func digitSumUpper(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
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 75
// digitSum(s: "abcCd") == 63
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 75
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s {
        if!c.isUpper {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 75
// digitSum(s: "abcCd") == 63
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 75
// digitSum(s: "aAaaaXa") == 153
func digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isUpper {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 75
// digitSum(s: "abcCd") == 63
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 75
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s {
        if!c.isUpper {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 75
// digitSum(s: "abcCd") == 63
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 75
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s {
        if!c.isUpper {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 75
// digitSum(s: "abcCd") == 63
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 75
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s {
        if!c.isUpper {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 75
// digitSum(s: "abcCd") == 63
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 75
// digitSum(
if c.isUpper { // value of type 'Character' has no member 'isUpper'
sum += Int(c.unicodeScalars.first!) // no exact matches in call to initializer
if!c.isUpper { // expected expression, var, or let in 'if' condition
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 {
        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.unicodeScalars {
        if c.isUpper() {
            sum += Int(c)
        }
    }
    return sum
}

func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isLower() {
            sum += Int(c)
        }
    }
    return sum
}

func digitSumUpper(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
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 103
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 103
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isLower() {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 103
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 103
// digitSum(s: "aAaaaXa") == 153
func digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isUpper() {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 103
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 103
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isLower() {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 103
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 103
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isLower() {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 103
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 103
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isLower() {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 103
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 103
// digitSum(s: "aAaaaXa") ==
if c.isUpper() { // value of type 'Unicode.Scalar' has no member 'isUpper'
sum += Int(c) // no exact matches in call to initializer
if c.isLower() { // value of type 'Unicode.Scalar' has no member 'isLower'
sum += Int(c) // no exact matches in call to initializer
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
}

func digitSum2(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isLower {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

func digitSum3(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isLower {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

func digitSum4(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isLower {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

func digitSum5(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isLower {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

func digitSum6(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isLower {
            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
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 121
// digitSum(s: "abcCd") == 65
// digitSum(s: "helloE") == 73
// digitSum(s: "woArBld") == 121
// digitSum(s: "aAaaaXa") == 153
func digitSum2(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isLower {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 121
// digitSum(s: "abcCd") == 65
// digitSum(s: "helloE") == 73
// digitSum(s: "woArBld") == 121
// digitSum(s: "aAaaaXa") == 153
func digitSum3(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isLower {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 121
// digitSum(s: "abcCd") == 65
// digitSum(s: "helloE") == 73
// digitSum(s: "woArBld") == 121
// digitSum(s: "aAaaaXa") == 153
func digitSum4(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isLower {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 121
// digitSum(s: "abcCd") == 65
// digitSum(s: "helloE") == 73
// digitSum(s: "woArBld") == 121
// digitSum(s: "aAaaaXa") == 153
func digitSum5(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isLower {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 121
// digitSum(s: "abcCd") == 65
// digitSum(s: "helloE") == 73
// digitSum(s: "woArBld") == 121
// digitSum(s: "aAaaaXa") == 153
func digitSum6(s: String) -> Int {
    var sum = 0
    for c in s {
        if c.isLower {
            sum += Int(c.unicodeScalars.first!)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 121
// digitSum(s: "abcCd") == 65
// digitSum(s: "helloE") == 73
// digitSum(s: "woArBld") == 121
// digitSum(s: "a
if c.isUpper { // value of type 'Character' has no member 'isUpper'
sum += Int(c.unicodeScalars.first!) // no exact matches in call to initializer
if c.isLower { // value of type 'Character' has no member 'isLower'
sum += Int(c.unicodeScalars.first!) // no exact matches in call to initializer
if c.isLower { // value of type 'Character' has no member 'isLower'
sum += Int(c.unicodeScalars.first!) // no exact matches in call to initializer
if c.isLower { // value of type 'Character' has no member 'isLower'
sum += Int(c.unicodeScalars.first!) // no exact matches in call to initializer
if c.isLower { // value of type 'Character' has no member 'isLower'
sum += Int(c.unicodeScalars.first!) // no exact matches in call to initializer
if c.isLower { // value of type 'Character' has no member 'isLower'
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 += 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 += Int(c)
        }
    }
    return sum
}

func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isLowercase {
            sum += Int(c)
        }
    }
    return sum
}

func digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isUppercase {
            sum += Int(c)
        }
    }
    return sum
}

func digitSumDigits(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isDecimalDigit() {
            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
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 61
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 65
// digitSum(s: "woArBld") == 61
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isLowercase {
            sum += Int(c)
        }
    }
    return sum
}

// 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 digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isUppercase {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the digits only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 0
// digitSum(s: "abcCd") == 0
// digitSum(s: "helloE") == 5
// digitSum(s: "woArBld") == 15
// digitSum(s: "aAaaaXa") == 15
func digitSumDigits(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isDecimalDigit() {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the lower characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 61
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 65
// digitSum(s: "woArBld") == 61
// digitSum(s: "aAaaaXa") == 153
func digitSumLower(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isLowercase {
            sum += Int(c)
        }
    }
    return sum
}

// 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 digitSumUpper(s: String) -> Int {
    var sum = 0
    for c in s.unicodeScalars {
        if c.isASCII && c.isUppercase {
            sum += Int(c)
        }
    }
    return sum
}

// Task
// Write a function that takes a string as input and returns the sum of the digits only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 0
// digitSum(s: "abcCd") == 0
// digitSum(s: "helloE
sum += Int(c) // no exact matches in call to initializer
if c.isASCII && c.isLowercase { // value of type 'Unicode.Scalar' has no member 'isLowercase'
sum += Int(c) // no exact matches in call to initializer
if c.isASCII && c.isUppercase { // value of type 'Unicode.Scalar' has no member 'isUppercase'
sum += Int(c) // no exact matches in call to initializer
if c.isASCII && c.isDecimalDigit() { // value of type 'Unicode.Scalar' has no member 'isDecimalDigit'
sum += Int(c) // 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 {
    // 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 {
    // 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 {
    // 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 {
    // TODO: implement me!
}
```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 me!
}
```
} // 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: Use the String.componentsSeparated(by:) method to split the string into an array of strings
    // Hint: Use the String.split(separator: String) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet) method to split the string into an array of strings
    // Hint: Use the String.split(separator: String, maxSplits: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxSplits: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: String, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: String, maxComponents: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: String, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: String, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(separator: CharacterSet, maxComponents: Int, limit: Int) method to split the string into an array of strings
    // Hint: Use the String.split(
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
}
```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
}
```
} // 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: Implement this method
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to split the string into an array of strings
    // Hint: Use the String.split(separator: String) -> [String] method
    // to
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 {
    // your code goes here
    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 {
    // your code goes here
    return 0
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    // Write your solution here
    let minEven = arr.reduce(Int.max) { (min, num) -> Int in
        if num % 2 == 0 && num < min {
            return num
        }
        return min
    }
    
    return arr.firstIndex(of: minEven)!= nil? [minEven, arr.firstIndex(of: minEven)?? 0] : []
}
```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
    let minEven = arr.reduce(Int.max) { (min, num) -> Int in
        if num % 2 == 0 && num < min {
            return num
        }
        return min
    }
    
    return arr.firstIndex(of: minEven)!= nil? [minEven, arr.firstIndex(of: minEven)?? 0] : []
}
```
return arr.firstIndex(of: minEven)!= nil? [minEven, arr.firstIndex(of: minEven)?? 0] : [] // expected expression
return arr.firstIndex(of: minEven)!= nil? [minEven, arr.firstIndex(of: minEven)?? 0] : [] // type of expression is ambiguous without a type annotation
return arr.firstIndex(of: minEven)!= nil? [minEven, arr.firstIndex(of: minEven)?? 0] : [] // '=' must have consistent whitespace on both sides
return arr.firstIndex(of: minEven)!= nil? [minEven, arr.firstIndex(of: minEven)?? 0] : [] // expected ',' separator
return arr.firstIndex(of: minEven)!= nil? [minEven, arr.firstIndex(of: minEven)?? 0] : [] // consecutive statements on a line must be separated by ';'

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 []
    }
    return [smallestEvenValue, smallestEvenValueIndex]
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    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 []
    }
    return [smallestEvenValue, smallestEvenValueIndex]
}
```

func pluck(arr: [Int]) -> [Int] {
    // Write your code here
    let sorted = arr.sorted()
    if sorted.count == 0 {
        return []
    }
    var index = 0
    for i in 0..<sorted.count {
        if sorted[i] % 2 == 0 {
            index = i
            break
        }
    }
    return [sorted[index], index]
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    // Write your code here
    let sorted = arr.sorted()
    if sorted.count == 0 {
        return []
    }
    var index = 0
    for i in 0..<sorted.count {
        if sorted[i] % 2 == 0 {
            index = i
            break
        }
    }
    return [sorted[index], index]
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    // Write your solution here
    var result: [Int] = []
    var minEvenValue: Int = Int.max
    var minEvenValueIndex: Int = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEvenValue {
            minEvenValue = value
            minEvenValueIndex = index
        }
    }
    if minEvenValue == Int.max {
        return result
    }
    result.append(minEvenValue)
    result.append(minEvenValueIndex)
    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 solution here
    var result: [Int] = []
    var minEvenValue: Int = Int.max
    var minEvenValueIndex: Int = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minEvenValue {
            minEvenValue = value
            minEvenValueIndex = index
        }
    }
    if minEvenValue == Int.max {
        return result
    }
    result.append(minEvenValue)
    result.append(minEvenValueIndex)
    return result
}
```

func pluck(arr: [Int]) -> [Int] {
    var min = Int.max
    var index = 0
    for (i, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            index = i
        }
    }
    return [min, index]
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    var min = Int.max
    var index = 0
    for (i, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            index = i
        }
    }
    return [min, index]
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    // Write your solution here
    var min = arr.first!
    var index = 0
    for (i, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            index = i
        }
    }
    return [min, index]
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    // Write your solution here
    var min = arr.first!
    var index = 0
    for (i, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            index = i
        }
    }
    return [min, index]
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    var min = Int.max
    var index = 0
    for (i, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            index = i
        }
    }
    return [min, index]
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    var min = Int.max
    var index = 0
    for (i, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            index = i
        }
    }
    return [min, index]
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    var result: [Int] = []
    var min: Int = Int.max
    var index: Int = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            result = [min, index]
        }
    }
    return result
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    var result: [Int] = []
    var min: Int = Int.max
    var index: Int = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            result = [min, index]
        }
    }
    return result
}
```
var index: Int = 0 // variable 'index' was never used; consider replacing with '_' or removing it

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

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

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

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

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

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

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

func search(lst: [Int]) -> Int {
    var max = -1
    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 = -1
    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 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 sorted = lst
    var min = sorted.first!
    var max = sorted.last!
    sorted.removeFirst()
    sorted.removeLast()
    while sorted.count > 0 {
        sorted.insert(max, atIndex: 0)
        sorted.insert(min, atIndex: sorted.count)
        min = sorted.first!
        max = sorted.last!
        sorted.removeFirst()
        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.insert(max, atIndex: 0)
        sorted.insert(min, atIndex: sorted.count)
        min = sorted.first!
        max = sorted.last!
        sorted.removeFirst()
        sorted.removeLast()
    }
    return sorted
}
```
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.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 result = [Int]()
    var sorted = lst.sorted()
    var i = 0
    while i < lst.count {
        result.append(sorted[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 sorted = lst.sorted()
    var i = 0
    while i < lst.count {
        result.append(sorted[i])
        i = i + 1
    }
    return result
}
```
var sorted = lst.sorted() // variable 'sorted' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    var sorted = lst
    var min = sorted.first!
    var max = sorted.last!
    sorted.removeFirst()
    sorted.removeLast()
    sorted.append(max)
    sorted.append(min)
    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()
    sorted.append(max)
    sorted.append(min)
    return sorted
}
```
var min = sorted.first! // variable 'min' was never mutated; consider changing to 'let' constant
var max = sorted.last! // variable 'max' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    var result = [Int]()
    var min = lst.first!
    var max = lst.last!
    
    for i in 0...lst.count-2 {
        result.append(lst[i])
    }
    
    for i in 0...lst.count-2 {
        if lst[i] == min {
            result.append(max)
            min = lst[i+1]
            max = lst[i+2]
        } else if lst[i] == max {
            result.append(min)
            min = lst[i+1]
            max = lst[i+2]
        }
    }
    
    result.append(max)
    
    return result
}
```swift
// Given array of integers, return array in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// strangeSortList(lst: [1, 2, 3, 4]) == [1, 4, 2, 3]
// strangeSortList(lst: [5, 5, 5, 5]) == [5, 5, 5, 5]
// strangeSortList(lst: [] as [Int]) == [] as [Int]
func strangeSortList(lst: [Int]) -> [Int] {
    var result = [Int]()
    var min = lst.first!
    var max = lst.last!
    
    for i in 0...lst.count-2 {
        result.append(lst[i])
    }
    
    for i in 0...lst.count-2 {
        if lst[i] == min {
            result.append(max)
            min = lst[i+1]
            max = lst[i+2]
        } else if lst[i] == max {
            result.append(min)
            min = lst[i+1]
            max = lst[i+2]
        }
    }
    
    result.append(max)
    
    return result
}
```
 // Fatal error: Index out of range

func strangeSortList(lst: [Int]) -> [Int] {
    var sorted = lst
    var min = sorted.minElement()!
    var max = sorted.maxElement()!
    var sorted = [min, max]
    for i in 1...sorted.count-1 {
        var min = sorted.minElement()!
        var max = sorted.maxElement()!
        sorted = [min, max]
    }
    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 sorted = [min, max]
    for i in 1...sorted.count-1 {
        var min = sorted.minElement()!
        var max = sorted.maxElement()!
        sorted = [min, max]
    }
    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'

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

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'

```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#Area_and_perimeter
    // https://en.wikipedia.org/wiki/Heron%27s_formula
    // https://en.wikipedia.org/wiki/Triangle_inequality
    // https://en.wikipedia.org/wiki/Triangle_inequality#Proof
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_trigonometry
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_Pythagorean_theorem
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_2
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_3
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_4
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_5
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_6
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_7
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_8
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_9
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_10
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_11
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_12
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_13
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_14
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_15
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_16
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_17
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_18
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_19
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_20
    // https://en.wikipedia.org/wiki/Heron%27s_formula#Proof_using_cosine_and_Pythagorean_theorem_
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 {
    // 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'

```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#Area_and_perimeter
    // https://en.wikipedia.org/wiki/Heron%27s_formula
    // https://en.wikipedia.org/wiki/Pythagorean_theorem
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https://en.wikipedia.org/wiki/Triple_product
    // https
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
    // Hint: Use the Heron's formula
    // https://en.wikipedia.org/wiki/Heron%27s_formula
    // https://en.wikipedia.org/wiki/Triangle#Area_and_perimeter
    // https://en.wikipedia.org/wiki/Triangle_inequality
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    // TODO: Implement this function
    // Hint: Use the Heron's formula
    // https://en.wikipedia.org/wiki/Heron%27s_formula
    // https://en.wikipedia.org/wiki/Triangle#Area_and_perimeter
    // https://en.wikipedia.org/wiki/Triangle_inequality
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    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 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 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))
    } 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 {
    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))
    } else {
        return -1
    }
}
```
return sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

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

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

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 'isBalanced'
return q.isBalanced() && q.sum() <= w // value of type '[Int]' has no member 'sum'

func willItFly(q: [Int], w: Int) -> Bool {
    // TODO: Implement this function
    return false
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    // TODO: Implement this function
    return false
}
```
 // XCTAssertTrue failed

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

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 {
    // 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 this function
    // Hint: Use a stack to store the elements
    // Hint: Use a queue to store the elements
    // Hint: Use a deque to store the elements
    // Hint: Use a priority queue to store the elements
    // Hint: Use a heap to store the elements
    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
    // Hint: Use a stack to store the elements
    // Hint: Use a queue to store the elements
    // Hint: Use a deque to store the elements
    // Hint: Use a priority queue to store the elements
    // Hint: Use a heap to store the elements
    return 0
}
```
 // XCTAssertTrue failed

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] {
    var result: [String] = []
    var count1 = 0
    var count2 = 0
    for item in lst1 {
        count1 += item.count
    }
    for item in lst2 {
        count2 += item.count
    }
    if count1 < count2 {
        result = lst1
    } else if count1 > count2 {
        result = lst2
    } else {
        result = lst1
    }
    return result
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result: [String] = []
    var count1 = 0
    var count2 = 0
    for item in lst1 {
        count1 += item.count
    }
    for item in lst2 {
        count2 += item.count
    }
    if count1 < count2 {
        result = lst1
    } else if count1 > count2 {
        result = lst2
    } else {
        result = lst1
    }
    return result
}
```

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    let lst1Count = lst1.reduce(0, combine: +)
    let lst2Count = lst2.reduce(0, combine: +)
    if lst1Count == lst2Count {
        return lst1
    } else if lst1Count < lst2Count {
        return lst1
    } else {
        return lst2
    }
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    let lst1Count = lst1.reduce(0, combine: +)
    let lst2Count = lst2.reduce(0, combine: +)
    if lst1Count == lst2Count {
        return lst1
    } else if lst1Count < lst2Count {
        return lst1
    } else {
        return lst2
    }
}
```
let lst1Count = lst1.reduce(0, combine: +) // extraneous argument label 'combine:' in call
let lst1Count = lst1.reduce(0, combine: +) // cannot convert value of type '(Int) -> Int' to expected argument type '(Int, String) throws -> Int'
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 item in lst1 {
        lst1Count += item.count
    }
    for item in lst2 {
        lst2Count += item.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 item in lst1 {
        lst1Count += item.count
    }
    for item in lst2 {
        lst2Count += item.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] = []
    for i in 0..<lst1.count {
        if lst1[i].count < lst2[i].count {
            result.append(lst1[i])
        } else if lst1[i].count == lst2[i].count {
            if lst1[i].count > lst2[i].count {
                result.append(lst2[i])
            } else {
                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])
        } else if lst1[i].count == lst2[i].count {
            if lst1[i].count > lst2[i].count {
                result.append(lst2[i])
            } else {
                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
            }
        }
    }
    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
            }
        }
    }
    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 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 lst1Count = 0
    var lst2Count = 0
    for item in lst1 {
        lst1Count += item.count
    }
    for item in lst2 {
        lst2Count += item.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 item in lst1 {
        lst1Count += item.count
    }
    for item in lst2 {
        lst2Count += item.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] = []
    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 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 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 {
    // 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 {
    // 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 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 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 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 {
    // 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 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 {
    // 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 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 Int(Int(a ** (1/3)).squareRoot) ** 3 == 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 ** (1/3)).squareRoot) ** 3 == a
}
```
return Int(Int(a ** (1/3)).squareRoot) ** 3 == a // no operator '**' is defined; did you mean 'pow(_:_:)'?
return Int(Int(a ** (1/3)).squareRoot) ** 3 == a // reference to member 'squareRoot' cannot be resolved without a contextual type
return Int(Int(a ** (1/3)).squareRoot) ** 3 == a // no operator '**' is defined; did you mean 'pow(_:_:)'?

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

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 {
    // 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 ** (1/3)).truncatingRemainder(dividingBy: 3)) == 0
}
```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 ** (1/3)).truncatingRemainder(dividingBy: 3)) == 0
}
```
return Int(Int(a ** (1/3)).truncatingRemainder(dividingBy: 3)) == 0 // no operator '**' is defined; did you mean 'pow(_:_:)'?
return Int(Int(a ** (1/3)).truncatingRemainder(dividingBy: 3)) == 0 // reference to member 'truncatingRemainder' cannot be resolved without a contextual type

func iscube(a: Int) -> Bool {
    return Int(Int(a ** (1/3)).truncatingRemainder(dividingBy: 3)) == 0
}
```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 ** (1/3)).truncatingRemainder(dividingBy: 3)) == 0
}
```
return Int(Int(a ** (1/3)).truncatingRemainder(dividingBy: 3)) == 0 // no operator '**' is defined; did you mean 'pow(_:_:)'?
return Int(Int(a ** (1/3)).truncatingRemainder(dividingBy: 3)) == 0 // reference to member 'truncatingRemainder' cannot be resolved without a contextual type

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 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 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 digit in num.unicodeScalars {
        if hexDigits.contains(digit) && isPrime(digit.value) {
            count += 1
        }
    }
    return count
}

func isPrime(num: Int) -> Bool {
    if num < 2 {
        return false
    }
    for i in 2..<num {
        if num % 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 {
    let hexDigits = "0123456789ABCDEF"
    var count = 0
    for digit in num.unicodeScalars {
        if hexDigits.contains(digit) && isPrime(digit.value) {
            count += 1
        }
    }
    return count
}

// You have been tasked to write a function that receives a number 
// and returns true if it is a prime number, false otherwise.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// Examples:
// isPrime(num: 2) == true
// isPrime(num: 3) == true
// isPrime(num: 4) == false
// isPrime(num: 5) == true
// isPrime(num: 6) == false
// isPrime(num: 7) == true
// isPrime(num: 8) == false
// isPrime(num: 9) == false
// isPrime(num: 10) == false
func isPrime(num: Int) -> Bool {
    if num < 2 {
        return false
    }
    for i in 2..<num {
        if num % i == 0 {
            return false
        }
    }
    return true
}
```
if hexDigits.contains(digit) && isPrime(digit.value) { // missing argument label 'num:' in call
if hexDigits.contains(digit) && isPrime(digit.value) { // instance method 'contains' requires that 'Unicode.Scalar' conform to 'StringProtocol'
if hexDigits.contains(digit) && isPrime(digit.value) { // cannot convert value of type 'UInt32' to expected argument type 'Int'

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 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 hexKey(num: String) -> Int {
    // Your code here
}
```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    // Your code here
}
```
} // missing return in global function expected to return 'Int'

func hexKey(num: String) -> Int {
    let hexDigits = "0123456789ABCDEF"
    var count = 0
    for digit in num {
        if hexDigits.contains(String(digit)) && isPrime(Int(digit)) {
            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 digit in num {
        if hexDigits.contains(String(digit)) && isPrime(Int(digit)) {
            count += 1
        }
    }
    return count
}

// You have been tasked to write a function that receives a string 
// and returns the number of vowels (a, e, i, o, u) in the string.
// Examples:
// vowelsCount(str: "Hello World") == 3
// vowelsCount(str: "AaBbCc") == 5
// vowelsCount(str: "aBc") == 2
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
// vowelsCount(str: "abracadabra") == 7
if hexDigits.contains(String(digit)) && isPrime(Int(digit)) { // cannot find 'isPrime' in scope
if hexDigits.contains(String(digit)) && isPrime(Int(digit)) { // no exact matches in call to initializer

func hexKey(num: String) -> Int {
    let hexDigits = "0123456789ABCDEF"
    var count = 0
    for digit in num.unicodeScalars {
        if hexDigits.contains(digit) && isPrime(digit.value) {
            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 digit in num.unicodeScalars {
        if hexDigits.contains(digit) && isPrime(digit.value) {
            count += 1
        }
    }
    return count
}
```
if hexDigits.contains(digit) && isPrime(digit.value) { // cannot find 'isPrime' in scope
if hexDigits.contains(digit) && isPrime(digit.value) { // instance method 'contains' requires that 'Unicode.Scalar' conform to 'StringProtocol'

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 digit in num.unicodeScalars {
        if hexDigits.contains(digit) && isPrime(digit.value) {
            count += 1
        }
    }
    return count
}

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

func isPalindrome(num: Int) -> Bool {
    let reversed = String(num).reversed().unicodeScalars.reduce("") { $0 + String($1) }
    return reversed == String(num)
}
```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 digit in num.unicodeScalars {
        if hexDigits.contains(digit) && isPrime(digit.value) {
            count += 1
        }
    }
    return count
}

// You have been tasked to write a function that receives a number 
// and determines if it is prime or not. 
// A prime number is a natural number greater than 1 that is not a 
// product of two smaller natural numbers.
// Examples:
// isPrime(num: 2) == true
// isPrime(num: 3) == true
// isPrime(num: 4) == false
// isPrime(num: 5) == true
// isPrime(num: 6) == false
// isPrime(num: 7) == true
// isPrime(num: 8) == false
// isPrime(num: 9) == false
// isPrime(num: 10) == false
func isPrime(num: Int) -> Bool {
    if num < 2 {
        return false
    }
    
    for i in 2..<num {
        if num % i == 0 {
            return false
        }
    }
    
    return true
}

// You have been tasked to write a function that receives a number 
// and determines if it is a palindrome or not. 
// A palindrome is a number that remains the same when its digits are reversed.
// Examples:
// isPalindrome(num: 121) == true
// isPalindrome(num: 1221) == true
// isPalindrome(num: 12321) == true
// isPalindrome(num: 1234321) == true
// isPalindrome(num: 12345) == false
// isPalindrome(num: 12321) == true
// isPalindrome(num: 1234) == false
// isPalindrome(num: 12) == true
// isPalindrome(num: 1) == true
// isPalindrome(num: 0) == true
func isPalindrome(num: Int) -> Bool {
    let reversed = String(num).reversed().unicodeScalars.reduce("") { $0 + String($1) }
    return reversed == String(num)
}

// You have been tasked to write a function that receives a number 
// and determines if it is a palindrome or not. 
// A palindrome is a number that remains the same when its digits are reversed.
// Examples:
// isPalindrome(num: 121) == true
// isPalindrome(num: 1221) == true
// isPalindrome(num: 12321) == true
// isPalindrome(num: 1234321) == true
// isPalindrome(num: 12345) == false
// isPalindrome(num: 12321) == true
// isPalindrome(num: 1234) == false
// isPalindrome(num: 12) == true
// isPalindrome(num: 1) == true
// isPalindrome(num: 0) == true
func isPalindrome(num: Int) -> Bool {
    let reversed = String(num).reversed().unicodeScalars.reduce("") { $0 + String($1) }
    return reversed == String(num)
}

// You have been tasked to write a function that receives a number 
// and determines if it is a palindrome or not. 
// A palindrome is a number that remains the same when its digits are reversed.
// Examples:
// isPalindrome(num: 121) == true
// isPalindrome(num: 1221) == true
// isPalindrome(num: 12321) == true
// isPalindrome(num: 1234321) == true
// isPalindrome(num: 12345) == false
// isPalindrome(num: 12321) == true
// isPalindrome(num: 1234) == false
// isPalindrome(num: 12) == true
// isPalindrome(num: 1) == true
// isPalindrome(num: 0) == true
func isPalindrome(num: Int) -> Bool {
    let reversed = String(num).reversed().unicodeScalars.reduce("") { $0 + String($1) }
    return reversed == String(num)
}

if hexDigits.contains(digit) && isPrime(digit.value) { // missing argument label 'num:' in call
if hexDigits.contains(digit) && isPrime(digit.value) { // instance method 'contains' requires that 'Unicode.Scalar' conform to 'StringProtocol'
if hexDigits.contains(digit) && isPrime(digit.value) { // cannot convert value of type 'UInt32' to expected argument type 'Int'
let reversed = String(num).reversed().unicodeScalars.reduce("") { $0 + String($1) } // reference to member 'unicodeScalars' cannot be resolved without a contextual type

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

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

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var remainder = 0
    var base = 1
    
    while decimal > 0 {
        remainder = decimal % 2
        binary = String(format: "%d", 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 = 0
    var base = 1
    
    while decimal > 0 {
        remainder = decimal % 2
        binary = String(format: "%d", 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 = ""
    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 = 0
    var quotient = 0
    
    quotient = decimal
    while quotient > 0 {
        remainder = quotient % 2
        quotient = quotient / 2
        binary = String(format: "%d", remainder) + binary
    }
    
    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 quotient = 0
    
    quotient = decimal
    while quotient > 0 {
        remainder = quotient % 2
        quotient = quotient / 2
        binary = String(format: "%d", remainder) + binary
    }
    
    return "db" + binary + "db"
}
```
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 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 decimal = decimal
    while decimal > 0 {
        let remainder = decimal % 2
        binary = String(remainder) + binary
        decimal = decimal / 2
    }
    return "db" + binary + "db"
}
```
 // XCTAssertTrue failed

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%c", (remainder == 0? "0" : "1"), (remainder == 0? "0" : "1")) + 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%c", (remainder == 0? "0" : "1"), (remainder == 0? "0" : "1")) + binary
        decimal = decimal / base
    }
    
    return "db" + binary + "db"
}
```
binary = String(format: "%c%c", (remainder == 0? "0" : "1"), (remainder == 0? "0" : "1")) + binary // argument type '(Bool, String)' does not conform to expected type 'CVarArg'
binary = String(format: "%c%c", (remainder == 0? "0" : "1"), (remainder == 0? "0" : "1")) + binary // argument type '(Bool, String)' does not conform to expected type 'CVarArg'
binary = String(format: "%c%c", (remainder == 0? "0" : "1"), (remainder == 0? "0" : "1")) + binary // cannot use optional chaining on non-optional value of type 'Int'
binary = String(format: "%c%c", (remainder == 0? "0" : "1"), (remainder == 0? "0" : "1")) + binary // expected ',' separator
binary = String(format: "%c%c", (remainder == 0? "0" : "1"), (remainder == 0? "0" : "1")) + binary // expected ',' separator
binary = String(format: "%c%c", (remainder == 0? "0" : "1"), (remainder == 0? "0" : "1")) + binary // cannot use optional chaining on non-optional value of type 'Int'

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 {
    let s = s.unicodeScalars.reduce(0, combine: { (sum, unicode) -> Int in
        return sum + Int(unicode)
    })
    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.unicodeScalars.reduce(0, combine: { (sum, unicode) -> Int in
        return sum + Int(unicode)
    })
    return s == 1
}
```
let s = s.unicodeScalars.reduce(0, combine: { (sum, unicode) -> Int in // extraneous argument label 'combine:' in call
return sum + Int(unicode) // no exact matches in call to initializer

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
}
```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 {
    // write your code here
    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 here
    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 {
    // write your code here
    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 here
    return false
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    return s.characters.reduce(0, combine: { (sum: Int, character: Character) -> Int in
        sum += Int(character)
    }) >= 3 && s.characters.reduce(0, combine: { (sum: Int, character: Character) -> Int in
        sum += Int(character)
    }) == s.characters.reduce(0, combine: { (sum: Int, character: Character) -> Int in
        sum += Int(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.characters.reduce(0, combine: { (sum: Int, character: Character) -> Int in
        sum += Int(character)
    }) >= 3 && s.characters.reduce(0, combine: { (sum: Int, character: Character) -> Int in
        sum += Int(character)
    }) == s.characters.reduce(0, combine: { (sum: Int, character: Character) -> Int in
        sum += Int(character)
    })
}
```
return s.characters.reduce(0, combine: { (sum: Int, character: Character) -> Int in // declared closure result 'Int' is incompatible with return type '()'
return s.characters.reduce(0, combine: { (sum: Int, character: Character) -> Int in // extraneous argument label 'combine:' in call
sum += Int(character) // no exact matches in call to initializer
}) >= 3 && s.characters.reduce(0, combine: { (sum: Int, character: Character) -> Int in // extraneous argument label 'combine:' in call
}) >= 3 && s.characters.reduce(0, combine: { (sum: Int, character: Character) -> Int in // declared closure result 'Int' is incompatible with return type '()'
sum += Int(character) // no exact matches in call to initializer
}) == s.characters.reduce(0, combine: { (sum: Int, character: Character) -> Int in // extraneous argument label 'combine:' in call
}) == s.characters.reduce(0, combine: { (sum: Int, character: Character) -> Int in // declared closure result 'Int' is incompatible with return type '()'
sum += Int(character) // no exact matches in call to initializer

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("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 {
            letterGrades.append("E")
        }
    }
    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 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
}
```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
}
```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 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 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: implement primeLength
}
```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 primeLength
}
```
} // 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: 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: 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: 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: 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 goes 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 goes 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 goes 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 goes here
}
```
} // missing return in global function expected to return 'Bool'

func startsOneEnds(n: Int) -> Int {
    // We'll use a sliding window to count the number of integers that start
    // or end with 1.
    var startOne = 0
    var endOne = 0
    for i in 1...n {
        // If the current digit is 1, we'll increment the counter for both
        // the start and end of the integer.
        if i == 1 {
            startOne += 1
            endOne += 1
        } else if i == n {
            endOne += 1
        } else {
            // If the current digit is not 1, we'll increment the counter
            // for the start of the integer.
            startOne += 1
        }
    }
    return startOne + endOne
}
```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 {
    // We'll use a sliding window to count the number of integers that start
    // or end with 1.
    var startOne = 0
    var endOne = 0
    for i in 1...n {
        // If the current digit is 1, we'll increment the counter for both
        // the start and end of the integer.
        if i == 1 {
            startOne += 1
            endOne += 1
        } else if i == n {
            endOne += 1
        } else {
            // If the current digit is not 1, we'll increment the counter
            // for the start of the integer.
            startOne += 1
        }
    }
    return startOne + endOne
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += pow(10, i-1)
    }
    return count
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += pow(10, i-1)
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += pow(10, i-1)
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += pow(10, i-1)
    }
    return count
}
```
count += pow(10, i-1) // cannot convert value of type 'Decimal' to expected argument type 'Int'

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

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

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

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

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

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

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

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

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

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

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

// 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)
}

 // XCTAssertTrue failed

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

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

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += n - i
    }
    return count
}
```
func startsOneEnds(n: Int) -> Int { // invalid redeclaration of 'startsOneEnds(n:)'

func startsOneEnds(n: Int) -> Int {
    return (1..<n).reduce(0) {
        $0 + $1 * (10 ^ ($1 - 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 {
    return (1..<n).reduce(0) {
        $0 + $1 * (10 ^ ($1 - 1))
    }
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    // The number of n-digit numbers that start with 1 is the same as the
    // number of n-digit numbers that end with 1.
    return startsOne(n) == endsOne(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 {
    // The number of n-digit numbers that start with 1 is the same as the
    // number of n-digit numbers that end with 1.
    return startsOne(n) == endsOne(n)
}
```
return startsOne(n) == endsOne(n) // cannot find 'endsOne' in scope
return startsOne(n) == endsOne(n) // cannot find 'startsOne' in scope
return startsOne(n) == endsOne(n) // cannot convert return expression of type 'Bool' to return type 'Int'

func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += pow(10, i - 1)
    }
    for i in 1...n {
        count += pow(10, i - 1)
    }
    return count
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += pow(10, i - 1)
    }
    for i in 1...n {
        count += pow(10, i - 1)
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += pow(10, i - 1)
    }
    for i in 1...n {
        count += pow(10, i - 1)
    }
    return count
}
```
count += pow(10, i - 1) // cannot convert value of type 'Decimal' to expected argument type 'Int'
count += pow(10, i - 1) // cannot convert value of type 'Decimal' to expected argument type 'Int'

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

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 {
    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 {
    var count = 0
    for i in 1...n {
        count += (n - i) * i
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += (n - i) * i
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += (n - i) * i
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += (n - i) * i
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += (n - i) * i
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += (n - i) * i
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += (n - i) * i
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += (n - i) * i
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += (n - i) * i
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += (n - i) * i
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += (n - i) * i
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count += (n - i) * i
    }
    return count
}

// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        count
func startsOneEnds(n: Int) -> Int { // invalid redeclaration of 'startsOneEnds(n:)'

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

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

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

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

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

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

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

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 {
        let digit = n % 2
        n = n / 2
        result = String(format: "%d%@", digit, result)
    }
    return result
}
```swift
// Given a positive integer N, return the total sum of its digits in binary.
// Example
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
// solve(N: 1000) == "1"
// solve(N: 150) == "110"
// solve(N: 147) == "1100"
func solve(N: Int) -> String {
    var result = ""
    var n = N
    while n > 0 {
        let digit = n % 2
        n = n / 2
        result = String(format: "%d%@", digit, result)
    }
    return result
}
```
 // 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 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 == 0 {
            sum += lst[i]
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 {
            sum += lst[i]
        }
    }
    return sum
}
```
 // XCTAssertTrue failed

func add(lst: [Int]) -> Int {
    var sum = 0
    for 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 (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 (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 == 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 {
    // 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 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 {
    return s.split(separator: " ").map { $0.sorted().joined() }.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 {
    return s.split(separator: " ").map { $0.sorted().joined() }.joined(separator: " ")
}
```
return s.split(separator: " ").map { $0.sorted().joined() }.joined(separator: " ") // referencing instance method 'joined(separator:)' on 'BidirectionalCollection' requires the types 'String.Element' (aka 'Character') and 'String' be equivalent

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 {
    // 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 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 antiShuffle(s: String) -> String {
    // Write your code here.
    return s.split(separator: " ").map {
        $0.sorted().reduce("") {
            partial, character in
            return partial + character
        }
    }.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.split(separator: " ").map {
        $0.sorted().reduce("") {
            partial, character in
            return partial + character
        }
    }.joined(separator: " ")
}
```
return partial + character // cannot convert value of type 'String.Element' (aka 'Character') to expected argument type 'String'

func antiShuffle(s: String) -> String {
    return s.split(separator: " ").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 {
    return s.split(separator: " ").map { $0.sorted().reduce("") { $0 + String($0.utf8.last!) } }.joined(separator: " ")
}
```
return s.split(separator: " ").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 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 maxRow = rows.maxElement()
    if maxRow == nil {
        return result
    }
    var maxRow = maxRow!
    var row = 0
    var col = 0
    for row in 0..<maxRow {
        for col in 0..<rows.count {
            if rows[col] == row + 1 {
                result.append((row, col))
                break
            }
        }
    }
    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 maxRow = rows.maxElement()
    if maxRow == nil {
        return result
    }
    var maxRow = maxRow!
    var row = 0
    var col = 0
    for row in 0..<maxRow {
        for col in 0..<rows.count {
            if rows[col] == row + 1 {
                result.append((row, col))
                break
            }
        }
    }
    return result
}
```
var maxRow = rows.maxElement() // value of type '[Int]' has no member 'maxElement'

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    var row = 0
    var col = 0
    var i = 0
    var j = 0
    var found = false
    
    while i < lst.count &&!found {
        var row = lst[i]
        
        while j < row.count &&!found {
            if row[j] == x {
                result.append((row.count - j - 1, i))
                found = true
            }
            j += 1
        }
        
        j = 0
        i += 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 row = 0
    var col = 0
    var i = 0
    var j = 0
    var found = false
    
    while i < lst.count &&!found {
        var row = lst[i]
        
        while j < row.count &&!found {
            if row[j] == x {
                result.append((row.count - j - 1, i))
                found = true
            }
            j += 1
        }
        
        j = 0
        i += 1
    }
    
    return result
}
```
var row = 0 // initialization of variable 'row' was never used; consider replacing with assignment to '_' or removing it
var col = 0 // initialization of variable 'col' was never used; consider replacing with assignment to '_' or removing it
var found = false // variable 'found' was written to, but never read
while i < lst.count &&!found { // expected '{' after 'while' condition
var row = lst[i] // variable 'row' was never mutated; consider changing to 'let' constant
while j < row.count &&!found { // expected '{' after 'while' condition

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    
    for (row, rowData) in lst.enumerate() {
        for (col, colData) in rowData.enumerate() {
            if colData == x {
                result.append((row, col))
            }
        }
    }
    
    return result.sorted()
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2)...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    
    for (row, rowData) in lst.enumerate() {
        for (col, colData) in rowData.enumerate() {
            if colData == x {
                result.append((row, col))
            }
        }
    }
    
    return result.sorted()
}
```
for (row, rowData) in lst.enumerate() { // value of type '[[Int]]' has no member 'enumerate'
return result.sorted() // type '(Int, Int)' cannot conform to 'Comparable'

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)] = []
    var rows: [Int] = []
    for row in lst {
        if row.count > 0 {
            rows.append(row.count)
        }
    }
    if rows.count == 0 {
        return result
    }
    var maxRow = rows.maxElement()!
    var minRow = rows.minElement()!
    var rowIndex = 0
    var colIndex = maxRow - 1
    var row = lst[rowIndex]
    while row.count > 0 {
        if row[colIndex] == x {
            result.append((rowIndex, colIndex))
        }
        if colIndex == 0 {
            rowIndex += 1
            colIndex = maxRow - 1
        } else {
            colIndex -= 1
        }
        row = lst[rowIndex]
    }
    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)
        }
    }
    if rows.count == 0 {
        return result
    }
    var maxRow = rows.maxElement()!
    var minRow = rows.minElement()!
    var rowIndex = 0
    var colIndex = maxRow - 1
    var row = lst[rowIndex]
    while row.count > 0 {
        if row[colIndex] == x {
            result.append((rowIndex, colIndex))
        }
        if colIndex == 0 {
            rowIndex += 1
            colIndex = maxRow - 1
        } else {
            colIndex -= 1
        }
        row = lst[rowIndex]
    }
    return result
}
```
var maxRow = rows.maxElement()! // value of type '[Int]' has no member 'maxElement'
var minRow = rows.minElement()! // value of type '[Int]' has no member 'minElement'

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)
            }
        }
    }
    
    var sortedRows: [Int] = rows.sorted()
    var sortedColumns: [Int] = columns.sorted()
    
    for index in 0..<sortedRows.count {
        result.append((sortedRows[index], sortedColumns[index]))
    }
    
    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)
            }
        }
    }
    
    var sortedRows: [Int] = rows.sorted()
    var sortedColumns: [Int] = columns.sorted()
    
    for index in 0..<sortedRows.count {
        result.append((sortedRows[index], sortedColumns[index]))
    }
    
    return result
}
```
var sortedRows: [Int] = rows.sorted() // variable 'sortedRows' was never mutated; consider changing to 'let' constant
var sortedColumns: [Int] = columns.sorted() // variable 'sortedColumns' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    
    for (rowIndex, row) in lst.enumerate() {
        for (columnIndex, column) in row.enumerate() {
            if column == x {
                result.append((rowIndex, columnIndex))
            }
        }
    }
    
    // Sort coordinates initially by rows in ascending order.
    result.sort { $0.0 < $1.0 }
    
    // Also, sort coordinates of the row by columns in descending order.
    for (rowIndex, _) in result.enumerate() {
        result[rowIndex].sort { $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 (rowIndex, row) in lst.enumerate() {
        for (columnIndex, column) in row.enumerate() {
            if column == x {
                result.append((rowIndex, columnIndex))
            }
        }
    }
    
    // Sort coordinates initially by rows in ascending order.
    result.sort { $0.0 < $1.0 }
    
    // Also, sort coordinates of the row by columns in descending order.
    for (rowIndex, _) in result.enumerate() {
        result[rowIndex].sort { $0.1 > $1.1 }
    }
    
    return result
}
```
for (rowIndex, row) in lst.enumerate() { // value of type '[[Int]]' has no member 'enumerate'
for (rowIndex, _) in result.enumerate() { // value of type '[(Int, Int)]' has no member 'enumerate'

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 maxRow = rows.maxElement()
    var minRow = rows.minElement()
    var rowIndex = 0
    for row in lst {
        if row.count > 0 {
            for index in row.indices {
                if row[index] == x {
                    result.append((rowIndex, index))
                }
            }
        }
        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 rows: [Int] = []
    for row in lst {
        if row.count > 0 {
            rows.append(row.count)
        }
    }
    var maxRow = rows.maxElement()
    var minRow = rows.minElement()
    var rowIndex = 0
    for row in lst {
        if row.count > 0 {
            for index in row.indices {
                if row[index] == x {
                    result.append((rowIndex, index))
                }
            }
        }
        rowIndex += 1
    }
    result.sort()
    return result
}
```
var maxRow = rows.maxElement() // value of type '[Int]' has no member 'maxElement'
var minRow = rows.minElement() // value of type '[Int]' has no member 'minElement'
result.sort() // type '(Int, Int)' cannot conform to 'Comparable'

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    var rows: [Int] = []
    for row in lst {
        if row.count == 0 {
            continue
        }
        var rowIndex = 0
        for index in 0..<row.count {
            if row[index] == x {
                result.append((rowIndex, index))
            }
            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 rows: [Int] = []
    for row in lst {
        if row.count == 0 {
            continue
        }
        var rowIndex = 0
        for index in 0..<row.count {
            if row[index] == x {
                result.append((rowIndex, index))
            }
            rowIndex += 1
        }
    }
    result.sort()
    return result
}
```
result.sort() // type '(Int, Int)' cannot conform to 'Comparable'

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

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
    
    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 first = sortedArray[0]
    var last = sortedArray[sortedArray.count - 1]
    var sum = first + last
    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 first = sortedArray[0]
    var last = sortedArray[sortedArray.count - 1]
    var sum = first + last
    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 sortedArrayLength = sortedArray.count
    var firstIndexValue = sortedArray[0]
    var lastIndexValue = sortedArray[sortedArrayLength - 1]
    var sum = firstIndexValue + lastIndexValue
    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 sortedArrayLength = sortedArray.count
    var firstIndexValue = sortedArray[0]
    var lastIndexValue = sortedArray[sortedArrayLength - 1]
    var sum = firstIndexValue + lastIndexValue
    if sum % 2 == 0 {
        sortedArray.sort()
    } else {
        sortedArray.sort()
        sortedArray.reverse()
    }
    return sortedArray
}
```
var sortedArrayLength = sortedArray.count // variable 'sortedArrayLength' was never mutated; consider changing to 'let' constant
var firstIndexValue = sortedArray[0] // variable 'firstIndexValue' was never mutated; consider changing to 'let' constant
var lastIndexValue = sortedArray[sortedArrayLength - 1] // variable 'lastIndexValue' was never mutated; consider changing to 'let' constant
var sum = firstIndexValue + lastIndexValue // 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 = sortedArray.count - 1
    var sum = sortedArray[firstIndex] + sortedArray[lastIndex]
    while firstIndex < lastIndex {
        if sum % 2 == 0 {
            sortedArray.swapAt(firstIndex, lastIndex)
            lastIndex -= 1
        } else {
            firstIndex += 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 = sortedArray.count - 1
    var sum = sortedArray[firstIndex] + sortedArray[lastIndex]
    while firstIndex < lastIndex {
        if sum % 2 == 0 {
            sortedArray.swapAt(firstIndex, lastIndex)
            lastIndex -= 1
        } else {
            firstIndex += 1
        }
        sum = sortedArray[firstIndex] + sortedArray[lastIndex]
    }
    return sortedArray
}
```
 // Fatal error: Index out of range

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
    
    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 start = 0
    var end = array.count - 1
    while start < end {
        if array[start] + array[end] % 2 == 0 {
            swap(&sortedArray, start, end)
            end -= 1
        } else {
            start += 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 start = 0
    var end = array.count - 1
    while start < end {
        if array[start] + array[end] % 2 == 0 {
            swap(&sortedArray, start, end)
            end -= 1
        } else {
            start += 1
        }
    }
    return sortedArray
}
```
swap(&sortedArray, start, end) // extra argument in call
swap(&sortedArray, start, end) // cannot convert value of type 'Int' to expected argument type '[Int]'

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 start = 0
    var end = array.count - 1
    var sum = sortedArray[start] + sortedArray[end]
    while start < end {
        if sum % 2 == 0 {
            sortedArray.swapAt(start, end)
            end -= 1
        } else {
            start += 1
        }
        sum = sortedArray[start] + sortedArray[end]
    }
    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 start = 0
    var end = array.count - 1
    var sum = sortedArray[start] + sortedArray[end]
    while start < end {
        if sum % 2 == 0 {
            sortedArray.swapAt(start, end)
            end -= 1
        } else {
            start += 1
        }
        sum = sortedArray[start] + sortedArray[end]
    }
    return sortedArray
}
```
 // Fatal error: Index out of range

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 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: Your code here
}

func decrypt(s: String) -> String {
    // TODO: Your code here
}

func encryptAndDecrypt(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 encryptAndDecrypt that takes a string as an argument
// and returns a string that is encrypted and then decrypted.
// For example:
// encryptAndDecrypt(s: "hi") == "hi"
// encryptAndDecrypt(s: "asdfghjkl") == "asdfghjkl"
// encryptAndDecrypt(s: "gf") == "gf"
// encryptAndDecrypt(s: "et") == "et"
func encryptAndDecrypt(s: String) -> String {
    // TODO: Your code here
}
```
} // missing return in global function expected to return 'String'
} // missing return in global function expected to return 'String'
} // missing return in global function expected to return 'String'

func encrypt(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
}
```
} // 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 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 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 {
    return ""
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    return ""
}
```
 // XCTAssertTrue failed

func 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[0]
    var secondSmallest = nil
    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? {
    var smallest = lst[0]
    var secondSmallest = nil
    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
}
```
var secondSmallest = nil // 'nil' requires a contextual type

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 { // cannot force unwrap value of non-optional type 'Int'
} 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 { // '=' 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
} else if lst[i] < secondSmallest && lst[i]!= smallest { // expression is not assignable: '&&' returns immutable value

func nextSmallest(lst: [Int]) -> Int? {
    var smallest = lst.first
    var secondSmallest = nil
    for i in 1...lst.count-1 {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest && secondSmallest!= nil {
            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-1 {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest && secondSmallest!= nil {
            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'
} else if lst[i] < secondSmallest && secondSmallest!= nil { // '=' must have consistent whitespace on both sides
} else if lst[i] < secondSmallest && secondSmallest!= nil { // 'nil' cannot be assigned to type 'Bool'
} else if lst[i] < secondSmallest && secondSmallest!= nil { // use of '=' in a boolean context, did you mean '=='?

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 { // cannot force unwrap value of non-optional type 'Int'
} 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 { // '=' 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
} else if lst[i] < secondSmallest && lst[i]!= smallest { // expression is not assignable: '&&' returns immutable value

func nextSmallest(lst: [Int]) -> Int? {
    var smallest = lst.first
    var secondSmallest = nil
    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? {
    var smallest = lst.first
    var secondSmallest = nil
    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
}
```
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 = 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 { // cannot force unwrap value of non-optional type 'Int'
} 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 { // '=' 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
} else if lst[i] < secondSmallest && lst[i]!= smallest { // expression is not assignable: '&&' returns immutable value

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?? Int.max {
            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?? Int.max {
            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?? Int.max { // cannot use optional chaining on non-optional value of type 'Int'
} else if lst[i] < secondSmallest?? Int.max { // expected '{' after 'if' condition
} else if lst[i] < secondSmallest?? Int.max { // 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 = 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 { // cannot force unwrap value of non-optional type 'Int'
} 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 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
} 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 isBored(S: String) -> Int {
    // TODO: Implement this function
}
```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 {
    // TODO: Implement this function
}
```
} // missing return in global function expected to return 'Int'

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

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 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 count = 0
    var 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
    var words = S.components(separatedBy: " ")
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```
var words = S.components(separatedBy: " ") // variable 'words' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    let words = S.components(separatedBy: " ")
    var boredomCount = 0
    for word in words {
        if word.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 {
    let words = S.components(separatedBy: " ")
    var boredomCount = 0
    for word in words {
        if word.hasPrefix("I") {
            boredomCount += 1
        }
    }
    return boredomCount
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var count = 0
    var 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
    var words = S.components(separatedBy: " ")
    for word in words {
        if word.hasPrefix("I") {
            count += 1
        }
    }
    return count
}
```
var words = S.components(separatedBy: " ") // variable 'words' was never mutated; consider changing to 'let' constant
 // 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 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 anyInt
    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 anyInt
    return false
}
```
 // 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 encode(message: String) -> String {
    var encoded = ""
    for character in message {
        if character.isVowel() {
            let index = message.distance(from: character, to: character.uppercase)
            encoded += String(message[index])
        } else {
            encoded += character.uppercase
        }
    }
    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.isVowel() {
            let index = message.distance(from: character, to: character.uppercase)
            encoded += String(message[index])
        } else {
            encoded += character.uppercase
        }
    }
    return encoded
}
```
if character.isVowel() { // value of type 'Character' has no member 'isVowel'
let index = message.distance(from: character, to: character.uppercase) // cannot convert value of type 'Character' to expected argument type 'String.Index'
let index = message.distance(from: character, to: character.uppercase) // value of type 'Character' has no member 'uppercase'
encoded += character.uppercase // value of type 'Character' has no member 'uppercase'

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 vowels = ["a", "e", "i", "o", "u"]
        if vowels.contains(char) {
            let index = vowels.index(of: char)!
            let nextChar = String(vowels[index+2])
            return nextChar
        } else {
            if char.isUppercase {
                return String(char.lowercased())
            } else {
                return String(char.uppercased())
            }
        }
    }.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 vowels = ["a", "e", "i", "o", "u"]
        if vowels.contains(char) {
            let index = vowels.index(of: char)!
            let nextChar = String(vowels[index+2])
            return nextChar
        } else {
            if char.isUppercase {
                return String(char.lowercased())
            } else {
                return String(char.uppercased())
            }
        }
    }.joined()
}
```
if char.isUppercase { // value of type 'String' has no member 'isUppercase'

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

func encode(message: String) -> String {
    return message.map {
        if $0.isVowel {
            let index = message.distance(from: $0, to: message.startIndex)
            return String(message[index+2])
        } else {
            return $0.uppercased()
        }
    }
}
```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 {
        if $0.isVowel {
            let index = message.distance(from: $0, to: message.startIndex)
            return String(message[index+2])
        } else {
            return $0.uppercased()
        }
    }
}
```
return message.map { // cannot convert return expression of type '[T]' to return type 'String'
if $0.isVowel { // value of type 'String.Element' (aka 'Character') has no member 'isVowel'

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 nextIndex = index + 2
            if nextIndex > vowels.count - 1 {
                nextIndex = 0
            }
            encoded += String(vowels[nextIndex])
        } else {
            encoded += String(character)
        }
    }
    return encoded
}

func decode(message: String) -> String {
    let vowels = "aeiou"
    var decoded = ""
    for character in message {
        if vowels.contains(String(character)) {
            let index = vowels.index(of: String(character))
            let nextIndex = index + 2
            if nextIndex > vowels.count - 1 {
                nextIndex = 0
            }
            decoded += String(vowels[nextIndex])
        } else {
            decoded += String(character)
        }
    }
    return decoded
}
```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 nextIndex = index + 2
            if nextIndex > vowels.count - 1 {
                nextIndex = 0
            }
            encoded += String(vowels[nextIndex])
        } else {
            encoded += String(character)
        }
    }
    return encoded
}

// Write a function that takes a message, and decodes 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 {
    let vowels = "aeiou"
    var decoded = ""
    for character in message {
        if vowels.contains(String(character)) {
            let index = vowels.index(of: String(character))
            let nextIndex = index + 2
            if nextIndex > vowels.count - 1 {
                nextIndex = 0
            }
            decoded += String(vowels[nextIndex])
        } else {
            decoded += String(character)
        }
    }
    return decoded
}
```
let index = vowels.index(of: String(character)) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')
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 {
    let vowels = "aeiou"
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    
    var encodedMessage = ""
    
    for character in message {
        if vowels.contains(character) {
            let index = alphabet.index(of: character)!
            let nextIndex = index + 2
            let nextCharacter = alphabet[nextIndex]
            encodedMessage.append(nextCharacter)
        } else {
            encodedMessage.append(character)
        }
    }
    
    return encodedMessage
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    let vowels = "aeiou"
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    
    var encodedMessage = ""
    
    for character in message {
        if vowels.contains(character) {
            let index = alphabet.index(of: character)!
            let nextIndex = index + 2
            let nextCharacter = alphabet[nextIndex]
            encodedMessage.append(nextCharacter)
        } else {
            encodedMessage.append(character)
        }
    }
    
    return encodedMessage
}
```
let index = alphabet.index(of: character)! // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
let nextIndex = index + 2 // cannot convert value of type 'String.Index' to expected argument type 'Int'

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 {
        if $0 == "a" || $0 == "e" || $0 == "i" || $0 == "o" || $0 == "u" {
            return String(message[message.index($0) + 2])
        } else {
            return String($0).lowercased()
        }
    }
}
```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 {
        if $0 == "a" || $0 == "e" || $0 == "i" || $0 == "o" || $0 == "u" {
            return String(message[message.index($0) + 2])
        } else {
            return String($0).lowercased()
        }
    }
}
```
return message.map { // cannot convert return expression of type '[String]' to return type 'String'
return String(message[message.index($0) + 2]) // cannot convert value of type 'String.Index?' to expected argument type 'Int'
return String(message[message.index($0) + 2]) // missing argument label 'of:' in call

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 {
    var max = lst.maxElement()!
    var maxPrime = 0
    for i in 0..<max {
        if isPrime(i) {
            maxPrime = i
        }
    }
    var sum = 0
    for i in 0..<maxPrime.digitCount() {
        sum += maxPrime % 10
        maxPrime /= 10
    }
    return sum
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    var max = lst.maxElement()!
    var maxPrime = 0
    for i in 0..<max {
        if isPrime(i) {
            maxPrime = i
        }
    }
    var sum = 0
    for i in 0..<maxPrime.digitCount() {
        sum += maxPrime % 10
        maxPrime /= 10
    }
    return sum
}
```
var max = lst.maxElement()! // value of type '[Int]' has no member 'maxElement'
for i in 0..<maxPrime.digitCount() { // value of type 'Int' has no member 'digitCount'

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 {
    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 {
    // 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.maxElement()!
    let maxPrime = primeFactors(max)
    let sum = maxPrime.reduce(0, combine: +)
    return sum
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    let max = lst.maxElement()!
    let maxPrime = primeFactors(max)
    let sum = maxPrime.reduce(0, combine: +)
    return sum
}

// 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 = primeFactors(max)
    let sum = maxPrime.reduce(0, combine: +)
    return sum
}

// 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 = primeFactors(max)
    let sum = maxPrime.reduce(0, combine: +)
    return sum
}

// 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: [
let max = lst.maxElement()! // value of type '[Int]' has no member 'maxElement'
let maxPrime = primeFactors(max) // cannot find 'primeFactors' in scope

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 {
    // Your code here.
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    // Your code here.
}
```
} // missing return in global function expected to return 'Int'

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
    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 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 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 result: [Int] = []
    var i = 2
    while i < n {
        if isPrime(i) {
            result.append(i)
        }
        i = i + 1
    }
    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] = []
    var i = 2
    while i < n {
        if isPrime(i) {
            result.append(i)
        }
        i = i + 1
    }
    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 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 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 1...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 1...n {
        if isPrime(i) {
            primes.append(i)
        }
    }
    return primes
}
```
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 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 {
    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 {
    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 {
    // Write your code here
    var result = 0
    var a = a
    var b = b
    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 {
    // Write your code here
    var result = 0
    var a = a
    var b = b
    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
    var a = a
    var b = b
    var result = 0
    
    while b > 0 {
        if b % 2 == 1 {
            result += a
        }
        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 b > 0 {
        if b % 2 == 1 {
            result += a
        }
        a = a << 1
        b = b >> 1
    }
    
    return result
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    // TODO: Implement this function
    
    // Your code here
    
    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
    
    // Your code here
    
    return 0
}
```
 // XCTAssertTrue failed

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'

```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.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use the built-in functions from Swift.
    // You can use
XCTAssertTrue(multiply(a: 148, b: 412) == 16) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 19, b: 28) == 72) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 2020, b: 1851) == 0) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 14, b: -15) == 20) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 76, b: 67) == 42) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 17, b: 27) == 49) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 0, b: 1) == 0) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 0, b: 0) == 0) // cannot find 'multiply' in scope

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

```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
    
    // 先把 a 和 b 的各位数字拿出来
    var a_unit_digits = a
    var b_unit_digits = b
    
    // 然后把 a 和 b 的各位数字拿出来
    var a_unit_digits_array = []
    var b_unit_digits_array = []
    
    while a_unit_digits > 0 {
        a_unit_digits_array.append(a_unit_digits % 10)
        a_unit_digits /= 10
    }
    
    while b_unit_digits > 0 {
        b_unit_digits_array.append(b_unit_digits % 10)
        b_unit_digits /= 10
    }
    
    // 然后把 a 和 b 的各位数字拿出来
    var a_unit_digits_array_reversed = []
    var b_unit_digits_array_reversed = []
    
    for i in a_unit_digits_array.reversed() {
        a_unit_digits_array_reversed.append(i)
    }
    
    for i in b_unit_digits_array.reversed() {
        b_unit_digits_array_reversed.append(i)
    }
    
    // 然后把 a 和 b 的各位数字拿出来
    var a_unit_digits_array_reversed_product = 1
    var b_unit_digits_array_reversed_product = 1
    
    for i in a_unit_digits_array_reversed {
        a_unit_digits_array_reversed_product *= i
    }
    
    for i in b_unit_digits_array_reversed {
        b_unit_digits_array_reversed_product *= i
    }
    
    // 然后把 a 和 b 的各位数字拿出来
    var a_unit_digits_array_reversed_product_array = []
    var b_unit_digits_array_reversed_product_array = []
    
    while a_unit_digits_array_reversed_product > 0 {
        a_unit_digits_array_reversed_product_array.append(a_unit_digits_array_reversed_product % 10)
        a_unit_digits_array_reversed_product /= 10
    }
    
    while b_unit_digits_array_reversed_product > 0 {
        b_unit_digits_array_reversed_product_array.append(b_unit_digits_array_reversed_product % 10)
        b_unit_digits_array_reversed_product /= 10
    }
    
    // 然后把 a 和 b 的各位数字拿出来
    var a_unit_digits_array_reversed_product_array_reversed = []
    var b_unit_digits_array_reversed_product_array_reversed = []
    
    for i in a_unit_digits_array_reversed_product_array.reversed() {
        a_unit_digits_array_reversed_product_array_reversed.append(i)
    }
    
    for i in b_unit_digits_array_reversed_product_array.reversed() {
        b_unit_digits_array_reversed_product_array_reversed.append(i)
    }
    
    // 然后把 a 和 b 的各位数字拿出来
    var a_unit_digits_array_reversed_product_array_reversed_product = 1
    var b_unit_digits_array_reversed_product_array_reversed_product = 1
    
    for i in a_unit_digits_array_reversed_product_array_reversed {
        a_unit_digits_array_reversed_product_array_reversed_product *= i
    }
    
    for i in b_unit_dig
XCTAssertTrue(multiply(a: 148, b: 412) == 16) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 19, b: 28) == 72) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 2020, b: 1851) == 0) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 14, b: -15) == 20) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 76, b: 67) == 42) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 17, b: 27) == 49) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 0, b: 1) == 0) // cannot find 'multiply' in scope
XCTAssertTrue(multiply(a: 0, b: 0) == 0) // cannot find 'multiply' in scope

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] == 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" { // '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.

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" { // '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.

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" { // '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.

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" { // '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.

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" { // '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.

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" { // '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.

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" { // '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.

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 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 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 closest 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: implement closest integer
}
```
} // 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 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 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 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 result = [Int]()
    var current = n
    while current > 0 {
        result.append(current)
        current = current.rotating(current)
    }
    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 current = n
    while current > 0 {
        result.append(current)
        current = current.rotating(current)
    }
    return result
}

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current > 0 {
        result.append(current)
        current = current.rotating(current)
    }
    return result
}

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current > 0 {
        result.append(current)
        current = current.rotating(current)
    }
    return result
}
```
current = current.rotating(current) // value of type 'Int' has no member 'rotating'

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current > 0 {
        result.append(current)
        current = current.isOdd? current + 1 : current + 2
    }
    return result
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current > 0 {
        result.append(current)
        current = current.isOdd? current + 1 : current + 2
    }
    return result
}
```
current = current.isOdd? current + 1 : current + 2 // expected expression
current = current.isOdd? current + 1 : current + 2 // type of expression is ambiguous without a type annotation
current = current.isOdd? current + 1 : current + 2 // result of operator '+' is unused
current = current.isOdd? current + 1 : current + 2 // consecutive statements on a line must be separated by ';'
current = current.isOdd? current + 1 : current + 2 // consecutive statements on a line must be separated by ';'

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]()
    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 = 1
    while i <= n {
        pile.append(i)
        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 {
        pile.append(i)
        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 i = 1
    while i <= n {
        pile.append(i)
        if i % 2 == 0 {
            i += 1
        } else {
            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 {
        pile.append(i)
        if i % 2 == 0 {
            i += 1
        } else {
            i += 2
        }
    }
    return pile
}
```
 // XCTAssertTrue failed

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 {
        pile.append(i)
        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)
        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] {
    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] {
    // TODO: Split the string into words and return an array of the words.
    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] {
    // TODO: Split the string into words and return an array of the words.
    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 {
    // 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
    } else {
        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
    if x % 2 == 0 && x <= y {
        result = x
    } else if y % 2 == 0 && x >= y {
        result = y
    } else {
        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 = -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 = -1
    for i in x...y {
        if i % 2 == 0 {
            max = i
        }
    }
    return max
}
```
 // Fatal error: Range requires lowerBound <= upperBound

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 max = 0
    var min = 0
    if x > y {
        max = x
        min = y
    } else {
        max = y
        min = x
    }
    
    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 {
    var max = 0
    var min = 0
    if x > y {
        max = x
        min = y
    } else {
        max = y
        min = x
    }
    
    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
}
```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 {
    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 max = -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 = -1
    for i in x...y {
        if i % 2 == 0 {
            max = i
        }
    }
    return max
}
```
 // Fatal error: Range requires lowerBound <= upperBound

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 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 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 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 binary = String(format: "%b", avg)
    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 binary = String(format: "%b", avg)
    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 = Int(avg.rounded())
    
    return.success(String(format: "%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: "%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 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'

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 average = (n + m) / 2
    let roundedAverage = Int(round(Double(average)))
    
    return.success(String(format: "0b%b", roundedAverage))
}
```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)))
    
    return.success(String(format: "0b%b", roundedAverage))
}
```
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 = Int(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 = Int(avg.rounded())
    let binary = String(format: "%b", roundedAvg)
    return.success(binary)
}
```
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 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'

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 % 10 == 0 {
                isEven = true
                break
            }
            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 /= 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 { // 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 { // '=' must have consistent whitespace on both sides
if i % 2!= 0 { // cannot force unwrap value of non-optional type '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
}
```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 { // 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 { // '=' must have consistent whitespace on both sides
if i % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'

func uniqueDigits(x: [Int]) -> [Int] {
    var result: [Int] = []
    for i in x {
        var temp: Int = i
        while temp > 0 {
            if temp % 10 == 0 || temp % 10 % 2 == 0 {
                temp = temp / 10
            } else {
                result.append(temp % 10)
                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 % 10 == 0 || temp % 10 % 2 == 0 {
                temp = temp / 10
            } else {
                result.append(temp % 10)
                temp = temp / 10
            }
        }
    }
    return result.sorted()
}
```
 // XCTAssertTrue failed

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

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

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

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    
    for i in 0..<arr.count {
        if arr[i] >= 1 && arr[i] <= 9 {
            result.append(String(format: "%@", namesOfDigits[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] {
    var result = [String]()
    
    for i in 0..<arr.count {
        if arr[i] >= 1 && arr[i] <= 9 {
            result.append(String(format: "%@", namesOfDigits[arr[i]]))
        }
    }
    
    return result.reversed()
}
```
result.append(String(format: "%@", namesOfDigits[arr[i]])) // cannot find 'namesOfDigits' in scope

func byLength(arr: [Int]) -> [String] {
    let sorted = arr.filter { $0 >= 1 && $0 <= 9 }.sorted()
    let reversed = sorted.reversed()
    let mapped = 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 mapped
}
```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 mapped = 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 mapped
}
```

func byLength(arr: [Int]) -> [String] {
    var result: [String] = []
    
    for i in arr {
        if i >= 1 && i <= 9 {
            result.append(String(i))
        }
    }
    
    result.sort()
    result.reverse()
    
    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] = []
    
    for i in arr {
        if i >= 1 && i <= 9 {
            result.append(String(i))
        }
    }
    
    result.sort()
    result.reverse()
    
    return result
}
```
 // XCTAssertTrue failed

func byLength(arr: [Int]) -> [String] {
    let sorted = arr.sorted()
    let filtered = sorted.filter { $0 >= 1 && $0 <= 9 }
    let reversed = filtered.reversed()
    return reversed.map { String(format: "%@", $0) }
}
```swift
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace each digit by its corresponding name from
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// If the array is empty, return an empty array:
// If the array has any strange number ignore it:
// byLength(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
// byLength(arr: [] as [Int]) == [] as [String]
// byLength(arr: [1, -1, 55]) == ["One"]
func byLength(arr: [Int]) -> [String] {
    let sorted = arr.sorted()
    let filtered = sorted.filter { $0 >= 1 && $0 <= 9 }
    let reversed = filtered.reversed()
    return reversed.map { String(format: "%@", $0) }
}
```

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()
    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()
    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()
    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 mapped = 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 mapped
}
```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 mapped = 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 mapped
}
```

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

func factorial(number: Int) -> Int {
    var result = 1
    for i in 1...number {
        result *= i
    }
    return result
}

func sum(number: Int, to number: Int) -> Int {
    var result = 0
    for i in number...to {
        result += i
    }
    return result
}
```swift
// Implement the function f that takes n as a parameter,
// and returns an array of size n, such that the value of the element at index i is the factorial of i if i is even
// or the sum of numbers from 1 to i otherwise.
// i starts from 1.
// the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 *... * i).
// Example:
// f(n: 5) == [1, 2, 6, 24, 15]
func f(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        if i % 2 == 0 {
            result.append(factorial(i))
        } else {
            result.append(sum(1...i))
        }
    }
    return result
}

func factorial(number: Int) -> Int {
    var result = 1
    for i in 1...number {
        result *= i
    }
    return result
}

func sum(number: Int, to number: Int) -> Int {
    var result = 0
    for i in number...to {
        result += i
    }
    return result
}
```
result.append(factorial(i)) // missing argument label 'number:' in call
result.append(sum(1...i)) // missing argument for parameter 'to' in call
result.append(sum(1...i)) // missing argument label 'number:' in call
result.append(sum(1...i)) // cannot convert value of type 'ClosedRange<Int>' to expected argument type 'Int'
func sum(number: Int, to number: Int) -> Int { // invalid redeclaration of 'number'
for i in number...to { // cannot find 'to' 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 this function
}
```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 this function
}
```
} // 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(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 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) {
    // 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 {
        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) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(n: Int) -> Bool {
    var reversed = 0
    var original = n
    while n > 0 {
        reversed = reversed * 10 + n % 10
        n = n / 10
    }
    return reversed == original
}
```swift
// Given a positive integer n, return a tuple that has the number of even and odd
// integer palindromes that fall within the range(1, n), inclusive.
// Example 1:
// Explanation:
// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
// Example 2:
// Explanation:
// Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
// Note:
// 1. 1 <= n <= 10^3
// 2. returned tuple has the number of even and odd integer palindromes respectively.
// evenOddPalindrome(n: 3) == (1, 2)
// evenOddPalindrome(n: 12) == (4, 6)
func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(n: Int) -> Bool {
    var reversed = 0
    var original = n
    while n > 0 {
        reversed = reversed * 10 + n % 10
        n = n / 10
    }
    return reversed == original
}
```
if isPalindrome(i) { // missing argument label 'n:' in call
n = n / 10 // cannot assign to value: 'n' is a 'let' constant

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) {
    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) {
    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) {
    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) {
    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) {
    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] { // '=' must have consistent whitespace on both sides
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] { // use of '=' in a boolean context, did you mean '=='?

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 {
        let sum = num.abs().digits().reduce(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 {
        let sum = num.abs().digits().reduce(0, +)
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
let sum = num.abs().digits().reduce(0, +) // value of type 'Int' has no member 'abs'

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        if num < 0 {
            num = -num
        }
        var sum = 0
        while num > 0 {
            sum += num % 10
            num /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        if num < 0 {
            num = -num
        }
        var sum = 0
        while num > 0 {
            sum += num % 10
            num /= 10
        }
        if sum > 0 {
            count += 1
        }
    }
    return count
}
```
num = -num // cannot assign to value: 'num' is a 'let' constant
num /= 10 // left side of mutating operator isn't mutable: 'num' is a 'let' constant

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) - 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 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 num in arr {
        let digits = num.abs().digits()
        if digits.reduce(0, +) > 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.reduce(0, +) > 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 {
        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 {
    // Write your code here
    if arr.count == 0 {
        return true
    }
    
    var count = 0
    var max = arr[0]
    for i in 0..<arr.count {
        if arr[i] > max {
            max = arr[i]
        }
    }
    
    for i in 0..<arr.count {
        if arr[i]!= max {
            count += 1
        }
    }
    
    if count == 0 {
        return true
    }
    
    return false
}
```swift
// We have an array 'arr' of N integers arr[1], arr[2],..., arr[N].The
// numbers in the array will be randomly ordered. Your task is to determine if
// it is possible to get an array sorted in non-decreasing order by performing 
// the following operation on the given array:
// You are allowed to perform right shift operation any number of times.
// One right shift operation means shifting all elements of the array by one
// position in the right direction. The last element of the array will be moved to
// the starting position in the array i.e. 0th index. 
// If it is possible to obtain the sorted array by performing the above operation
// then return true else return false.
// If the given array is empty then return true.
// Note: The given array is guaranteed to have unique elements.
// For Example:
// Explanation: By performin 2 right shift operations, non-decreasing order can
// be achieved for the given array.
// Explanation:It is not possible to get non-decreasing order for the given
// array by performing any number of right shift operations.
// moveOneBall(arr: [3, 4, 5, 1, 2]) == true
// moveOneBall(arr: [3, 5, 4, 1, 2]) == false
func moveOneBall(arr: [Int]) -> Bool {
    // Write your code here
    if arr.count == 0 {
        return true
    }
    
    var count = 0
    var max = arr[0]
    for i in 0..<arr.count {
        if arr[i] > max {
            max = arr[i]
        }
    }
    
    for i in 0..<arr.count {
        if arr[i]!= max {
            count += 1
        }
    }
    
    if count == 0 {
        return true
    }
    
    return false
}

// Write a function moveOneBall(arr: [Int]) -> Bool that takes an array of
// integers arr[1], arr[2],..., arr[N] as input and returns true 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 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 count = 0
    var max = arr[0]
    for i in 0..<arr.count {
        if arr[i] > max {
            max = arr[i]
        }
    }
    
    for i in 0..<arr.count {
        if arr[i]!= max {
            count += 1
        }
    }
    
    if count == 0 {
        return true
    }
    
    return false
}

// Write a function moveOneBall(arr: [Int]) -> Bool that takes an array of
// integers arr[1], arr[2],..., arr[N] as input and returns true 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 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 count = 0
    var max = arr[0]
    for i in 0..<arr.count {
        if arr[i] > max {
            max = arr[i]
        }
    }
    
    for i in 0..<arr.count {
        if arr[i]!= max {
            count += 1
        }
    }
    
    if count == 0 {
        return true
    }
    
    return false
}

// Write a function moveOneBall
if arr[i]!= max { // cannot force unwrap value of non-optional type 'Int'
if arr[i]!= max { // use of '=' in a boolean context, did you mean '=='?
if arr[i]!= max { // '=' must have consistent whitespace on both sides

func moveOneBall(arr: [Int]) -> Bool {
    // Write your code here
    // return true if the array is sorted in non-decreasing order
    // return false otherwise
    
    // check if the array is empty
    if arr.count == 0 {
        return true
    }
    
    // check if the array is sorted in non-decreasing order
    for i in 0..<arr.count-1 {
        if arr[i] > arr[i+1] {
            return false
        }
    }
    
    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
    // return true if the array is sorted in non-decreasing order
    // return false otherwise
    
    // check if the array is empty
    if arr.count == 0 {
        return true
    }
    
    // check if the array is sorted in non-decreasing order
    for i in 0..<arr.count-1 {
        if arr[i] > arr[i+1] {
            return false
        }
    }
    
    return true
}
```
 // XCTAssertTrue failed

func moveOneBall(arr: [Int]) -> Bool {
    // Write your code here
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] > arr[j] {
            swap(&arr[i], &arr[j])
            i += 1
            j -= 1
        } else {
            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
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] > arr[j] {
            swap(&arr[i], &arr[j])
            i += 1
            j -= 1
        } else {
            i += 1
        }
    }
    return true
}
```
swap(&arr[i], &arr[j]) // cannot pass immutable value as inout argument: 'arr' is a 'let' constant
swap(&arr[i], &arr[j]) // cannot pass immutable value as inout argument: 'arr' is a 'let' constant

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
    if arr.count == 0 {
        return true
    }
    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
    if arr.count == 0 {
        return true
    }
    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 max = arr[0]
    var min = arr[0]
    
    for i in 1..<arr.count {
        if arr[i] > max {
            max = arr[i]
        }
        if arr[i] < min {
            min = arr[i]
        }
    }
    
    if max == min {
        return true
    }
    
    if max - min == 1 {
        return true
    }
    
    return false
}
```swift
// We have an array 'arr' of N integers arr[1], arr[2],..., arr[N].The
// numbers in the array will be randomly ordered. Your task is to determine if
// it is possible to get an array sorted in non-decreasing order by performing 
// the following operation on the given array:
// You are allowed to perform right shift operation any number of times.
// One right shift operation means shifting all elements of the array by one
// position in the right direction. The last element of the array will be moved to
// the starting position in the array i.e. 0th index. 
// If it is possible to obtain the sorted array by performing the above operation
// then return true else return false.
// If the given array is empty then return true.
// Note: The given array is guaranteed to have unique elements.
// For Example:
// Explanation: By performin 2 right shift operations, non-decreasing order can
// be achieved for the given array.
// Explanation:It is not possible to get non-decreasing order for the given
// array by performing any number of right shift operations.
// moveOneBall(arr: [3, 4, 5, 1, 2]) == true
// moveOneBall(arr: [3, 5, 4, 1, 2]) == false
func moveOneBall(arr: [Int]) -> Bool {
    // Write your code here
    if arr.count == 0 {
        return true
    }
    
    var max = arr[0]
    var min = arr[0]
    
    for i in 1..<arr.count {
        if arr[i] > max {
            max = arr[i]
        }
        if arr[i] < min {
            min = arr[i]
        }
    }
    
    if max == min {
        return true
    }
    
    if max - min == 1 {
        return true
    }
    
    return false
}
```
 // 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
    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
    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 {
    // 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 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
}
```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" or "NO"
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    // TODO: implement this function
    // return "YES" or "NO"
}
```
} // missing return in global function expected to return 'String'

```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 a number is even:
    // isEven(number: Int) -> Bool
    // You can use the following function to check if a number is odd:
    // isOdd(number: Int) -> Bool
    // You can use the following function to check if two numbers are equal:
    // areEqual(number1: Int, number2: Int) -> Bool
    // You can use the following function to check if two numbers are not equal:
    // areNotEqual(number1: Int, number2: Int) -> Bool
    // You can use the following function to check if a number is greater than
    // another number:
    // isGreater(number1: Int, number2: Int) -> Bool
    // You can use the following function to check if a number is less than
    // another number:
    // isLess(number1: Int, number2: Int) -> Bool
    // You can use the following function to check if a number is greater than
    // or equal to another number:
    // isGreaterOrEqual(number1: Int, number2: Int) -> Bool
    // You can use the following function to check if a number is less than
    // or equal to another number:
    // isLessOrEqual(number1: Int, number2: Int) -> Bool
    // You can use the following function to check if a number is in a given
    // range:
    // isInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is not in a given
    // range:
    // isNotInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is in a given
    // range:
    // isInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is not in a given
    // range:
    // isNotInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is in a given
    // range:
    // isInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is not in a given
    // range:
    // isNotInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is in a given
    // range:
    // isInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is not in a given
    // range:
    // isNotInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is in a given
    // range:
    // isInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is not in a given
    // range:
    // isNotInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is in a given
    // range:
    // isInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is not in a given
    // range:
    // isNotInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is in a given
    // range:
    // isInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is not in a given
    // range:
    // isNotInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is in a given
    // range:
    // isInRange(number: Int, min: Int, max: Int) -> Bool
    // You can use the following function to check if a number is not in a given
    // range:
    // isNotInRange(number: Int
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 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'

```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: You can use the built-in function "map" to transform an array
    // into another array.
    // For example:
    // let lst = [1, 2, 3, 4]
    // let lst2 = lst.map { $0 * 2 }
    // print(lst2) // [2, 4, 6, 8]
    // You can also use the built-in function "filter" to filter an array.
    // For example:
    // let lst = [1, 2, 3, 4]
    // let lst2 = lst.filter { $0 % 2 == 0 }
    // print(lst2) // [2, 4]
    // You can use the built-in function "reduce" to reduce an array to a single value.
    // For example:
    // let lst = [1, 2, 3, 4]
    // let sum = lst.reduce(0) { $0 + $1 }
    // print(sum) // 10
    // You can use the built-in function "contains" to determine whether an array contains a specific value.
    // For example:
    // let lst = [1, 2, 3, 4]
    // print(lst.contains(2)) // true
    // print(lst.contains(5)) // false
    // You can use the built-in function "append" to append an element to an array.
    // For example:
    // let lst = [1, 2, 3, 4]
    // let lst2 = lst.append(5)
    // print(lst2) // [1, 2, 3, 4, 5]
    // You can use the built-in function "removeAll" to remove all elements from an array.
    // For example:
    // let lst = [1, 2, 3, 4]
    // let lst2 = lst.removeAll()
    // print(lst2) // []
    // You can use the built-in function "removeFirst" to remove the first element from an array.
    // For example:
    // let lst = [1, 2, 3, 4]
    // let lst2 = lst.removeFirst()
    // print(lst2) // [2, 3, 4]
    // You can use the built-in function "removeLast" to remove the last element from an array.
    // For example:
    // let lst = [1, 2, 3, 4]
    // let lst2 = lst.removeLast()
    // print(lst2) // [1, 2, 3]
    // You can use the built-in function "insert" to insert an element to an array.
    // For example:
    // let lst = [1, 2, 3, 4]
    // let lst2 = lst.insert(5, at: 0)
    // print(lst2) // [5, 1, 2, 3, 4]
    // You can use the built-in function "insert" to insert an element to an array.
    // For example:
    // let lst = [1, 2, 3, 4]
    // let lst2 = lst.insert(5, at: 0)
    // print(lst2) // [5, 1, 2, 3, 4]
    // You can use the built-in function "insert" to insert an element to an array.
    // For example:
    // let lst = [1, 2, 3, 4]
    // let lst2 = lst.insert(5, at: 0)
    // print(lst2) // [5, 1, 2, 3, 4]
    // You can use the built-in function "insert" to insert an element to an array.
    // For example:
    // let lst = [1, 2, 3, 4]
    // let lst2 = lst.insert(5, at: 0)
    // print(lst2) // [5, 1, 2, 3, 4]
    // You can use the built-in function "insert" to insert an element to an array.
    // For example:
    // let lst = [1, 2, 3, 4]
    // let lst2 = lst.insert(5, at: 0)
    // print(lst2) // [5,
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
    // You can use the following function to check if an element is even:
    // isEven(number: Int) -> Bool
    // You can use the following function to check if an element is odd:
    // isOdd(number: Int) -> Bool
    // You can use the following function to check if two arrays are equal:
    // areEqual(arr1: [Int], arr2: [Int]) -> Bool
    // You can use the following function to check if an array contains an element:
    // contains(arr: [Int], element: Int) -> Bool
    // You can use the following function to check if an array contains only even numbers:
    // containsOnlyEven(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only odd numbers:
    // containsOnlyOdd(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers:
    // containsOnlyNumbers(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only unique numbers:
    // containsOnlyUnique(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 9:
    // containsOnlyNumbersBetween0and9(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 99:
    // containsOnlyNumbersBetween0and99(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 999:
    // containsOnlyNumbersBetween0and999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 9999:
    // containsOnlyNumbersBetween0and9999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 99999:
    // containsOnlyNumbersBetween0and99999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 999999:
    // containsOnlyNumbersBetween0and999999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 9999999:
    // containsOnlyNumbersBetween0and9999999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 99999999:
    // containsOnlyNumbersBetween0and99999999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 999999999:
    // containsOnlyNumbersBetween0and999999999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 9999999999:
    // containsOnlyNumbersBetween0and9999999999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 99999999999:
    // containsOnlyNumbersBetween0and99999999999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 999999999999:
    // containsOnlyNumbersBetween0and999999999999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 9999999999999:
    // containsOnlyNumbersBetween0and9999999999999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 99999999999999:
    // containsOnlyNumbersBetween0and99999999999999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 999999999999999:
    // containsOnlyNumbersBetween0and999999999999999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 9999999999999999:
    // containsOnlyNumbersBetween0and9999999999999999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 99999999999999999:
    // containsOnlyNumbersBetween0and99999999999999999(arr: [Int]) -> Bool
    // You can use the following function to check if an array contains only numbers between 0 and 999999999999999999:
    // containsOnly
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 this function
    return "YES"
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    // TODO: implement this function
    return "YES"
}
```
 // XCTAssertTrue failed

func exchange(lst1: [Int], lst2: [Int]) -> String {
    // TODO: implement this function
    return "YES"
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    // TODO: implement this function
    return "YES"
}
```
 // XCTAssertTrue failed

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 histogram(test: String) -> [String : Int] {
    var histogram: [String: Int] = [:]
    var letters: [Character] = test.characters.split(separator: " ").map(String.init)
    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: [Character] = test.characters.split(separator: " ").map(String.init)
    for letter in letters {
        if let count = histogram[letter] {
            histogram[letter] = count + 1
        } else {
            histogram[letter] = 1
        }
    }
    return histogram
}
```
var letters: [Character] = test.characters.split(separator: " ").map(String.init) // no exact matches in call to instance method 'map'
if let count = histogram[letter] { // cannot convert value of type 'Character' to expected argument type 'String'
histogram[letter] = count + 1 // cannot convert value of type 'Character' to expected argument type 'String'
histogram[letter] = 1 // cannot convert value of type 'Character' 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 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 histogram(test: String) -> [String : Int] {
    var histogram: [String: Int] = [:]
    var letters: [String] = test.split(separator: " ").map { $0 }
    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 }
    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 } // cannot convert value of type 'String.SubSequence' (aka 'Substring') to closure result type 'String'

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 result = [String: Int]()
    var testArray = test.components(separatedBy: " ")
    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.components(separatedBy: " ")
    for letter in testArray {
        if let count = result[letter] {
            result[letter] = count + 1
        } else {
            result[letter] = 1
        }
    }
    return result
}
```
var testArray = test.components(separatedBy: " ") // variable 'testArray' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

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] = [:]
    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 result = [String: Int]()
    
    for character in test {
        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 {
        if let count = result[String(character)] {
            result[String(character)] = count + 1
        } else {
            result[String(character)] = 1
        }
    }
    
    return result
}
```
 // XCTAssertTrue failed

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] { // cannot force unwrap value of non-optional type 'Character'
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
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
    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) {
    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 { // 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'

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for i in c.characters.enumerated() {
        if s.contains(String(i.element)) {
            result = result.replacingOccurrences(of: String(i.element), with: "")
        }
    }
    return (result, isPalindrome(result))
}

func isPalindrome(s: String) -> Bool {
    let 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 s.contains(String(i.element)) {
            result = result.replacingOccurrences(of: String(i.element), with: "")
        }
    }
    return (result, isPalindrome(result))
}

// isPalindrome
// Given a string s, return true if the s is palindrome.
// Example
// isPalindrome(s: "abccba") == true
// isPalindrome(s: "abcd") == false
func isPalindrome(s: String) -> Bool {
    let s = s.reversed()
    return s == s.reversed()
}
```
for i in c.characters.enumerated() { // 'characters' is unavailable: Please use String directly
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) {
    // Write your code here
    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) {
    // Write your code here
    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] { // cannot force unwrap value of non-optional type 'Character'
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
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 = ""
    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] { // cannot force unwrap value of non-optional type 'Character'
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
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) {
    let sArray = s.split(separator: "")
    let cArray = c.split(separator: "")
    var result = ""
    for i in 0..<sArray.count {
        if sArray[i]!= cArray[i] {
            result.append(sArray[i])
        }
    }
    return (result, isPalindrome(s: result))
}

func isPalindrome(s: String) -> Bool {
    let sArray = s.split(separator: "")
    for i in 0..<sArray.count/2 {
        if sArray[i]!= sArray[sArray.count-1-i] {
            return false
        }
    }
    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) {
    let sArray = s.split(separator: "")
    let cArray = c.split(separator: "")
    var result = ""
    for i in 0..<sArray.count {
        if sArray[i]!= cArray[i] {
            result.append(sArray[i])
        }
    }
    return (result, isPalindrome(s: result))
}

// isPalindrome
// Given a string s, return true if the s is palindrome
// Example
// isPalindrome(s: "abcdcba") == true
// isPalindrome(s: "abcd") == false
func isPalindrome(s: String) -> Bool {
    let sArray = s.split(separator: "")
    for i in 0..<sArray.count/2 {
        if sArray[i]!= sArray[sArray.count-1-i] {
            return false
        }
    }
    return true
}
```
if sArray[i]!= cArray[i] { // use of '=' in a boolean context, did you mean '=='?
if sArray[i]!= cArray[i] { // '=' must have consistent whitespace on both sides
if sArray[i]!= cArray[i] { // cannot force unwrap value of non-optional type 'String.SubSequence' (aka 'Substring')
result.append(sArray[i]) // no exact matches in call to instance method 'append'
if sArray[i]!= sArray[sArray.count-1-i] { // '=' must have consistent whitespace on both sides
if sArray[i]!= sArray[sArray.count-1-i] { // use of '=' in a boolean context, did you mean '=='?
if sArray[i]!= sArray[sArray.count-1-i] { // cannot force unwrap value of non-optional type 'String.SubSequence' (aka 'Substring')

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

func isPalindrome(s: String) -> Bool {
    var result = s
    for i in s.characters.indices {
        result = result.replacingOccurrences(of: String(s[i]), with: "")
    }
    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.indices {
        result = result.replacingOccurrences(of: String(c[i]), with: "")
    }
    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: "abccba") == true
// isPalindrome(s: "abcd") == false
func isPalindrome(s: String) -> Bool {
    var result = s
    for i in s.characters.indices {
        result = result.replacingOccurrences(of: String(s[i]), with: "")
    }
    return result == ""
}
```
for i in c.characters.indices { // 'characters' is unavailable: Please use String directly
return (result, isPalindrome(result)) // missing argument label 's:' in call
for i in s.characters.indices { // 'characters' is unavailable: Please use String directly

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = s
    for i in c.characters.enumerated() {
        if i.element == s.characters.last! {
            result.removeLast()
        }
    }
    return (result, isPalindrome(result))
}

func isPalindrome(s: String) -> Bool {
    let 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 i.element == s.characters.last! {
            result.removeLast()
        }
    }
    return (result, isPalindrome(result))
}

// isPalindrome
// Given a string s, return true if the s is palindrome
// Otherwise, return false
func isPalindrome(s: String) -> Bool {
    let s = s.reversed()
    return s == s.reversed()
}
```
for i in c.characters.enumerated() { // 'characters' is unavailable: Please use String directly
if i.element == s.characters.last! { // 'characters' is unavailable: Please use String directly
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.indices {
        let index = s.characters.indexOf(c[i])
        if index!= nil {
            result.removeAtIndex(index!)
        }
    }
    return (result, isPalindrome(result))
}

func isPalindrome(s: String) -> Bool {
    let characters = s.characters.filter { $0.isAlphaNumeric }
    let lowercase = characters.map { String(String(characters).lowercaseString.characters.indexOf($0)) }
    return lowercase == lowercase.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 = s
    for i in c.characters.indices {
        let index = s.characters.indexOf(c[i])
        if index!= nil {
            result.removeAtIndex(index!)
        }
    }
    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 {
    let characters = s.characters.filter { $0.isAlphaNumeric }
    let lowercase = characters.map { String(String(characters).lowercaseString.characters.indexOf($0)) }
    return lowercase == lowercase.reverse()
}
```
for i in c.characters.indices { // 'characters' is unavailable: Please use String directly
let index = s.characters.indexOf(c[i]) // value of type 'String' has no member 'indexOf'
if index!= nil { // '=' must have consistent whitespace on both sides
if index!= nil { // use of '=' in a boolean context, did you mean '=='?
result.removeAtIndex(index!) // value of type 'String' has no member 'removeAtIndex'
return (result, isPalindrome(result)) // missing argument label 's:' in call
let characters = s.characters.filter { $0.isAlphaNumeric } // value of type 'String.Element' (aka 'Character') has no member 'isAlphaNumeric'
let lowercase = characters.map { String(String(characters).lowercaseString.characters.indexOf($0)) } // reference to member 'lowercaseString' cannot be resolved without a contextual type

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.characters.filter { $0 >= "a" && $0 <= "z" || $0 >= "0" && $0 <= "9" }
    var left = 0
    var right = result.count - 1
    while left < right {
        if result[left]!= result[right] {
            return false
        }
        left += 1
        right -= 1
    }
    return true
}

func isPalindromePermutation(s: String) -> Bool {
    var result = s.characters.reduce([:]) { (result, character) -> [Character : Int] in
        if result[character] == nil {
            result[character] = 1
        } else {
            result[character] += 1
        }
        return result
    }
    var oddCount = 0
    for value in result.values {
        if value % 2 == 1 {
            oddCount += 1
        }
        if oddCount > 1 {
            return false
        }
    }
    return true
}

func partition(s: String) -> [[String]] {
    var result = [[String]]()
    var partition = [String]()
    var s = s.characters.splitString("")
    var isPalindrome = isPalindrome(s)
    if isPalindrome {
        result.append(partition)
    }
    for i in 0..<s.count {
        var temp = s.subArray(0, toIndex: i)
        var temp = s.subArray(i + 1, toIndex: s.count)
        if isPalindrome(temp) {
            partition.append(s.subArray(0, toIndex: i))
            partition.append(s.subArray(i + 1, toIndex: s.count))
            result.append(partition)
        }
    }
    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 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.characters.filter { $0 >= "a" && $0 <= "z" || $0 >= "0" && $0 <= "9" }
    var left = 0
    var right = result.count - 1
    while left < right {
        if result[left]!= result[right] {
            return false
        }
        left += 1
        right -= 1
    }
    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 = s.characters.reduce([:]) { (result, character) -> [Character : Int] in
        if result[character] == nil {
            result[character] = 1
        } else {
            result[character] += 1
        }
        return result
    }
    var oddCount = 0
    for value in result.values {
        if value % 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
// Given s = "aab",
// Return
// [
//   ["aa","b"],
//   ["a","a","b"]
// ]
func partition(s: String) -> [[String]] {
    var result = [[String]]()
    var partition = [String]()
    var s = s.characters.splitString("")
    var isPalindrome = isPalindrome(s)
    if isPalindrome {
        result.append(partition)
    }
    for i in 0..<s.count {
        var temp = s.subArray(0, toIndex: i)
        var temp = s.subArray(i + 1, toIndex: s.count)
        if isPalindrome(temp) {
            partition.append(s.subArray(0, toIndex: i))
            partition.append(s.subArray(i + 1, toIndex: s.count))
            result.append(partition)
        }
    }
    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.
// For example, given s = "aababa",
// Return 1 since the palindrome partitioning ["aa","b","aba"] could be produced using 1 cut.
func minCut(s: String) -> Int {
    var result = [Int]()
    var s = s.characters.splitString("")
    var isPalindrome = isPalindrome(s)
    if isPalindrome {
        result.append(0)
    }
    for i in 0..<s.count {
        var temp = s.subArray(0, toIndex: i)
        var temp = s.subArray(i + 1, toIndex: s.count)
        if isPalindrome(temp) {
            result.append(0)
        } else {
            result.append(result[i] + 1)

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.reduce(0) { (count, digit) -> Int in
            if digit.isOdd {
                return count + 1
            } else {
                return count
            }
        }
        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, digit) -> Int in
            if digit.isOdd {
                return count + 1
            } else {
                return count
            }
        }
        return "the number of odd elements \(oddCount)n the str\(oddCount)ng \(oddCount) of the \(oddCount)nput."
    }
}
```
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, digit) -> Int in
            if digit.isOdd {
                return count + 1
            } else {
                return count
            }
        }
        return "the number of odd elements \(oddCount) in the string \(String(oddCount.count)) of the input."
    }
}
```swift
// Given an array of strings, where each string consists of only digits, return an array.
// Each element i of the output should be "the number of odd elements in the
// string i of the input." where all the i's should be replaced by the number
// of odd digits in the i'th string of the input.
// oddCount(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]
// oddCount(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.reduce(0) { (count, digit) -> Int in
            if digit.isOdd {
                return count + 1
            } else {
                return count
            }
        }
        return "the number of odd elements \(oddCount) in the string \(String(oddCount.count)) of the input."
    }
}
```
if digit.isOdd { // value of type 'String.Element' (aka 'Character') has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    var result = [String]()
    for str in lst {
        var oddCount = 0
        for char in str {
            if char.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 char in str {
            if char.isOdd() {
                oddCount += 1
            }
        }
        result.append("the number of odd elements \(oddCount) in the string \(str) of the input.")
    }
    return result
}
```
if char.isOdd() { // value of type 'Character' has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.reduce(0) { (count, digit) -> Int in
            return count + (digit.isOdd? 1 : 0)
        }
        return "the number of odd elements \(oddCount) in the string \(String($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.isOdd? 1 : 0)
        }
        return "the number of odd elements \(oddCount) in the string \(String($0)) of the input."
    }
}
```
return lst.map { // type of expression is ambiguous without a type annotation
return count + (digit.isOdd? 1 : 0) // expected ',' separator

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let count = $0.reduce(0) { (count, character) -> Int in
            return count + (character.isOddDigit? 1 : 0)
        }
        return "the number of odd elements \(count)n the str\(count)ng \(count) of the \(count)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 count = $0.reduce(0) { (count, character) -> Int in
            return count + (character.isOddDigit? 1 : 0)
        }
        return "the number of odd elements \(count)n the str\(count)ng \(count) of the \(count)nput."
    }
}
```
return lst.map { // type of expression is ambiguous without a type annotation
return count + (character.isOddDigit? 1 : 0) // expected ',' separator

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 count = $0.filter { $0 % 2!= 0 }.count
        return "the number of odd elements \(count)n the str\(count)ng \(count) of the \(count)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 count = $0.filter { $0 % 2!= 0 }.count
        return "the number of odd elements \(count)n the str\(count)ng \(count) of the \(count)nput."
    }
}
```
let count = $0.filter { $0 % 2!= 0 }.count // cannot convert value of type 'String.Element' (aka 'Character') to expected argument type 'Int'
let count = $0.filter { $0 % 2!= 0 }.count // expression is not assignable: binary operator returns immutable value
let count = $0.filter { $0 % 2!= 0 }.count // cannot force unwrap value of non-optional type 'Int'
let count = $0.filter { $0 % 2!= 0 }.count // cannot convert value of type '()' to closure result type 'Bool'
let count = $0.filter { $0 % 2!= 0 }.count // '=' must have consistent whitespace on both sides

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        $0.reduce(0) {
            $0 + $1.count % 2
        }
    }
}
```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 + $1.count % 2
        }
    }
}
```
$0.reduce(0) { // missing argument label 'into:' in call
$0.reduce(0) { // cannot convert value of type '(Int, _) -> Int' to closure result type 'String'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        $0.reduce(0) {
            $0 + $1.count % 2
        }
    }
}
```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 + $1.count % 2
        }
    }
}
```
$0.reduce(0) { // missing argument label 'into:' in call
$0.reduce(0) { // cannot convert value of type '(Int, _) -> Int' to closure result type 'String'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.reduce(0) { (acc, c) -> Int in
            return acc + (c == "1"? 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) { (acc, c) -> Int in
            return acc + (c == "1"? 1 : 0)
        }
        return "the number of odd elements \(oddCount)n the str\(oddCount)ng \(oddCount) of the \(oddCount)nput."
    }
}
```
let oddCount = $0.reduce(0) { (acc, c) -> Int in // missing argument label 'into:' in call
return acc + (c == "1"? 1 : 0) // expected ',' separator
return acc + (c == "1"? 1 : 0) // binary operator '+' cannot be applied to operands of type 'String' and '(Bool, Int)'
return acc + (c == "1"? 1 : 0) // cannot use optional chaining on non-optional value of type 'String'

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: 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 {
    var minSum = Int.max
    var sum = 0
    var left = 0
    var right = 0
    while right < nums.count {
        sum += nums[right]
        right += 1
        while sum >= minSum {
            minSum = min(minSum, sum)
            sum -= nums[left]
            left += 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 minSum = Int.max
    var sum = 0
    var left = 0
    var right = 0
    while right < nums.count {
        sum += nums[right]
        right += 1
        while sum >= minSum {
            minSum = min(minSum, sum)
            sum -= nums[left]
            left += 1
        }
    }
    return minSum
}
```
 // 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 {
    // 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
    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 {
    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 {
    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
    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 {
    var sum = 0
    var minSum = Int.max
    for i in 0..<nums.count {
        sum += nums[i]
        if sum < minSum {
            minSum = sum
        }
        if sum <= 0 {
            sum = 0
        }
    }
    return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
    var sum = 0
    var minSum = Int.max
    for i in 0..<nums.count {
        sum += nums[i]
        if sum < minSum {
            minSum = sum
        }
        if sum <= 0 {
            sum = 0
        }
    }
    return minSum
}
```
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    // Write your code here
    var result = 0
    var queue = [Int]()
    var visited = [Int]()
    var visitedCount = 0
    var count = 0
    var row = 0
    var col = 0
    var maxRow = grid.count
    var maxCol = grid[0].count
    var dirs = [[-1, 0], [1, 0], [0, -1], [0, 1]]
    for row = 0; row < maxRow; row++ {
        for col = 0; col < maxCol; col++ {
            if grid[row][col] == 1 {
                queue.append(row * maxCol + col)
                visited.append(row * maxCol + col)
                visitedCount += 1
            }
        }
    }
    while visitedCount > 0 {
        count = 0
        for i in 0..<queue.count {
            let current = queue[i]
            let row = current / maxCol
            let col = current % maxCol
            for dir in dirs {
                let nextRow = row + dir[0]
                let nextCol = col + dir[1]
                if nextRow < 0 || nextRow >= maxRow || nextCol < 0 || nextCol >= maxCol {
                    continue
                }
                if grid[nextRow][nextCol] == 1 && visited.contains(nextRow * maxCol + nextCol) == false {
                    queue.append(nextRow * maxCol + nextCol)
                    visited.append(nextRow * maxCol + nextCol)
                    visitedCount += 1
                    count += 1
                    if count == capacity {
                        result += 1
                        count = 0
                    }
                }
            }
        }
        queue.removeAll(where: {visited.contains($0)})
        visited.removeAll(where: {visited.contains($0)})
        visitedCount -= queue.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 code here
    var result = 0
    var queue = [Int]()
    var visited = [Int]()
    var visitedCount = 0
    var count = 0
    var row = 0
    var col = 0
    var maxRow = grid.count
    var maxCol = grid[0].count
    var dirs = [[-1, 0], [1, 0], [0, -1], [0, 1]]
    for row = 0; row < maxRow; row++ {
        for col = 0; col < maxCol; col++ {
            if grid[row][col] == 1 {
                queue.append(row * maxCol + col)
                visited.append(row * maxCol + col)
                visitedCount += 1
            }
        }
    }
    while visitedCount > 0 {
        count = 0
        for i in 0..<queue.count {
            let current = queue[i]
            let row = current / maxCol
            let col = current % maxCol
            for dir in dirs {
                let nextRow = row + dir[0]
                let nextCol = col + dir[1]
                if nextRow < 0 || nextRow >= maxRow || nextCol < 0 || nextCol >= maxCol {
                    continue
                }
                if grid[nextRow][nextCol] == 1 && visited.contains(nextRow * maxCol + nextCol) == false {
                    queue.append(nextRow * maxCol + nextCol)
                    visited.append(nextRow * maxCol + nextCol)
                    visitedCount += 1
                    count += 1
                    if count == capacity {
                        result += 1
                        count = 0
                    }
                }
            }
        }
        queue.removeAll(where: {visited.contains($0)})
        visited.removeAll(where: {visited.contains($0)})
        visitedCount -= queue.count
    }
    return result
}
```
for row = 0; row < maxRow; row++ { // C-style for statement has been removed in Swift 3
for col = 0; col < maxCol; col++ { // C-style for statement has been removed in Swift 3

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    // Write your code here
    var result = 0
    var visited = [Int]()
    var queue = [Int]()
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            if grid[i][j] == 1 {
                queue.append(i)
                visited.append(j)
            }
        }
    }
    while!queue.isEmpty {
        var current = queue.removeFirst()
        var currentVisited = visited.removeFirst()
        var currentCapacity = capacity
        while currentCapacity > 0 {
            if current + 1 < grid.count && grid[current + 1][currentVisited] == 1 {
                queue.append(current + 1)
                visited.append(currentVisited)
                current++
            } else if current - 1 >= 0 && grid[current - 1][currentVisited] == 1 {
                queue.append(current - 1)
                visited.append(currentVisited)
                current--
            } else if currentVisited + 1 < grid[current].count && grid[current][currentVisited + 1] == 1 {
                queue.append(current)
                visited.append(currentVisited + 1)
                currentVisited++
            } else if currentVisited - 1 >= 0 && grid[current][currentVisited - 1] == 1 {
                queue.append(current)
                visited.append(currentVisited - 1)
                currentVisited--
            } else {
                currentCapacity--
            }
        }
        result += 1
    }
    return result
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    // Write your code here
    var result = 0
    var visited = [Int]()
    var queue = [Int]()
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            if grid[i][j] == 1 {
                queue.append(i)
                visited.append(j)
            }
        }
    }
    while!queue.isEmpty {
        var current = queue.removeFirst()
        var currentVisited = visited.removeFirst()
        var currentCapacity = capacity
        while currentCapacity > 0 {
            if current + 1 < grid.count && grid[current + 1][currentVisited] == 1 {
                queue.append(current + 1)
                visited.append(currentVisited)
                current++
            } else if current - 1 >= 0 && grid[current - 1][currentVisited] == 1 {
                queue.append(current - 1)
                visited.append(currentVisited)
                current--
            } else if currentVisited + 1 < grid[current].count && grid[current][currentVisited + 1] == 1 {
                queue.append(current)
                visited.append(currentVisited + 1)
                currentVisited++
            } else if currentVisited - 1 >= 0 && grid[current][currentVisited - 1] == 1 {
                queue.append(current)
                visited.append(currentVisited - 1)
                currentVisited--
            } else {
                currentCapacity--
            }
        }
        result += 1
    }
    return result
}
```
while!queue.isEmpty { // expected expression, var, or let in 'while' condition

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 visited = [Int]()
    var queue = [Int]()
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            if grid[i][j] == 1 {
                count += 1
                queue.append(i)
                visited.append(j)
            }
        }
    }
    while count > 0 {
        var next = queue.removeFirst()
        var nextIndex = visited.removeFirst()
        var nextCapacity = capacity
        for i in 0..<grid.count {
            for j in 0..<grid[i].count {
                if grid[i][j] == 1 &&!(visited.contains(j)) {
                    if nextCapacity > 0 {
                        queue.append(i)
                        visited.append(j)
                        nextCapacity -= 1
                    } else {
                        result += 1
                        grid[i][j] = 0
                    }
                }
            }
        }
        count -= 1
    }
    return result
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    // Write your solution here
    var result = 0
    var count = 0
    var visited = [Int]()
    var queue = [Int]()
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            if grid[i][j] == 1 {
                count += 1
                queue.append(i)
                visited.append(j)
            }
        }
    }
    while count > 0 {
        var next = queue.removeFirst()
        var nextIndex = visited.removeFirst()
        var nextCapacity = capacity
        for i in 0..<grid.count {
            for j in 0..<grid[i].count {
                if grid[i][j] == 1 &&!(visited.contains(j)) {
                    if nextCapacity > 0 {
                        queue.append(i)
                        visited.append(j)
                        nextCapacity -= 1
                    } else {
                        result += 1
                        grid[i][j] = 0
                    }
                }
            }
        }
        count -= 1
    }
    return result
}
```
if grid[i][j] == 1 &&!(visited.contains(j)) { // expected '{' after 'if' condition
grid[i][j] = 0 // cannot assign through subscript: 'grid' is a 'let' constant

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'

```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 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 = grid
    var grid
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] {
    //...
}
```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] {
    //...
}
```
} // 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]()
    var word = ""
    var consonants = 0
    for c in s {
        if c.isLetter {
            if c.isLowercase {
                c = c.uppercaseString
            }
            if c.isConsonant {
                consonants += 1
            }
            word += c
        } else {
            if consonants == n {
                words.append(word)
            }
            consonants = 0
            word = ""
        }
    }
    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 c in s {
        if c.isLetter {
            if c.isLowercase {
                c = c.uppercaseString
            }
            if c.isConsonant {
                consonants += 1
            }
            word += c
        } else {
            if consonants == n {
                words.append(word)
            }
            consonants = 0
            word = ""
        }
    }
    if consonants == n {
        words.append(word)
    }
    return words
}
```
c = c.uppercaseString // value of type 'Character' has no member 'uppercaseString'
c = c.uppercaseString // cannot assign to value: 'c' is a 'let' constant
if c.isConsonant { // value of type 'Character' has no member 'isConsonant'
word += c // cannot convert value of type 'Character' to expected argument type 'String'

func selectWords(s: String, n: Int) -> [String] {
    let words = s.components(separatedBy: " ")
    var result: [String] = []
    for word in words {
        let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" }
        if consonants.count == n {
            result.append(word)
        }
    }
    return result
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    let words = s.components(separatedBy: " ")
    var result: [String] = []
    for word in words {
        let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" }
        if consonants.count == n {
            result.append(word)
        }
    }
    return result
}
```
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" } // cannot convert value of type '()' 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" } // '=' 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" } // 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" } // 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" } // 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" } // '=' must have consistent whitespace on both sides
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" } // 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
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

func selectWords(s: String, n: Int) -> [String] {
    var words: [String] = []
    var currentWord: String = ""
    var currentConsonants: Int = 0
    var isConsonant: Bool = false
    
    for character in s.characters {
        if character == " " {
            if currentConsonants == n {
                words.append(currentWord)
            }
            currentWord = ""
            currentConsonants = 0
            isConsonant = false
        } else if isConsonant {
            currentConsonants += 1
            currentWord += character
        } else if isVowel(character) {
            isConsonant = true
        }
    }
    
    if currentConsonants == n {
        words.append(currentWord)
    }
    
    return words
}

func selectWords(s: String, n: Int) -> [String] {
    var words: [String] = []
    var currentWord: String = ""
    var currentVowels: Int = 0
    var isVowel: Bool = false
    
    for character in s.characters {
        if character == " " {
            if currentVowels == n {
                words.append(currentWord)
            }
            currentWord = ""
            currentVowels = 0
            isVowel = false
        } else if isVowel {
            currentVowels += 1
            currentWord += character
        } else if isConsonant(character) {
            isVowel = true
        }
    }
    
    if currentVowels == 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: String = ""
    var currentConsonants: Int = 0
    var isConsonant: Bool = false
    
    for character in s.characters {
        if character == " " {
            if currentConsonants == n {
                words.append(currentWord)
            }
            currentWord = ""
            currentConsonants = 0
            isConsonant = false
        } else if isConsonant {
            currentConsonants += 1
            currentWord += character
        } else if isVowel(character) {
            isConsonant = true
        }
    }
    
    if currentConsonants == n {
        words.append(currentWord)
    }
    
    return words
}

// 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 vowels, 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: 2) == ["Mary", "had", "a"]
// selectWords(s: "simple white space", n: 1) == [] as [String]
// selectWords(s: "Hello world", n: 1) == ["Hello", "world"]
// selectWords(s: "Uncle sam", n: 1) == ["Uncle", "sam"]
func selectWords(s: String, n: Int) -> [String] {
    var words: [String] = []
    var currentWord: String = ""
    var currentVowels: Int = 0
    var isVowel: Bool = false
    
    for character in s.characters {
        if character == " " {
            if currentVowels == n {
                words.append(currentWord)
            }
            currentWord = ""
            currentVowels = 0
            isVowel = false
        } else if isVowel {
            currentVowels += 1
            currentWord += character
        } else if isConsonant(character) {
            isVowel = true
        }
    }
    
    if currentVowels == n {
        words.append(currentWord)
    }
    
    return words
}

// 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 vowels and 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) == ["Mary"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["Hello"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    var words: [String] = []
    var currentWord: String = ""
    var currentConsonants: Int = 0
    var currentVowels: Int = 0
    var isConsonant: Bool = false
    var isVowel: Bool = false
    
    for character in s.characters {
        if character == " " {
            if currentConsonants == n && currentVowels == n {
                words.append(currentWord)
            }
            currentWord = ""
            currentConsonants = 0
            currentVowels = 0
            isConsonant = false
            isVowel = false
        } else if isConsonant {
            currentConsonants += 1
            currentWord += character
        } else if isVowel {
            currentVowels += 1
            currentWord += character
        } else if isConsonant(character) {
            isConsonant = true
        } else if isVowel(character) {
            isVowel = true
        }
    }
    
    if currentConsonants
for character in s.characters { // 'characters' is unavailable: Please use String directly
currentWord += character // cannot convert value of type 'Character' to expected argument type 'String'
} else if isVowel(character) { // cannot find 'isVowel' in scope
func selectWords(s: String, n: Int) -> [String] { // invalid redeclaration of 'selectWords(s:n:)'
for character in s.characters { // 'characters' is unavailable: Please use String directly
currentWord += character // cannot convert value of type 'Character' to expected argument type 'String'
} else if isConsonant(character) { // cannot find 'isConsonant' in scope

func selectWords(s: String, n: Int) -> [String] {
    var words = [String]()
    let wordsArray = s.components(separatedBy: " ")
    for word in wordsArray {
        let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" }
        if consonants.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 wordsArray = s.components(separatedBy: " ")
    for word in wordsArray {
        let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" }
        if consonants.count == n {
            words.append(word)
        }
    }
    return words
}
```
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" } // cannot convert value of type '()' 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" } // '=' 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" } // 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" } // 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" } // 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" } // '=' must have consistent whitespace on both sides
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" } // 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
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

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 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 = ""
    var consonants = 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 selectWords(s: String, n: Int) -> [String] {
    
    var words = [String]()
    
    let sArray = s.split(separator: " ")
    
    for word in sArray {
        
        let wordArray = word.split(separator: "")
        
        var count = 0
        
        for char in wordArray {
            if char.isLowercase &&!char.isUppercase {
                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 sArray = s.split(separator: " ")
    
    for word in sArray {
        
        let wordArray = word.split(separator: "")
        
        var count = 0
        
        for char in wordArray {
            if char.isLowercase &&!char.isUppercase {
                count += 1
            }
        }
        
        if count == n {
            words.append(word)
        }
    }
    
    return words
}
```
if char.isLowercase &&!char.isUppercase { // expected '{' after 'if' condition
if char.isLowercase &&!char.isUppercase { // value of type 'Substring.SubSequence' (aka 'Substring') has no member 'isLowercase'
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] {
    // 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] {
    let words = s.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" }
        if consonants.count == n {
            result.append(word)
        }
    }
    return result
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    let words = s.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        let consonants = word.filter { $0!= "a" && $0!= "e" && $0!= "i" && $0!= "o" && $0!= "u" }
        if consonants.count == n {
            result.append(word)
        }
    }
    return result
}
```
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" } // cannot convert value of type '()' 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" } // '=' 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" } // 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" } // 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" } // 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" } // '=' must have consistent whitespace on both sides
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" } // 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
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

func selectWords(s: String, n: Int) -> [String] {
    
    let words = s.components(separatedBy: " ")
    var result: [String] = []
    
    for word in words {
        if countConsonants(word) == n {
            result.append(word)
        }
    }
    
    return result
}

func countConsonants(s: String) -> Int {
    
    let vowels = "aeiou"
    var result = 0
    
    for character in s {
        if!vowels.contains(character) {
            result += 1
        }
    }
    
    return result
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    
    let words = s.components(separatedBy: " ")
    var result: [String] = []
    
    for word in words {
        if countConsonants(word) == n {
            result.append(word)
        }
    }
    
    return result
}

// Given a string s, you have to find the number of consonants in the string s.
// A consonant is a letter that is not a vowel.
// Vowels are the following letters: a, e, i, o, u.
// Examples:
// countConsonants(s: "Mary had a little lamb") == 9
// countConsonants(s: "Hello world") == 4
// countConsonants(s: "Uncle sam") == 3
func countConsonants(s: String) -> Int {
    
    let vowels = "aeiou"
    var result = 0
    
    for character in s {
        if!vowels.contains(character) {
            result += 1
        }
    }
    
    return result
}
```
if countConsonants(word) == n { // missing argument label 's:' in call
if!vowels.contains(character) { // expected expression, var, or let in 'if' condition

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
    
    for i in word.characters.enumerated() {
        if i.offset == 0 || i.offset == word.characters.count - 1 {
            continue
        }
        
        if vowels.contains(String(i.element)) {
            vowel = String(i.element)
            index = i.offset
            break
        }
    }
    
    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
    
    for i in word.characters.enumerated() {
        if i.offset == 0 || i.offset == word.characters.count - 1 {
            continue
        }
        
        if vowels.contains(String(i.element)) {
            vowel = String(i.element)
            index = i.offset
            break
        }
    }
    
    return vowel
}
```
var vowels = ["a", "e", "i", "o", "u"] // variable 'vowels' was never mutated; consider changing to 'let' constant
var index = 0 // variable 'index' was written to, but never read
for i in word.characters.enumerated() { // 'characters' is unavailable: Please use String directly
if i.offset == 0 || i.offset == word.characters.count - 1 { // '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 {
    var vowels = ["a", "e", "i", "o", "u"]
    var result = ""
    var index = 0
    var isVowel = false
    var isConsonant = false
    for i in word.characters.enumerated() {
        if vowels.contains(i.element) {
            isVowel = true
        } else {
            if isVowel {
                result = i.element
                index = i.index
                break
            } else {
                isVowel = false
                isConsonant = true
            }
        }
    }
    if isConsonant {
        for i in word.characters.enumerated() {
            if i.index > index {
                if vowels.contains(i.element) {
                    result = 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 = ["a", "e", "i", "o", "u"]
    var result = ""
    var index = 0
    var isVowel = false
    var isConsonant = false
    for i in word.characters.enumerated() {
        if vowels.contains(i.element) {
            isVowel = true
        } else {
            if isVowel {
                result = i.element
                index = i.index
                break
            } else {
                isVowel = false
                isConsonant = true
            }
        }
    }
    if isConsonant {
        for i in word.characters.enumerated() {
            if i.index > index {
                if vowels.contains(i.element) {
                    result = i.element
                    break
                }
            }
        }
    }
    return result
}
```
for i in word.characters.enumerated() { // 'characters' is unavailable: Please use String directly
if vowels.contains(i.element) { // cannot convert value of type 'String.Element' (aka 'Character') to expected argument type 'String'
result = i.element // cannot assign value of type 'String.Element' (aka 'Character') to type 'String'
index = i.index // value of tuple type '(offset: Int, element: String.Element)' (aka '(offset: Int, element: Character)') has no member 'index'
for i in word.characters.enumerated() { // 'characters' is unavailable: Please use String directly
if i.index > index { // value of tuple type '(offset: Int, element: String.Element)' (aka '(offset: Int, element: Character)') has no member 'index'
if vowels.contains(i.element) { // cannot convert value of type 'String.Element' (aka 'Character') to expected argument type 'String'
result = i.element // cannot assign value of type 'String.Element' (aka 'Character') to type 'String'

func getClosestVowel(word: String) -> String {
    // TODO: implement
    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: implement
    return ""
}
```
 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    var vowels = ["a", "e", "i", "o", "u"]
    var result = ""
    var index = 0
    var wordLength = word.characters.count
    
    while index < wordLength {
        if vowels.contains(word[index]) {
            if index == 0 || index == wordLength - 1 {
                index += 1
            } else {
                result = word[index]
                break
            }
        } else {
            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 wordLength = word.characters.count
    
    while index < wordLength {
        if vowels.contains(word[index]) {
            if index == 0 || index == wordLength - 1 {
                index += 1
            } else {
                result = word[index]
                break
            }
        } else {
            index += 1
        }
    }
    
    return result
}
```
var wordLength = word.characters.count // 'characters' is unavailable: Please use String directly
if vowels.contains(word[index]) { // cannot convert value of type 'Character' to expected argument type 'String'
result = word[index] // cannot assign value of type 'Character' to type 'String'

func getClosestVowel(word: String) -> String {
    var vowels = ["a", "e", "i", "o", "u"]
    var result = ""
    var i = 0
    var j = word.characters.count - 1
    while i < j {
        if vowels.contains(word[i]) {
            if vowels.contains(word[j]) {
                result = word[j]
                break
            } else {
                result = word[i]
                break
            }
        }
        i += 1
        j -= 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 i = 0
    var j = word.characters.count - 1
    while i < j {
        if vowels.contains(word[i]) {
            if vowels.contains(word[j]) {
                result = word[j]
                break
            } else {
                result = word[i]
                break
            }
        }
        i += 1
        j -= 1
    }
    return result
}
```
var j = word.characters.count - 1 // 'characters' is unavailable: Please use String directly
if vowels.contains(word[i]) { // cannot convert value of type 'Character' to expected argument type 'String'
if vowels.contains(word[j]) { // cannot convert value of type 'Character' to expected argument type 'String'
result = word[j] // cannot assign value of type 'Character' to type 'String'
result = word[i] // cannot assign value of type 'Character' to type 'String'

func getClosestVowel(word: String) -> String {
    let vowels = "aeiou"
    var vowel = ""
    var lastConsonant = ""
    var lastVowel = ""
    
    for char in word {
        if vowels.contains(char) {
            lastVowel = char
        } else {
            lastConsonant = char
        }
    }
    
    if lastConsonant!= "" && lastVowel!= "" {
        let vowelIndex = vowels.index(of: lastVowel)
        let vowelIndexFromRight = vowels.count - vowelIndex - 1
        let closestVowelIndex = vowels.count - vowelIndexFromRight - 1
        vowel = vowels[closestVowelIndex]
    }
    
    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 {
    let vowels = "aeiou"
    var vowel = ""
    var lastConsonant = ""
    var lastVowel = ""
    
    for char in word {
        if vowels.contains(char) {
            lastVowel = char
        } else {
            lastConsonant = char
        }
    }
    
    if lastConsonant!= "" && lastVowel!= "" {
        let vowelIndex = vowels.index(of: lastVowel)
        let vowelIndexFromRight = vowels.count - vowelIndex - 1
        let closestVowelIndex = vowels.count - vowelIndexFromRight - 1
        vowel = vowels[closestVowelIndex]
    }
    
    return vowel
}
```
lastVowel = char // cannot assign value of type 'Character' to type 'String'
lastConsonant = char // cannot assign value of type 'Character' to type 'String'
if lastConsonant!= "" && lastVowel!= "" { // '=' must have consistent whitespace on both sides
if lastConsonant!= "" && lastVowel!= "" { // use of '=' in a boolean context, did you mean '=='?
if lastConsonant!= "" && lastVowel!= "" { // cannot convert value of type 'String' to expected argument type 'Bool'
if lastConsonant!= "" && lastVowel!= "" { // cannot convert value of type 'String' to expected argument type 'Bool'
if lastConsonant!= "" && lastVowel!= "" { // cannot force unwrap value of non-optional type 'String'
if lastConsonant!= "" && lastVowel!= "" { // cannot force unwrap value of non-optional type 'String'
if lastConsonant!= "" && lastVowel!= "" { // '=' must have consistent whitespace on both sides
if lastConsonant!= "" && lastVowel!= "" { // cannot assign value of type '()' to type 'String'
let vowelIndex = vowels.index(of: lastVowel) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')

func getClosestVowel(word: String) -> String {
    var vowels = "aeiouAEIOU"
    var result = ""
    var lastConsonant = ""
    var lastVowel = ""
    
    for i in word.characters.enumerated() {
        if vowels.contains(String(i.element)) {
            lastVowel = String(i.element)
        } else {
            lastConsonant = String(i.element)
        }
    }
    
    if lastConsonant.isEmpty || lastVowel.isEmpty {
        return result
    }
    
    for i in word.characters.enumerated() {
        if vowels.contains(String(i.element)) {
            if lastConsonant.distance(from: lastVowel) < i.element.distance(from: lastVowel) {
                result = String(i.element)
            }
        }
    }
    
    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 lastConsonant = ""
    var lastVowel = ""
    
    for i in word.characters.enumerated() {
        if vowels.contains(String(i.element)) {
            lastVowel = String(i.element)
        } else {
            lastConsonant = String(i.element)
        }
    }
    
    if lastConsonant.isEmpty || lastVowel.isEmpty {
        return result
    }
    
    for i in word.characters.enumerated() {
        if vowels.contains(String(i.element)) {
            if lastConsonant.distance(from: lastVowel) < i.element.distance(from: lastVowel) {
                result = String(i.element)
            }
        }
    }
    
    return result
}
```
for i in word.characters.enumerated() { // 'characters' is unavailable: Please use String directly
for i in word.characters.enumerated() { // 'characters' is unavailable: Please use String directly
if lastConsonant.distance(from: lastVowel) < i.element.distance(from: lastVowel) { // value of type 'String.Element' (aka 'Character') has no member 'distance'
if lastConsonant.distance(from: lastVowel) < i.element.distance(from: lastVowel) { // no exact matches in call to instance method 'distance'

func getClosestVowel(word: String) -> String {
    var vowels = ["a", "e", "i", "o", "u"]
    var result = ""
    var index = 0
    var wordLength = word.characters.count
    
    for i in 0..<wordLength {
        if i == 0 {
            continue
        }
        
        if word[i] == "a" || word[i] == "e" || word[i] == "i" || word[i] == "o" || word[i] == "u" {
            if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" {
                result = word[i]
                index = i
                break
            }
        }
    }
    
    if result == "" {
        return ""
    }
    
    return word[index..<wordLength]
}
```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 wordLength = word.characters.count
    
    for i in 0..<wordLength {
        if i == 0 {
            continue
        }
        
        if word[i] == "a" || word[i] == "e" || word[i] == "i" || word[i] == "o" || word[i] == "u" {
            if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" {
                result = word[i]
                index = i
                break
            }
        }
    }
    
    if result == "" {
        return ""
    }
    
    return word[index..<wordLength]
}
```
var wordLength = word.characters.count // 'characters' is unavailable: Please use String directly
if word[i] == "a" || word[i] == "e" || word[i] == "i" || word[i] == "o" || word[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if word[i] == "a" || word[i] == "e" || word[i] == "i" || word[i] == "o" || word[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if word[i] == "a" || word[i] == "e" || word[i] == "i" || word[i] == "o" || word[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if word[i] == "a" || word[i] == "e" || word[i] == "i" || word[i] == "o" || word[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if word[i] == "a" || word[i] == "e" || word[i] == "i" || word[i] == "o" || word[i] == "u" { // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // '=' must have consistent whitespace on both sides
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // expression is not assignable: '&&' returns immutable value
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot force unwrap value of non-optional type 'Character'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // expression is not assignable: '&&' returns immutable value
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot force unwrap value of non-optional type 'Character'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // expression is not assignable: '&&' returns immutable value
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // use of '=' in a boolean context, did you mean '=='?
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // '=' must have consistent whitespace on both sides
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot convert value of type 'Character' to expected argument type 'Bool'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot force unwrap value of non-optional type 'Character'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot convert value of type 'String' to expected argument type 'Bool'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot convert value of type 'Character' to expected argument type 'Bool'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // '=' must have consistent whitespace on both sides
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot convert value of type 'String' to expected argument type 'Bool'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // expression is not assignable: '&&' returns immutable value
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot assign value of type '()' to type 'Character'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot force unwrap value of non-optional type 'Character'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot force unwrap value of non-optional type 'Character'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot convert value of type 'Character' to expected argument type 'Bool'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot convert value of type 'Character' to expected argument type 'Bool'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot convert value of type 'String' to expected argument type 'Bool'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // cannot convert value of type 'String' to expected argument type 'Bool'
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // '=' must have consistent whitespace on both sides
if word[i-1]!= "a" && word[i-1]!= "e" && word[i-1]!= "i" && word[i-1]!= "o" && word[i-1]!= "u" { // '=' must have consistent whitespace on both sides
result = word[i] // cannot assign value of type 'Character' to type 'String'
return word[index..<wordLength] // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

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 {
    // 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 res = "No"
    var stack = [Character]()
    for s in lst {
        for c in s {
            if c == "(" {
                stack.append(c)
            } else {
                if stack.isEmpty {
                    res = "No"
                    break
                }
                if stack.last == "(" {
                    stack.removeLast()
                } else {
                    res = "No"
                    break
                }
            }
        }
        if res == "No" {
            break
        }
    }
    if res == "No" {
        return res
    }
    if!stack.isEmpty {
        res = "No"
    }
    return res
}
```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 res = "No"
    var stack = [Character]()
    for s in lst {
        for c in s {
            if c == "(" {
                stack.append(c)
            } else {
                if stack.isEmpty {
                    res = "No"
                    break
                }
                if stack.last == "(" {
                    stack.removeLast()
                } else {
                    res = "No"
                    break
                }
            }
        }
        if res == "No" {
            break
        }
    }
    if res == "No" {
        return res
    }
    if!stack.isEmpty {
        res = "No"
    }
    return res
}
```
if!stack.isEmpty { // expected expression, var, or let in 'if' condition

func matchParens(lst: [String]) -> String {
    var result = "Yes"
    for i in 0..<lst.count {
        if lst[i].count!= lst[i].replacingOccurrences(of: ")", with: "").count {
            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 = "Yes"
    for i in 0..<lst.count {
        if lst[i].count!= lst[i].replacingOccurrences(of: ")", with: "").count {
            result = "No"
            break
        }
    }
    return result
}
```
if lst[i].count!= lst[i].replacingOccurrences(of: ")", with: "").count { // '=' must have consistent whitespace on both sides
if lst[i].count!= lst[i].replacingOccurrences(of: ")", with: "").count { // cannot force unwrap value of non-optional type 'Int'
if lst[i].count!= lst[i].replacingOccurrences(of: ")", with: "").count { // use of '=' in a boolean context, did you mean '=='?

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 {
    var stack: [Character] = []
    for s in lst {
        for c in s {
            if c == "(" {
                stack.append(c)
            } else if c == ")" {
                if stack.isEmpty {
                    return "No"
                }
                stack.removeLast()
            }
        }
    }
    if stack.isEmpty {
        return "Yes"
    } else {
        return "No"
    }
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    var stack: [Character] = []
    for s in lst {
        for c in s {
            if c == "(" {
                stack.append(c)
            } else if c == ")" {
                if stack.isEmpty {
                    return "No"
                }
                stack.removeLast()
            }
        }
    }
    if stack.isEmpty {
        return "Yes"
    } else {
        return "No"
    }
}
```
 // 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 < arr.count {
        var j = i
        var max = arr[i]
        while j < arr.count {
            if arr[j] > max {
                max = arr[j]
            }
            j += 1
        }
        max.append(max)
        i += 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
    while i < arr.count {
        var j = i
        var max = arr[i]
        while j < arr.count {
            if arr[j] > max {
                max = arr[j]
            }
            j += 1
        }
        max.append(max)
        i += 1
    }
    return max
}
```
max.append(max) // value of type 'Int' has no member 'append'

func maximum(arr: [Int], k: Int) -> [Int] {
    let sortedArr = arr.sorted()
    let kthElement = sortedArr.prefix(k)
    return kthElement
}
```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()
    let kthElement = sortedArr.prefix(k)
    return kthElement
}
```
return kthElement // cannot convert return expression of type 'Array<Int>.SubSequence' (aka 'ArraySlice<Int>') to return type '[Int]'

func maximum(arr: [Int], k: Int) -> [Int] {
    var result: [Int] = [Int]()
    var max: Int = 0
    var index: Int = 0
    
    for i in 0..<arr.count {
        if i < k {
            result.append(arr[i])
        } else {
            if arr[i] > arr[index] {
                index = i
                max = arr[i]
            }
        }
    }
    
    for i in 0..<k {
        result[i] = max
        max = result[i]
    }
    
    return result
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    var result: [Int] = [Int]()
    var max: Int = 0
    var index: Int = 0
    
    for i in 0..<arr.count {
        if i < k {
            result.append(arr[i])
        } else {
            if arr[i] > arr[index] {
                index = i
                max = arr[i]
            }
        }
    }
    
    for i in 0..<k {
        result[i] = max
        max = result[i]
    }
    
    return result
}
```
 // XCTAssertTrue failed

func maximum(arr: [Int], k: Int) -> [Int] {
    var max = [Int]()
    var i = 0
    var j = 0
    while i < k {
        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 {
        max.append(arr[j])
        i += 1
        j += 1
    }
    return max
}
```
 // XCTAssertTrue failed

func maximum(arr: [Int], k: Int) -> [Int] {
    var result: [Int] = []
    for i in 0..<k {
        var max: Int = -1
        for j in 0..<arr.count {
            if arr[j] > max {
                max = arr[j]
            }
        }
        result.append(max)
        arr.remove(at: arr.index(of: max)!)
    }
    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] = []
    for i in 0..<k {
        var max: Int = -1
        for j in 0..<arr.count {
            if arr[j] > max {
                max = arr[j]
            }
        }
        result.append(max)
        arr.remove(at: arr.index(of: max)!)
    }
    return result
}
```
arr.remove(at: arr.index(of: max)!) // cannot use mutating member on immutable value: 'arr' is a 'let' constant

func maximum(arr: [Int], k: Int) -> [Int] {
    var result: [Int] = []
    var start: Int = 0
    var end: Int = 0
    var max: Int = 0
    for i in 0..<k {
        if arr[start] > arr[end] {
            max = arr[start]
            start += 1
        } else {
            max = arr[end]
            end += 1
        }
        result.append(max)
    }
    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 start: Int = 0
    var end: Int = 0
    var max: Int = 0
    for i in 0..<k {
        if arr[start] > arr[end] {
            max = arr[start]
            start += 1
        } else {
            max = arr[end]
            end += 1
        }
        result.append(max)
    }
    return result
}
```
for i in 0..<k { // immutable value 'i' was never used; consider replacing with '_' or removing it
 // XCTAssertTrue failed

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

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

func maximum(arr: [Int], k: Int) -> [Int] {
    var result: [Int] = []
    var index = 0
    var count = 0
    while count < k {
        if index >= arr.count {
            index = 0
        }
        result.append(arr[index])
        index += 1
        count += 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 index = 0
    var count = 0
    while count < k {
        if index >= arr.count {
            index = 0
        }
        result.append(arr[index])
        index += 1
        count += 1
    }
    return result
}
```
 // 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 i = 0
    while i < k {
        var max = arr[0]
        for j in 0..<arr.count {
            if arr[j] > max {
                max = arr[j]
            }
        }
        max = max.max(0)
        max = max.min(arr[i])
        max = max.max(arr[i+1])
        max = max.max(arr[i+2])
        max = max.max(arr[i+3])
        max = max.max(arr[i+4])
        max = max.max(arr[i+5])
        max = max.max(arr[i+6])
        max = max.max(arr[i+7])
        max = max.max(arr[i+8])
        max = max.max(arr[i+9])
        max = max.max(arr[i+10])
        max = max.max(arr[i+11])
        max = max.max(arr[i+12])
        max = max.max(arr[i+13])
        max = max.max(arr[i+14])
        max = max.max(arr[i+15])
        max = max.max(arr[i+16])
        max = max.max(arr[i+17])
        max = max.max(arr[i+18])
        max = max.max(arr[i+19])
        max = max.max(arr[i+20])
        max = max.max(arr[i+21])
        max = max.max(arr[i+22])
        max = max.max(arr[i+23])
        max = max.max(arr[i+24])
        max = max.max(arr[i+25])
        max = max.max(arr[i+26])
        max = max.max(arr[i+27])
        max = max.max(arr[i+28])
        max = max.max(arr[i+29])
        max = max.max(arr[i+30])
        max = max.max(arr[i+31])
        max = max.max(arr[i+32])
        max = max.max(arr[i+33])
        max = max.max(arr[i+34])
        max = max.max(arr[i+35])
        max = max.max(arr[i+36])
        max = max.max(arr[i+37])
        max = max.max(arr[i+38])
        max = max.max(arr[i+39])
        max = max.max(arr[i+40])
        max = max.max(arr[i+41])
        max = max.max(arr[i+42])
        max = max.max(arr[i+43])
        max = max.max(arr[i+44])
        max = max.max(arr[i+45])
        max = max.max(arr[i+46])
        max = max.max(arr[i+47])
        max = max.max(arr[i+48])
        max = max.max(arr[i+49])
        max = max.max(arr[i+50])
        max = max.max(arr[i+51])
        max = max.max(arr[i+52])
        max = max.max(arr[i+53])
        max = max.max(arr[i+54])
        max = max.max(arr[i+55])
        max = max.max(arr[i+56])
        max = max.max(arr[i+57])
        max = max.max(arr[i+58])
        max = max.max(arr[i+59])
        max = max.max(arr[i+60])
        max = max.max(arr[i+61])
        max = max.max(arr[i+62])
        max = max.max(arr[i+63])
        max = max.max(arr[i+64])
        max = max.max(arr[i+65])
        max = max.max(arr[i+66])
        max = max.max(arr[i
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 (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 && 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 { // '=' must have consistent whitespace on both sides
if i % 2 == 0 && lst[i] % 2!= 0 { // expression is not assignable: '&&' returns immutable value
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 { // 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 '=='?

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 { // expression is not assignable: binary operator returns immutable value
if lst[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if lst[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if lst[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'

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 { // '=' must have consistent whitespace on both sides
if i % 2 == 0 && lst[i] % 2!= 0 { // expression is not assignable: '&&' returns immutable value
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 { // 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 '=='?

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 { // '=' must have consistent whitespace on both sides
if i % 2 == 0 && lst[i] % 2!= 0 { // expression is not assignable: '&&' returns immutable value
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 { // 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 '=='?

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 { // '=' must have consistent whitespace on both sides
if i % 2 == 0 && lst[i] % 2!= 0 { // expression is not assignable: '&&' returns immutable value
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 { // 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 '=='?

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 { // '=' must have consistent whitespace on both sides
if i % 2 == 0 && lst[i] % 2!= 0 { // expression is not assignable: '&&' returns immutable value
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 { // 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 '=='?

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 { // '=' must have consistent whitespace on both sides
if i % 2 == 0 && lst[i] % 2!= 0 { // expression is not assignable: '&&' returns immutable value
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 { // 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 '=='?

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 { // '=' must have consistent whitespace on both sides
if i % 2 == 0 && lst[i] % 2!= 0 { // expression is not assignable: '&&' returns immutable value
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 { // 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 '=='?

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 {
    // 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]
        } 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]
        } 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
    }
    while i < arr.count {
        sum += arr[i]
        i += 1
        if i < 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
    }
    while i < arr.count {
        sum += arr[i]
        i += 1
        if i < 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 && i < arr.count {
        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 && i < arr.count {
        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
    }
    while i < arr.count {
        sum += arr[i]
        if sum > 9 {
            sum -= 9
        }
        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
    }
    while i < arr.count {
        sum += arr[i]
        if sum > 9 {
            sum -= 9
        }
        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
    }
    for i in k...arr.count-1 {
        sum += arr[i]
        if sum > 9 {
            sum -= 9
        }
    }
    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
    }
    for i in k...arr.count-1 {
        sum += arr[i]
        if sum > 9 {
            sum -= 9
        }
    }
    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]
        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]
        j += 1
        if j < arr.count && 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 < 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 && 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 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!= 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 /= 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            collatz.append(current)
        }
    }
    collatz.append(1)
    return collatz.sorted()
}
```
while current!= 1 { // use of '=' in a boolean context, did you mean '=='?
while current!= 1 { // '=' must have consistent whitespace on both sides
while current!= 1 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if current % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
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 { // use of '=' in a boolean context, did you mean '=='?
while current!= 1 { // '=' must have consistent whitespace on both sides
while current!= 1 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if current % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
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 { // use of '=' in a boolean context, did you mean '=='?
while current!= 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 == 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 { // use of '=' in a boolean context, did you mean '=='?
while current!= 1 { // '=' 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 } // '=' must have consistent whitespace on both sides
return collatz.filter { $0 % 2!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
return collatz.filter { $0 % 2!= 0 } // cannot force unwrap value of non-optional type 'Int'
return collatz.filter { $0 % 2!= 0 } // expression is not assignable: binary operator returns immutable value

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
        }
        if i % 2 == 1 {
            collatz.append(i)
        }
    }
    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 i = n
    while i!= 1 {
        if i % 2 == 0 {
            i = i / 2
        } else {
            i = 3 * i + 1
        }
        if i % 2 == 1 {
            collatz.append(i)
        }
    }
    collatz.append(1)
    return collatz.sorted()
}
```
while i!= 1 { // cannot force unwrap value of non-optional type 'Int'
while i!= 1 { // '=' must have consistent whitespace on both sides
while i!= 1 { // use of '=' in a boolean context, did you mean '=='?

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
        }
        if i % 2!= 0 {
            collatz.append(i)
        }
    }
    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 i = n
    while i!= 1 {
        if i % 2 == 0 {
            i = i / 2
        } else {
            i = 3 * i + 1
        }
        if i % 2!= 0 {
            collatz.append(i)
        }
    }
    collatz.append(1)
    return collatz.sorted()
}
```
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'
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 'Int'
if i % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 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 { // use of '=' in a boolean context, did you mean '=='?
while current!= 1 { // '=' must have consistent whitespace on both sides
while current!= 1 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if current % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
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 == 1 {
            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 == 1 {
            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

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 { // use of '=' in a boolean context, did you mean '=='?
while current!= 1 { // '=' must have consistent whitespace on both sides
while current!= 1 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if current % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if current % 2!= 0 { // '=' must have consistent whitespace on both sides

func validDate(date: String) -> Bool {
    // TODO:
    let dateComponents = date.components(separatedBy: "-")
    let month = Int(dateComponents[0])?? 0
    let day = Int(dateComponents[1])?? 0
    let year = Int(dateComponents[2])?? 0
    
    if date.count < 10 || date.count > 10 {
        return false
    }
    
    if month < 1 || month > 12 {
        return false
    }
    
    if day < 1 || day > 31 {
        return false
    }
    
    if month == 2 {
        if day < 1 || day > 29 {
            return false
        }
    } else if month == 4 || month == 6 || month == 9 || month == 11 {
        if day < 1 || day > 30 {
            return false
        }
    }
    
    return true
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    // TODO:
    let dateComponents = date.components(separatedBy: "-")
    let month = Int(dateComponents[0])?? 0
    let day = Int(dateComponents[1])?? 0
    let year = Int(dateComponents[2])?? 0
    
    if date.count < 10 || date.count > 10 {
        return false
    }
    
    if month < 1 || month > 12 {
        return false
    }
    
    if day < 1 || day > 31 {
        return false
    }
    
    if month == 2 {
        if day < 1 || day > 29 {
            return false
        }
    } else if month == 4 || month == 6 || month == 9 || month == 11 {
        if day < 1 || day > 30 {
            return false
        }
    }
    
    return true
}
```
let month = Int(dateComponents[0])?? 0 // consecutive statements on a line must be separated by ';'
let month = Int(dateComponents[0])?? 0 // integer literal is unused
let month = Int(dateComponents[0])?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let day = Int(dateComponents[1])?? 0 // integer literal is unused
let day = Int(dateComponents[1])?? 0 // consecutive statements on a line must be separated by ';'
let day = Int(dateComponents[1])?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let year = Int(dateComponents[2])?? 0 // consecutive statements on a line must be separated by ';'
let year = Int(dateComponents[2])?? 0 // integer literal is unused
let year = Int(dateComponents[2])?? 0 // cannot use optional chaining on non-optional value of type 'Int'

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 {
    // 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 {
    // TODO: Your implementation goes here.
    let dateComponents = date.components(separatedBy: "-")
    let month = Int(dateComponents[0])!
    let day = Int(dateComponents[1])!
    let year = Int(dateComponents[2])!
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    if date == nil {
        return false
    }
    let calendar = Calendar.current
    let dateComponents = calendar.dateComponents([.year,.month,.day], from: date!)
    if dateComponents.day < 1 || dateComponents.day > 31 {
        return false
    }
    if dateComponents.month == 2 {
        if dateComponents.day < 1 || dateComponents.day > 29 {
            return false
        }
    } else if dateComponents.month == 4 || dateComponents.month == 6 || dateComponents.month == 9 || dateComponents.month == 11 {
        if dateComponents.day < 1 || dateComponents.day > 30 {
            return false
        }
    }
    if dateComponents.month < 1 || dateComponents.month > 12 {
        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 {
    // TODO: Your implementation goes here.
    let dateComponents = date.components(separatedBy: "-")
    let month = Int(dateComponents[0])!
    let day = Int(dateComponents[1])!
    let year = Int(dateComponents[2])!
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    if date == nil {
        return false
    }
    let calendar = Calendar.current
    let dateComponents = calendar.dateComponents([.year,.month,.day], from: date!)
    if dateComponents.day < 1 || dateComponents.day > 31 {
        return false
    }
    if dateComponents.month == 2 {
        if dateComponents.day < 1 || dateComponents.day > 29 {
            return false
        }
    } else if dateComponents.month == 4 || dateComponents.month == 6 || dateComponents.month == 9 || dateComponents.month == 11 {
        if dateComponents.day < 1 || dateComponents.day > 30 {
            return false
        }
    }
    if dateComponents.month < 1 || dateComponents.month > 12 {
        return false
    }
    return true
}
```
let dateComponents = calendar.dateComponents([.year,.month,.day], from: date!) // invalid redeclaration of 'dateComponents'

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 <= 29
    }
    if [3, 5, 7, 8, 10, 12].contains(month) {
        return day >= 1 && day <= 31
    }
    if [4, 6, 9, 11].contains(month) {
        return day >= 1 && day <= 30
    }
    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 {
    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 <= 29
    }
    if [3, 5, 7, 8, 10, 12].contains(month) {
        return day >= 1 && day <= 31
    }
    if [4, 6, 9, 11].contains(month) {
        return day >= 1 && day <= 30
    }
    return false
}
```
if dateComponents.count!= 3 { // '=' must have consistent whitespace on both sides
if dateComponents.count!= 3 { // cannot force unwrap value of non-optional type 'Int'
if dateComponents.count!= 3 { // use of '=' in a boolean context, did you mean '=='?
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 <= 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 <= 31 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return day >= 1 && day <= 31 // 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 {
    // TODO: Implement this function
    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: Implement this function
    return false
}
```
 // XCTAssertTrue failed

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 {
    // 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

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> {
    // 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> {
    // TODO: implement
}
```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
}
```
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> {
    // 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> {
    //...
}

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> {
    //...
}

// 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> {
    //...
}

// 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
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> {
    //...
}

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> {
    //...
}
```
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.components(separatedBy:.whitespacesAndNewlines))
}

func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.components(separatedBy:.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.components(separatedBy:.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.components(separatedBy:.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.components(separatedBy:.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.components(separatedBy:.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.components(separatedBy:.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.components(separatedBy:.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
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> {
    //...
}

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> {
    //...
}
```
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.components(separatedBy: ",").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 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.components(separatedBy: ",").map { String($0) })
}

// 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.components(separatedBy: ",").map { String($0) })
}

// 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.components(separatedBy: ",").map { String($0) })
}
```
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: " ")
    return.success(words.map { String($0) })
}

func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    return.success(words.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> {
    let words = txt.split(separator: " ")
    return.success(words.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> {
    let words = txt.split(separator: " ")
    return.success(words.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> {
    let words = txt.split(separator: " ")
    return.success(words.map { String($0) })
}
```
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 = false
    var last = 0
    for i in 0..<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 = 0
    for i in 0..<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 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 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 = true
    var prev = lst[0]
    for i in 1..<lst.count {
        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 {
        if lst[i] < prev {
            sorted = false
            break
        }
        prev = lst[i]
    }
    return sorted
}
```
 // Fatal error: Index out of range

func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 0..<lst.count - 1 {
        if lst[i] > lst[i + 1] {
            sorted = false
            break
        }
    }
    return sorted
}
```swift
// Given an array of numbers, return whether or not they are sorted
// in ascending order. If array has more than 1 duplicate of the same
// number, return false. Assume no negative numbers and only integers.
// Examples
// isSorted(lst: [5]) == true
// isSorted(lst: [1, 2, 3, 4, 5]) == true
// isSorted(lst: [1, 3, 2, 4, 5]) == false
// isSorted(lst: [1, 2, 3, 4, 5, 6]) == true
// isSorted(lst: [1, 2, 3, 4, 5, 6, 7]) == true
// isSorted(lst: [1, 3, 2, 4, 5, 6, 7]) == false
// isSorted(lst: [1, 2, 2, 3, 3, 4]) == true
// isSorted(lst: [1, 2, 2, 2, 3, 4]) == false
func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 0..<lst.count - 1 {
        if lst[i] > lst[i + 1] {
            sorted = false
            break
        }
    }
    return sorted
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 0..<lst.count-1 {
        if lst[i] > lst[i+1] {
            sorted = false
            break
        }
    }
    return sorted
}
```swift
// Given an array of numbers, return whether or not they are sorted
// in ascending order. If array has more than 1 duplicate of the same
// number, return false. Assume no negative numbers and only integers.
// Examples
// isSorted(lst: [5]) == true
// isSorted(lst: [1, 2, 3, 4, 5]) == true
// isSorted(lst: [1, 3, 2, 4, 5]) == false
// isSorted(lst: [1, 2, 3, 4, 5, 6]) == true
// isSorted(lst: [1, 2, 3, 4, 5, 6, 7]) == true
// isSorted(lst: [1, 3, 2, 4, 5, 6, 7]) == false
// isSorted(lst: [1, 2, 2, 3, 3, 4]) == true
// isSorted(lst: [1, 2, 2, 2, 3, 4]) == false
func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    for i in 0..<lst.count-1 {
        if lst[i] > lst[i+1] {
            sorted = false
            break
        }
    }
    return sorted
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func 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 intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // If the two intervals don't intersect, return "NO".
    if interval1.0 > interval2.1 || interval2.0 > interval1.1 {
        return "NO"
    }
    // If the length of the intersection is a prime number, return "YES",
    // otherwise, return "NO".
    if isPrime(interval1.1 - interval1.0) {
        return "YES"
    } else {
        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 {
    // If the two intervals don't intersect, return "NO".
    if interval1.0 > interval2.1 || interval2.0 > interval1.1 {
        return "NO"
    }
    // If the length of the intersection is a prime number, return "YES",
    // otherwise, return "NO".
    if isPrime(interval1.1 - interval1.0) {
        return "YES"
    } else {
        return "NO"
    }
}
```
if isPrime(interval1.1 - interval1.0) { // cannot find 'isPrime' in scope

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    
    if start1 > end2 || start2 > end1 {
        return "NO"
    }
    
    let intersection = (max(start1, start2), min(end1, end2))
    return isPrime(intersection.1 - intersection.0 + 1)? "YES" : "NO"
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    
    if start1 > end2 || start2 > end1 {
        return "NO"
    }
    
    let intersection = (max(start1, start2), min(end1, end2))
    return isPrime(intersection.1 - intersection.0 + 1)? "YES" : "NO"
}
```
return isPrime(intersection.1 - intersection.0 + 1)? "YES" : "NO" // expected expression
return isPrime(intersection.1 - intersection.0 + 1)? "YES" : "NO" // consecutive statements on a line must be separated by ';'
return isPrime(intersection.1 - intersection.0 + 1)? "YES" : "NO" // consecutive statements on a line must be separated by ';'
return isPrime(intersection.1 - intersection.0 + 1)? "YES" : "NO" // cannot find 'isPrime' in scope
return isPrime(intersection.1 - intersection.0 + 1)? "YES" : "NO" // cannot convert return expression of type 'Optional<_>' to return type 'String'
return isPrime(intersection.1 - intersection.0 + 1)? "YES" : "NO" // string literal is unused

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)
    
    let length = end - start + 1
    
    if length == 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)
    
    let length = end - start + 1
    
    if length == 1 {
        return "YES"
    }
    
    return "NO"
}
```
 // XCTAssertTrue failed

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // Your code here
    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 {
    // Your code here
    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 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 start1 > end2 || start2 > end1 {
        return "NO"
    }
    
    let intersection = (max(start1, start2), min(end1, end2))
    let (start, end) = intersection
    
    if start == end {
        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 > end2 || start2 > end1 {
        return "NO"
    }
    
    let intersection = (max(start1, start2), min(end1, end2))
    let (start, end) = intersection
    
    if start == end {
        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 {
    let start = max(interval1.0, interval2.0)
    let end = min(interval1.1, interval2.1)
    if start > end {
        return "NO"
    }
    let length = end - start
    if length == 1 {
        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"
    }
    let length = end - start
    if length == 1 {
        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 start1 > end1 || start2 > end2 {
        return "NO"
    }
    
    let start = max(start1, start2)
    let end = min(end1, end2)
    
    let length = end - start + 1
    
    if length < 2 {
        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 start = max(start1, start2)
    let end = min(end1, end2)
    
    let length = end - start + 1
    
    if length < 2 {
        return "NO"
    }
    
    return "YES"
}
```
 // 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? {
    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.isEmpty else {
        return nil
    }
    var sum = 0
    var product = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            product = 0
        } else 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.isEmpty else {
        return nil
    }
    var sum = 0
    var product = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            product = 0
        } else if arr[i] > 0 {
            product *= 1
        } else if arr[i] < 0 {
            product *= -1
        }
        sum += abs(arr[i])
    }
    return sum * product
}
```
guard!arr.isEmpty else { // expected expression, var, let or case in 'guard' condition

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 {
            product = 0
            break
        }
        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 {
            product = 0
            break
        }
        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.isEmpty 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.isEmpty 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
}
```
guard!arr.isEmpty else { // expected expression, var, let or case in 'guard' condition

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 {
            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 {
            sum -= arr[i]
        }
        
        product *= arr[i]
    }
    
    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 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? {
    if arr.isEmpty { return nil }
    var sum = 0
    var prod = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        } else 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? {
    if arr.isEmpty { return nil }
    var sum = 0
    var prod = 1
    for i in 0..<arr.count {
        if arr[i] == 0 {
            return 0
        } else 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? {
    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 minPath(grid: [[Int]], k: Int) -> [Int] {
    // Write your solution here
    var visited = [Int]()
    var path = [Int]()
    var queue = [Int]()
    var min = 0
    var minPath = [Int]()
    
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            visited.append(grid[i][j])
            queue.append(grid[i][j])
        }
    }
    
    while k > 0 {
        min = visited.min()!
        path.append(min)
        visited.remove(at: visited.firstIndex(of: min)!)
        queue.remove(at: queue.firstIndex(of: min)!)
        k -= 1
    }
    
    for i in 0..<path.count {
        minPath.append(queue[path[i] - 1])
    }
    
    return minPath
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    // Write your solution here
    var visited = [Int]()
    var path = [Int]()
    var queue = [Int]()
    var min = 0
    var minPath = [Int]()
    
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            visited.append(grid[i][j])
            queue.append(grid[i][j])
        }
    }
    
    while k > 0 {
        min = visited.min()!
        path.append(min)
        visited.remove(at: visited.firstIndex(of: min)!)
        queue.remove(at: queue.firstIndex(of: min)!)
        k -= 1
    }
    
    for i in 0..<path.count {
        minPath.append(queue[path[i] - 1])
    }
    
    return minPath
}
```
k -= 1 // left side of mutating operator isn't mutable: 'k' is a 'let' constant

func minPath(grid: [[Int]], k: Int) -> [Int] {
    
}
```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] {
    
}
```
} // 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: 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 solution here
    let n = grid.count
    let m = grid[0].count
    var path = [Int]()
    var visited = [[Bool]](repeating: [Bool](repeating: false, count: m), count: n)
    var queue = [Int]()
    queue.append(0)
    visited[0][0] = true
    var count = 0
    while count < k {
        let curr = queue.removeFirst()
        let row = curr / m
        let col = curr % m
        if row == n - 1 && col == m - 1 {
            count = k
        } else {
            if col < m - 1 {
                if!visited[row][col + 1] {
                    visited[row][col + 1] = true
                    queue.append(curr + 1)
                }
            }
            if row < n - 1 {
                if!visited[row + 1][col] {
                    visited[row + 1][col] = true
                    queue.append(curr + m)
                }
            }
            if col > 0 {
                if!visited[row][col - 1] {
                    visited[row][col - 1] = true
                    queue.append(curr - 1)
                }
            }
            if row > 0 {
                if!visited[row - 1][col] {
                    visited[row - 1][col] = true
                    queue.append(curr - m)
                }
            }
        }
        count += 1
    }
    
    var curr = 0
    while curr < n * m {
        let row = curr / m
        let col = curr % m
        path.append(grid[row][col])
        curr += 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] {
    // Write your solution here
    let n = grid.count
    let m = grid[0].count
    var path = [Int]()
    var visited = [[Bool]](repeating: [Bool](repeating: false, count: m), count: n)
    var queue = [Int]()
    queue.append(0)
    visited[0][0] = true
    var count = 0
    while count < k {
        let curr = queue.removeFirst()
        let row = curr / m
        let col = curr % m
        if row == n - 1 && col == m - 1 {
            count = k
        } else {
            if col < m - 1 {
                if!visited[row][col + 1] {
                    visited[row][col + 1] = true
                    queue.append(curr + 1)
                }
            }
            if row < n - 1 {
                if!visited[row + 1][col] {
                    visited[row + 1][col] = true
                    queue.append(curr + m)
                }
            }
            if col > 0 {
                if!visited[row][col - 1] {
                    visited[row][col - 1] = true
                    queue.append(curr - 1)
                }
            }
            if row > 0 {
                if!visited[row - 1][col] {
                    visited[row - 1][col] = true
                    queue.append(curr - m)
                }
            }
        }
        count += 1
    }
    
    var curr = 0
    while curr < n * m {
        let row = curr / m
        let col = curr % m
        path.append(grid[row][col])
        curr += 1
    }
    return path
}
```
if!visited[row][col + 1] { // expected expression, var, or let in 'if' condition
if!visited[row + 1][col] { // expected expression, var, or let in 'if' condition
if!visited[row][col - 1] { // expected expression, var, or let in 'if' condition
if!visited[row - 1][col] { // 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 solution 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 solution here
}
```
} // missing return in global function expected to return '[Int]'

func minPath(grid: [[Int]], k: Int) -> [Int] {
    // Write your code here
    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 count = 0
    while count < k {
        let cur = queue.removeFirst()
        let row = cur / n
        let col = cur % n
        path.append(grid[row][col])
        count += 1
        if row > 0 {
            if!visited[cur - n] {
                queue.append(cur - n)
                visited[cur - n] = true
            }
        }
        if row < n - 1 {
            if!visited[cur + n] {
                queue.append(cur + n)
                visited[cur + n] = true
            }
        }
        if col > 0 {
            if!visited[cur - 1] {
                queue.append(cur - 1)
                visited[cur - 1] = true
            }
        }
        if col < n - 1 {
            if!visited[cur + 1] {
                queue.append(cur + 1)
                visited[cur + 1] = true
            }
        }
    }
    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] {
    // Write your code here
    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 count = 0
    while count < k {
        let cur = queue.removeFirst()
        let row = cur / n
        let col = cur % n
        path.append(grid[row][col])
        count += 1
        if row > 0 {
            if!visited[cur - n] {
                queue.append(cur - n)
                visited[cur - n] = true
            }
        }
        if row < n - 1 {
            if!visited[cur + n] {
                queue.append(cur + n)
                visited[cur + n] = true
            }
        }
        if col > 0 {
            if!visited[cur - 1] {
                queue.append(cur - 1)
                visited[cur - 1] = true
            }
        }
        if col < n - 1 {
            if!visited[cur + 1] {
                queue.append(cur + 1)
                visited[cur + 1] = true
            }
        }
    }
    return path
}
```
var visited = [Int](repeating: false, count: n*n) // cannot convert value of type 'Bool' to expected argument type 'Int'
if!visited[cur - n] { // expected expression, var, or let in 'if' condition
if!visited[cur + n] { // expected expression, var, or let in 'if' condition
if!visited[cur - 1] { // expected expression, var, or let in 'if' condition
if!visited[cur + 1] { // expected expression, var, or let in 'if' condition

func minPath(grid: [[Int]], k: Int) -> [Int] {
    // Write your solution here
    let n = grid.count
    var dp = Array(repeating: [Int](n), count: k + 1)
    for i in 0..<k + 1 {
        dp[i][0] = grid[0][0]
    }
    for i in 1..<n {
        for j in 1..<n {
            dp[0][i] = grid[i][j]
            for k in 1..<k + 1 {
                dp[k][i] = min(dp[k][i - 1], dp[k - 1][i - 1]) + grid[i][j]
            }
        }
    }
    var res = [Int]()
    var i = k
    while i > 0 {
        res.append(dp[i][n - 1])
        i -= 1
    }
    return res.reversed()
}
```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
    let n = grid.count
    var dp = Array(repeating: [Int](n), count: k + 1)
    for i in 0..<k + 1 {
        dp[i][0] = grid[0][0]
    }
    for i in 1..<n {
        for j in 1..<n {
            dp[0][i] = grid[i][j]
            for k in 1..<k + 1 {
                dp[k][i] = min(dp[k][i - 1], dp[k - 1][i - 1]) + grid[i][j]
            }
        }
    }
    var res = [Int]()
    var i = k
    while i > 0 {
        res.append(dp[i][n - 1])
        i -= 1
    }
    return res.reversed()
}
```
var dp = Array(repeating: [Int](n), count: k + 1) // missing argument label 'arrayLiteral:' in call

func minPath(grid: [[Int]], k: Int) -> [Int] {
    // Write your solution here
    return []
}
```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
    return []
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    // write your code in Swift 4.0
    
}
```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 in Swift 4.0
    
}
```
} // missing return in global function expected to return '[Int]'

func tri(n: Int) -> [Int] {
    // Write your code here
    var tribonacci = [Int]()
    tribonacci.append(1)
    tribonacci.append(3)
    tribonacci.append(2)
    
    if n == 0 {
        return tribonacci
    }
    
    for i in 3...n {
        if i % 2 == 0 {
            tribonacci.append(i / 2)
        } 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] {
    // Write your code here
    var tribonacci = [Int]()
    tribonacci.append(1)
    tribonacci.append(3)
    tribonacci.append(2)
    
    if n == 0 {
        return tribonacci
    }
    
    for i in 3...n {
        if i % 2 == 0 {
            tribonacci.append(i / 2)
        } else {
            tribonacci.append(tribonacci[i - 1] + tribonacci[i - 2] + tribonacci[i - 3])
        }
    }
    
    return tribonacci
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    // Write your code here
    var result = [Int]()
    result.append(1)
    result.append(3)
    if n == 1 {
        return result
    }
    result.append(2)
    if n == 2 {
        return result
    }
    for i in 3...n {
        if i % 2 == 0 {
            result.append(i / 2 + 1)
        } else {
            result.append(result[i - 1] + result[i - 2] + result[i - 3])
        }
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    // Write your code here
    var result = [Int]()
    result.append(1)
    result.append(3)
    if n == 1 {
        return result
    }
    result.append(2)
    if n == 2 {
        return result
    }
    for i in 3...n {
        if i % 2 == 0 {
            result.append(i / 2 + 1)
        } else {
            result.append(result[i - 1] + result[i - 2] + result[i - 3])
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    var result = [Int]()
    var prev1 = 1
    var prev2 = 1
    var prev3 = 2
    result.append(prev1)
    result.append(prev2)
    result.append(prev3)
    for i in 3...n {
        let next = prev1 + prev2 + prev3
        result.append(next)
        prev1 = prev2
        prev2 = prev3
        prev3 = 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]()
    var prev1 = 1
    var prev2 = 1
    var prev3 = 2
    result.append(prev1)
    result.append(prev2)
    result.append(prev3)
    for i in 3...n {
        let next = prev1 + prev2 + prev3
        result.append(next)
        prev1 = prev2
        prev2 = prev3
        prev3 = next
    }
    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 result = [Int]()
    result.append(1)
    result.append(3)
    if n == 1 {
        return result
    }
    result.append(2)
    if n == 2 {
        return result
    }
    for i in 3...n {
        if i % 2 == 0 {
            result.append(i / 2 + 1)
        } else {
            result.append(result[i - 1] + result[i - 2] + result[i - 3])
        }
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    var result = [Int]()
    result.append(1)
    result.append(3)
    if n == 1 {
        return result
    }
    result.append(2)
    if n == 2 {
        return result
    }
    for i in 3...n {
        if i % 2 == 0 {
            result.append(i / 2 + 1)
        } else {
            result.append(result[i - 1] + result[i - 2] + result[i - 3])
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    // Write your code here
    var tribonacci = [Int]()
    tribonacci.append(1)
    tribonacci.append(3)
    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 - 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] {
    // Write your code here
    var tribonacci = [Int]()
    tribonacci.append(1)
    tribonacci.append(3)
    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 - 1] + tribonacci[i - 2] + tribonacci[i - 3])
        }
    }
    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
    }
    if n == 2 {
        return [1, 3, 2]
    }
    var i = 3
    while i < n {
        if i % 2 == 0 {
            result.append(i / 2 + 1)
        } else {
            result.append(result[i - 1] + result[i - 2] + result[i - 3])
        }
        i += 1
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    var result = [Int]()
    result.append(1)
    result.append(3)
    result.append(2)
    if n == 1 {
        return result
    }
    if n == 2 {
        return [1, 3, 2]
    }
    var i = 3
    while i < n {
        if i % 2 == 0 {
            result.append(i / 2 + 1)
        } else {
            result.append(result[i - 1] + result[i - 2] + result[i - 3])
        }
        i += 1
    }
    return result
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    var result = [Int]()
    result.append(1)
    result.append(3)
    
    if n == 1 {
        return result
    }
    
    result.append(2)
    
    for i in 2...n {
        if i % 2 == 0 {
            result.append(i / 2)
        } else {
            result.append(result[i - 1] + result[i - 2] + result[i - 3])
        }
    }
    
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    var result = [Int]()
    result.append(1)
    result.append(3)
    
    if n == 1 {
        return result
    }
    
    result.append(2)
    
    for i in 2...n {
        if i % 2 == 0 {
            result.append(i / 2)
        } else {
            result.append(result[i - 1] + result[i - 2] + result[i - 3])
        }
    }
    
    return result
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    var result = [Int]()
    result.append(1)
    result.append(3)
    if n == 1 {
        return result
    }
    result.append(2)
    if n == 2 {
        return result
    }
    for i in 3...n {
        if i % 2 == 0 {
            result.append(i / 2 + 1)
        } else {
            result.append(result[i - 1] + result[i - 2] + result[i - 3])
        }
    }
    return result
}
```swift
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in 
// the last couple centuries. However, what people don't know is Tribonacci sequence.
// Tribonacci sequence is defined by the recurrence:
// tri(1) = 3
// tri(n) = 1 + n / 2, if n is even.
// tri(n) =  tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
// For example:
// tri(2) = 1 + (2 / 2) = 2
// tri(4) = 3
// tri(3) = tri(2) + tri(1) + tri(4)
// = 2 + 3 + 3 = 8 
// You are given a non-negative integer number n, you have to a return an array of the 
// first n + 1 numbers of the Tribonacci sequence.
// Examples:
// tri(n: 3) == [1, 3, 2, 8]
func tri(n: Int) -> [Int] {
    var result = [Int]()
    result.append(1)
    result.append(3)
    if n == 1 {
        return result
    }
    result.append(2)
    if n == 2 {
        return result
    }
    for i in 3...n {
        if i % 2 == 0 {
            result.append(i / 2 + 1)
        } else {
            result.append(result[i - 1] + result[i - 2] + result[i - 3])
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    var result = [Int]()
    var a = 1
    var b = 1
    var c = 2
    result.append(a)
    result.append(b)
    result.append(c)
    for _ in 1...n {
        let next = a + b + c
        a = b
        b = c
        c = next
        result.append(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]()
    var a = 1
    var b = 1
    var c = 2
    result.append(a)
    result.append(b)
    result.append(c)
    for _ in 1...n {
        let next = a + b + c
        a = b
        b = c
        c = next
        result.append(next)
    }
    return result
}
```
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
    var result = 1
    for i in 0..<n.bitCount {
        if (n & (1 << i))!= 0 {
            if (i & 1) == 1 {
                result *= n & (1 << i)
            } else {
                result *= n & (1 << i)
            }
        }
    }
    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
    for i in 0..<n.bitCount {
        if (n & (1 << i))!= 0 {
            if (i & 1) == 1 {
                result *= n & (1 << i)
            } else {
                result *= n & (1 << i)
            }
        }
    }
    return result
}
```
for i in 0..<n.bitCount { // value of type 'Int' has no member 'bitCount'
if (n & (1 << i))!= 0 { // '=' must have consistent whitespace on both sides

func digits(n: Int) -> Int {
    var product = 1
    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
    while n > 0 {
        let digit = n % 10
        if digit % 2!= 0 {
            product *= digit
        }
        n /= 10
    }
    return product
}
```
if digit % 2!= 0 { // '=' must have consistent whitespace on both sides
if digit % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
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'
n /= 10 // left side of mutating operator isn't mutable: 'n' is a 'let' constant

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 result = 1
    var digit = n
    while digit > 0 {
        let digit = digit % 10
        if digit % 2 == 1 {
            result *= digit
        }
        digit /= 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 digit = n
    while digit > 0 {
        let digit = digit % 10
        if digit % 2 == 1 {
            result *= digit
        }
        digit /= 10
    }
    return result
}
```
digit /= 10 // left side of mutating operator isn't mutable: 'digit' is a 'let' constant

func digits(n: Int) -> Int {
    var result = 1
    for i in 0..<n.bitCount {
        if n & (1 << i)!= 0 {
            result *= (n & (1 << i))
        }
    }
    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
    for i in 0..<n.bitCount {
        if n & (1 << i)!= 0 {
            result *= (n & (1 << i))
        }
    }
    return result
}
```
for i in 0..<n.bitCount { // value of type 'Int' has no member 'bitCount'
if n & (1 << i)!= 0 { // '=' must have consistent whitespace on both sides

func digits(n: Int) -> Int {
    var result = 1
    for i in 0..<5 {
        if n % 10 == 0 {
            return 0
        }
        if n % 10!= 0 {
            if n % 2 == 0 {
                return 0
            } else {
                result *= n % 10
            }
        }
        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
    for i in 0..<5 {
        if n % 10 == 0 {
            return 0
        }
        if n % 10!= 0 {
            if n % 2 == 0 {
                return 0
            } else {
                result *= n % 10
            }
        }
        n /= 10
    }
    return result
}
```
if n % 10!= 0 { // cannot force unwrap value of non-optional type 'Int'
if n % 10!= 0 { // use of '=' in a boolean context, did you mean '=='?
if n % 10!= 0 { // '=' must have consistent whitespace on both sides
if n % 10!= 0 { // expression is not assignable: binary operator returns immutable value
n /= 10 // left side of mutating operator isn't mutable: 'n' is a 'let' constant

func digits(n: Int) -> Int {
    var result = 1
    var n = n
    while n > 0 {
        let digit = n % 10
        if digit % 2!= 0 {
            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!= 0 {
            result *= digit
        }
        n /= 10
    }
    return result
}
```
if digit % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
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'
if digit % 2!= 0 { // '=' must have consistent whitespace on both sides

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 = 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 = n / 10
    }
    return result
}
```
 // XCTAssertTrue failed

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

func digits(n: Int) -> Int {
    var result = 1
    for i in 0..<String(n).characters.count {
        if i % 2 == 1 {
            result *= Int(String(n).characters[i])
        }
    }
    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
    for i in 0..<String(n).characters.count {
        if i % 2 == 1 {
            result *= Int(String(n).characters[i])
        }
    }
    return result
}
```
for i in 0..<String(n).characters.count { // 'characters' is unavailable: Please use String directly
result *= Int(String(n).characters[i]) // no exact matches in call to initializer

func isNested(string: String) -> Bool {
    
    var stack = [Character]()
    
    for character in string {
        switch character {
        case "[":
            stack.append(character)
        case "]":
            if stack.isEmpty {
                return false
            }
            
            let last = stack.removeLast()
            if last!= "[" {
                return false
            }
        default:
            return false
        }
    }
    
    return stack.isEmpty
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    
    var stack = [Character]()
    
    for character in string {
        switch character {
        case "[":
            stack.append(character)
        case "]":
            if stack.isEmpty {
                return false
            }
            
            let last = stack.removeLast()
            if last!= "[" {
                return false
            }
        default:
            return false
        }
    }
    
    return stack.isEmpty
}
```
if last!= "[" { // '=' must have consistent whitespace on both sides
if last!= "[" { // cannot force unwrap value of non-optional type 'Character'
if last!= "[" { // use of '=' in a boolean context, did you mean '=='?

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 implementation goes here
    
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    
    // Your implementation goes 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
}
```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
}
```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 {
    
}
```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
    
    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 num in lst {
        sum += Int(num.squareRoot().nextGreaterInt())
    }
    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(num.squareRoot().nextGreaterInt())
    }
    return sum
}
```
sum += Int(num.squareRoot().nextGreaterInt()) // value of type 'Double' has no member 'nextGreaterInt'

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 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 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 result = 0
    for i in lst {
        result += Int(ceil(i * i))
    }
    return result
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    var result = 0
    for i in lst {
        result += Int(ceil(i * i))
    }
    return result
}
```
 // 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 result = 0
    for i in lst {
        result += Int(ceil(i*i))
    }
    return result
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    var result = 0
    for i in lst {
        result += Int(ceil(i*i))
    }
    return result
}
```
 // 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
    return false
}
```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
    return false
}
```
 // 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 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 {
    var maxIndex = -1
    var maxValue = 0
    for i in 0..<arr.count {
        if arr[i] <= maxValue {
            maxIndex = i
            break
        }
        maxValue = arr[i]
    }
    return maxIndex
}
```swift
// Create a function which returns the largest index of an element which
// is not greater than or equal to the element immediately preceding it. If
// no such element exists then return -1. The given array will not contain
// duplicate values.
// Examples:
// canArrange(arr: [1, 2, 4, 3, 5]) == 3
// canArrange(arr: [1, 2, 3]) == -1
func canArrange(arr: [Int]) -> Int {
    var maxIndex = -1
    var maxValue = 0
    for i in 0..<arr.count {
        if arr[i] <= maxValue {
            maxIndex = i
            break
        }
        maxValue = arr[i]
    }
    return maxIndex
}
```
 // XCTAssertTrue failed

func canArrange(arr: [Int]) -> Int {
    var maxIndex = -1
    var maxValue = 0
    for i in 0..<arr.count {
        if arr[i] <= maxValue {
            return maxIndex
        }
        maxIndex = i
        maxValue = arr[i]
    }
    return maxIndex
}
```swift
// Create a function which returns the largest index of an element which
// is not greater than or equal to the element immediately preceding it. If
// no such element exists then return -1. The given array will not contain
// duplicate values.
// Examples:
// canArrange(arr: [1, 2, 4, 3, 5]) == 3
// canArrange(arr: [1, 2, 3]) == -1
func canArrange(arr: [Int]) -> Int {
    var maxIndex = -1
    var maxValue = 0
    for i in 0..<arr.count {
        if arr[i] <= maxValue {
            return maxIndex
        }
        maxIndex = i
        maxValue = arr[i]
    }
    return maxIndex
}
```
 // XCTAssertTrue failed

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int?
    var smallest: Int?
    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?
    var smallest: Int?
    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 largest: Int?
    var smallest: Int?
    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?
    var smallest: Int?
    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 largest: Int?
    var smallest: Int?
    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?
    var smallest: Int?
    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)
}
```
if i > 0 && (smallest == nil || i < smallest) { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
if i < 0 && (largest == nil || i > largest) { // 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 {
            if smallest == nil {
                smallest = i
            } else if i < smallest {
                smallest = i
            }
        } else if i < 0 {
            if largest == nil {
                largest = i
            } else if 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 {
            if smallest == nil {
                smallest = i
            } else if i < smallest {
                smallest = i
            }
        } else if i < 0 {
            if largest == nil {
                largest = i
            } else if i > largest {
                largest = i
            }
        }
    }
    return (largest, smallest)
}
```
} else if i < smallest { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
} else if i > largest { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var negative = nil
    var positive = nil
    for i in lst {
        if i < 0 {
            if negative == nil {
                negative = i
            } else if i < *negative {
                negative = i
            }
        } else if i > 0 {
            if positive == nil {
                positive = i
            } else if i > *positive {
                positive = i
            }
        }
    }
    return (negative, positive)
}
```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 negative = nil
    var positive = nil
    for i in lst {
        if i < 0 {
            if negative == nil {
                negative = i
            } else if i < *negative {
                negative = i
            }
        } else if i > 0 {
            if positive == nil {
                positive = i
            } else if i > *positive {
                positive = i
            }
        }
    }
    return (negative, positive)
}
```
var negative = nil // 'nil' requires a contextual type
var positive = nil // 'nil' requires a contextual type
} else if i < *negative { // '*' is not a prefix unary operator
} else if i > *positive { // '*' is not a prefix unary operator

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var negative = nil
    var positive = nil
    for i in lst {
        if i < 0 {
            if negative == nil {
                negative = i
            } else {
                negative = min(negative, i)
            }
        } else if i > 0 {
            if positive == nil {
                positive = i
            } else {
                positive = max(positive, i)
            }
        }
    }
    return (negative, positive)
}
```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 negative = nil
    var positive = nil
    for i in lst {
        if i < 0 {
            if negative == nil {
                negative = i
            } else {
                negative = min(negative, i)
            }
        } else if i > 0 {
            if positive == nil {
                positive = i
            } else {
                positive = max(positive, i)
            }
        }
    }
    return (negative, positive)
}
```
var negative = nil // 'nil' requires a contextual type
var positive = nil // 'nil' requires a contextual type

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int?
    var smallest: Int?
    for i in 0...lst.count-1 {
        if lst[i] < 0 {
            if largest == nil {
                largest = lst[i]
            } else if lst[i] > largest! {
                largest = lst[i]
            }
        } else if lst[i] > 0 {
            if smallest == nil {
                smallest = lst[i]
            } else if lst[i] < smallest! {
                smallest = lst[i]
            }
        }
    }
    return (largest, smallest)
}
```swift
// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int?
    var smallest: Int?
    for i in 0...lst.count-1 {
        if lst[i] < 0 {
            if largest == nil {
                largest = lst[i]
            } else if lst[i] > largest! {
                largest = lst[i]
            }
        } else if lst[i] > 0 {
            if smallest == nil {
                smallest = lst[i]
            } else if lst[i] < smallest! {
                smallest = lst[i]
            }
        }
    }
    return (largest, smallest)
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int?
    var smallest: Int?
    for i in 0..<lst.count {
        if lst[i] < 0 {
            if largest == nil || lst[i] > largest! {
                largest = lst[i]
            }
        } else if lst[i] > 0 {
            if smallest == nil || lst[i] < smallest! {
                smallest = lst[i]
            }
        }
    }
    return (largest, smallest)
}
```swift
// Create a function that returns a tuple (a, b), where 'a' is
// the largest of negative integers, and 'b' is the smallest
// of positive integers in an array.
// If there is no negative or positive integers, return them as nil.
// Examples:
// largestSmallestIntegers(lst: [2, 4, 1, 3, 5, 7]) == (nil, 1)
// largestSmallestIntegers(lst: [] as [Int]) == (nil, nil)
// largestSmallestIntegers(lst: [0]) == (nil, nil)
func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    var largest: Int?
    var smallest: Int?
    for i in 0..<lst.count {
        if lst[i] < 0 {
            if largest == nil || lst[i] > largest! {
                largest = lst[i]
            }
        } else if lst[i] > 0 {
            if smallest == nil || lst[i] < smallest! {
                smallest = lst[i]
            }
        }
    }
    return (largest, smallest)
}
```

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 largest: Int? = nil
    var smallest: Int? = nil
    for i in lst {
        if i > 0 && (smallest == nil || i < smallest!) {
            smallest = i
        } else 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
        } else if i < 0 && (largest == nil || i > largest!) {
            largest = 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 (.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 (.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 type 'Int' has no member 'intValue'
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) // consecutive statements on a line must be separated by ';'
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 optional type 'Int?' must be unwrapped to a value of type 'Int'
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) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
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?.stringValue(a) :.stringValue(b) // cannot use optional chaining on non-optional value of type 'String'
return a > b?.stringValue(a) :.stringValue(b) // value of type 'String' has no member 'stringValue'
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) // 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) // consecutive statements on a line must be separated by ';'

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)?? 0
        let bFloat = Double(b)?? 0
        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)?? 0
        let bFloat = Double(b)?? 0
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}
```
return a > b?.intValue(a) :.intValue(b) // expected expression
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) // consecutive statements on a line must be separated by ';'
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?.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) // 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 use optional chaining on non-optional value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
let aFloat = Double(a)?? 0 // integer literal is unused
let aFloat = Double(a)?? 0 // consecutive statements on a line must be separated by ';'
let aFloat = Double(a)?? 0 // cannot use optional chaining on non-optional value of type 'Double'
let bFloat = Double(b)?? 0 // cannot use optional chaining on non-optional value of type 'Double'
let bFloat = Double(b)?? 0 // consecutive statements on a line must be separated by ';'
let bFloat = Double(b)?? 0 // integer literal is unused
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression
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) // value of optional type 'Optional<_>' must be unwrapped to a value of type '_'

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.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.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.intValue(a), let.doubleValue(b)):
        return a > b?.intValue(a) :.doubleValue(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.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) // expected expression
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) // consecutive statements on a line must be separated by ';'
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) :.doubleValue(b) // value of type 'Double' has no member 'intValue'
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) // 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) // consecutive statements on a line must be separated by ';'
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) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) :.intValue(b) // consecutive statements on a line must be separated by ';'
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) // cannot convert return expression of type 'Bool' to return type 'Value?'
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) // 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) :.doubleValue(b) // consecutive statements on a line must be separated by ';'
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) // expected expression
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of type 'Double' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // binary operator '>' cannot be applied to operands of type 'Double?' and 'Optional<_>'

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) : b > a?.intValue(b) : nil
    case (let.intValue(a), let.doubleValue(b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case (let.doubleValue(a), let.intValue(b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (let.stringValue(a), let.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    case (let.stringValue(a), let.intValue(b)):
        return a > b?.stringValue(a) : b > a?.intValue(b) : nil
    case (let.stringValue(a), let.doubleValue(b)):
        return a > b?.stringValue(a) : b > a?.doubleValue(b) : nil
    case (let.intValue(a), let.stringValue(b)):
        return a > b?.intValue(a) : b > a?.stringValue(b) : nil
    case (let.doubleValue(a), let.stringValue(b)):
        return a > b?.doubleValue(a) : b > a?.stringValue(b) : 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) : b > a?.intValue(b) : nil
    case (let.intValue(a), let.doubleValue(b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case (let.doubleValue(a), let.intValue(b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (let.stringValue(a), let.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    case (let.stringValue(a), let.intValue(b)):
        return a > b?.stringValue(a) : b > a?.intValue(b) : nil
    case (let.stringValue(a), let.doubleValue(b)):
        return a > b?.stringValue(a) : b > a?.doubleValue(b) : nil
    case (let.intValue(a), let.stringValue(b)):
        return a > b?.intValue(a) : b > a?.stringValue(b) : nil
    case (let.doubleValue(a), let.stringValue(b)):
        return a > b?.doubleValue(a) : b > a?.stringValue(b) : nil
    }
}
```
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
return a > b?.intValue(a) : b > a?.intValue(b) : nil // value of type 'Int' has no member 'intValue'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) : b > a?.doubleValue(b) : nil // cannot use optional chaining on non-optional value of type 'Double'
return a > b?.intValue(a) : b > a?.doubleValue(b) : nil // expected expression
return a > b?.intValue(a) : b > a?.doubleValue(b) : nil // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) : b > a?.doubleValue(b) : nil // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) : b > a?.doubleValue(b) : nil // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.doubleValue(b) : nil // value of type 'Double' has no member 'intValue'
return a > b?.doubleValue(a) : b > a?.intValue(b) : nil // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) : b > a?.intValue(b) : nil // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) : b > a?.intValue(b) : nil // expected expression
return a > b?.doubleValue(a) : b > a?.intValue(b) : nil // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.doubleValue(a) : b > a?.intValue(b) : nil // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) : b > a?.intValue(b) : nil // value of type 'Int' has no member 'doubleValue'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // cannot use optional chaining on non-optional value of type 'Double'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
return a > b?.stringValue(a) : b > a?.stringValue(b) : nil // cannot use optional chaining on non-optional value of type 'String'
return a > b?.stringValue(a) : b > a?.stringValue(b) : nil // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.stringValue(a) : b > a?.stringValue(b) : nil // value of type 'String' has no member 'stringValue'
return a > b?.stringValue(a) : b > a?.stringValue(b) : nil // value of optional type 'String?' must be unwrapped to a value of type 'String'
return a > b?.stringValue(a) : b > a?.stringValue(b) : nil // expected expression
return a > b?.stringValue(a) : b > a?.stringValue(b) : nil // consecutive statements on a line must be separated by ';'
return a > b?.stringValue(a) : b > a?.intValue(b) : nil // value of type 'Int' has no member 'stringValue'
return a > b?.stringValue(a) : b > a?.intValue(b) : nil // consecutive statements on a line must be separated by ';'
return a > b?.stringValue(a) : b > a?.intValue(b) : nil // value of optional type 'String?' must be unwrapped to a value of type 'String'
return a > b?.stringValue(a) : b > a?.intValue(b) : nil // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.stringValue(a) : b > a?.intValue(b) : nil // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.stringValue(a) : b > a?.intValue(b) : nil // expected expression
return a > b?.stringValue(a) : b > a?.doubleValue(b) : nil // value of optional type 'String?' must be unwrapped to a value of type 'String'
return a > b?.stringValue(a) : b > a?.doubleValue(b) : nil // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.stringValue(a) : b > a?.doubleValue(b) : nil // value of type 'Double' has no member 'stringValue'
return a > b?.stringValue(a) : b > a?.doubleValue(b) : nil // expected expression
return a > b?.stringValue(a) : b > a?.doubleValue(b) : nil // cannot use optional chaining on non-optional value of type 'Double'
return a > b?.stringValue(a) : b > a?.doubleValue(b) : nil // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.stringValue(b) : nil // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) : b > a?.stringValue(b) : nil // cannot use optional chaining on non-optional value of type 'String'
return a > b?.intValue(a) : b > a?.stringValue(b) : nil // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) : b > a?.stringValue(b) : nil // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.stringValue(b) : nil // expected expression
return a > b?.intValue(a) : b > a?.stringValue(b) : nil // value of type 'String' has no member 'intValue'
return a > b?.doubleValue(a) : b > a?.stringValue(b) : nil // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) : b > a?.stringValue(b) : nil // cannot use optional chaining on non-optional value of type 'String'
return a > b?.doubleValue(a) : b > a?.stringValue(b) : nil // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) : b > a?.stringValue(b) : nil // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) : b > a?.stringValue(b) : nil // value of type 'String' has no member 'doubleValue'
return a > b?.doubleValue(a) : b > a?.stringValue(b) : nil // 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
    }
}

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 = Double(a)
        let bFloat = Double(b)
        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 = 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
    }
}

// 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 = Double(a)
        let bFloat = Double(b)
        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 = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}
```
return a > b?.intValue(a) :.intValue(b) // expected expression
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) // consecutive statements on a line must be separated by ';'
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?.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) // 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 use optional chaining on non-optional value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // 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) // binary operator '>' cannot be applied to operands of type 'Double?' and 'Optional<_>'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression
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 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) // 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) :.intValue(b) // expected expression
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) // expected expression
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 aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of type 'Double' 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) // binary operator '>' cannot be applied to operands of type 'Double?' and 'Optional<_>'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // 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?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
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) // 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) // 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) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
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
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) // value of type 'Double' has no member 'doubleValue'

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) // 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) // consecutive statements on a line must be separated by ';'
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 optional type 'Int?' must be unwrapped to a value of type 'Int'
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) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
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 aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of type 'Double' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression
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) // 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 (.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)?? 0
        let bFloat = Double(b)?? 0
        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 = Double(a)?? 0
        let bFloat = Double(b)?? 0
        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 = Double(a)?? 0
        let bFloat = Double(b)?? 0
        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)?? 0
        let bFloat = Double(b)?? 0
        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 = Double(a)?? 0
        let bFloat = Double(b)?? 0
        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 = Double(a)?? 0
        let bFloat = Double(b)?? 0
        return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat)
    default:
        return nil
    }
}
```
return a > b?.intValue(a) :.intValue(b) // expected expression
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) // consecutive statements on a line must be separated by ';'
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?.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) // 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 use optional chaining on non-optional value of type 'Double'
return a > b?.doubleValue(a) :.doubleValue(b) // cannot convert return expression of type 'Bool' to return type 'Value?'
let aFloat = Double(a)?? 0 // integer literal is unused
let aFloat = Double(a)?? 0 // consecutive statements on a line must be separated by ';'
let aFloat = Double(a)?? 0 // cannot use optional chaining on non-optional value of type 'Double'
let bFloat = Double(b)?? 0 // cannot use optional chaining on non-optional value of type 'Double'
let bFloat = Double(b)?? 0 // consecutive statements on a line must be separated by ';'
let bFloat = Double(b)?? 0 // integer literal is unused
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression
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) // value of optional type 'Optional<_>' must be unwrapped to a value of type '_'
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) // 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) :.intValue(b) // expected expression
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) // expected expression
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 ';'
let aFloat = Double(a)?? 0 // consecutive statements on a line must be separated by ';'
let aFloat = Double(a)?? 0 // integer literal is unused
let aFloat = Double(a)?? 0 // cannot use optional chaining on non-optional value of type 'Double'
let bFloat = Double(b)?? 0 // consecutive statements on a line must be separated by ';'
let bFloat = Double(b)?? 0 // cannot use optional chaining on non-optional value of type 'Double'
let bFloat = Double(b)?? 0 // integer literal is unused
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
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 optional type 'Optional<_>' must be unwrapped to a value of type '_'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // 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?.intValue(a) :.intValue(b) // cannot use optional chaining on non-optional value of type 'Int'
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) // 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) // 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) // expected expression
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
let aFloat = Double(a)?? 0 // integer literal is unused
let aFloat = Double(a)?? 0 // cannot use optional chaining on non-optional value of type 'Double'
let aFloat = Double(a)?? 0 // consecutive statements on a line must be separated by ';'
let bFloat = Double(b)?? 0 // consecutive statements on a line must be separated by ';'
let bFloat = Double(b)?? 0 // cannot use optional chaining on non-optional value of type 'Double'
let bFloat = Double(b)?? 0 // integer literal is unused
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression
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) // value of optional type 'Optional<_>' must be unwrapped to a value of type '_'

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) // 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) // consecutive statements on a line must be separated by ';'
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 optional type 'Int?' must be unwrapped to a value of type 'Int'
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) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
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 aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of type 'Double' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression
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) // 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 (.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) // 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) // consecutive statements on a line must be separated by ';'
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 optional type 'Int?' must be unwrapped to a value of type 'Int'
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) // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) :.doubleValue(b) // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) :.doubleValue(b) // expected expression
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 aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // value of type 'Double' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) :.doubleValue(bFloat) // expected expression
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) // 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) : b > a?.intValue(b) : nil
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (let.stringValue(a), let.stringValue(b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) : bFloat > aFloat?.doubleValue(bFloat) : nil
    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) : b > a?.intValue(b) : nil
    case (let.doubleValue(a), let.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (let.stringValue(a), let.stringValue(b)):
        let aFloat = Double(a)
        let bFloat = Double(b)
        return aFloat > bFloat?.doubleValue(aFloat) : bFloat > aFloat?.doubleValue(bFloat) : nil
    default:
        return nil
    }
}
```
return a > b?.intValue(a) : b > a?.intValue(b) : nil // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // cannot use optional chaining on non-optional value of type 'Int'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
return a > b?.intValue(a) : b > a?.intValue(b) : nil // value of type 'Int' has no member 'intValue'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // value of type 'Double' has no member 'doubleValue'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // cannot use optional chaining on non-optional value of type 'Double'
return aFloat > bFloat?.doubleValue(aFloat) : bFloat > aFloat?.doubleValue(bFloat) : nil // binary operator '>' cannot be applied to operands of type 'Double?' and 'Optional<_>'
return aFloat > bFloat?.doubleValue(aFloat) : bFloat > aFloat?.doubleValue(bFloat) : nil // expected expression
return aFloat > bFloat?.doubleValue(aFloat) : bFloat > aFloat?.doubleValue(bFloat) : nil // consecutive statements on a line must be separated by ';'
return aFloat > bFloat?.doubleValue(aFloat) : bFloat > aFloat?.doubleValue(bFloat) : nil // value of type 'Double' has no member 'doubleValue'
return aFloat > bFloat?.doubleValue(aFloat) : bFloat > aFloat?.doubleValue(bFloat) : nil // cannot convert return expression of type 'Bool' to return type 'Value?'

func isEqualToSumEven(n: Int) -> Bool {
    var sum = 0
    for i in 1...n {
        if i % 2 == 0 {
            sum += i
            if sum > n {
                sum -= i
            } else 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 1...n {
        if i % 2 == 0 {
            sum += i
            if sum > n {
                sum -= i
            } else if sum == n {
                return true
            }
        }
    }
    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 {
            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 {
    // 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 {
            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 {
    // TODO: implement isEqualToSumEven(n: Int) -> Bool
    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(n: Int) -> Bool
    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 {
    // TODO: Implement isEqualToSumEven(n: Int) -> Bool
    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(n: Int) -> Bool
    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 {
    // TODO: implement isEqualToSumEven(n: Int) -> Bool
    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(n: Int) -> Bool
    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 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 {
    // 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 {
    // 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 {
    // 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 {
    // 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 {
    // 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 {
    // 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 {
    // 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 fixSpaces(text: String) -> String {
    let regex = try! NSRegularExpression(
        pattern: "([ ]+)([ ]+)|([ ]+)",
        options:.caseInsensitive
    )
    let result = regex.replaceMatches(
        in: text,
        options:.withTransformation,
        with: { (match) -> String in
            if match.numberOfMatches == 1 {
                return "_"
            } else {
                return "-"
            }
        }
    )
    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) -> String in
            if match.numberOfMatches == 1 {
                return "_"
            } else {
                return "-"
            }
        }
    )
    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) -> String in // extra argument 'with' in call

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 {
    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.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 code
    return text.replace(" ", with: "-")
}
```
return text.replace(" ", with: "-") // cannot convert return expression of type '()' to return type 'String'
return text.replace(" ", with: "-") // cannot use mutating member on immutable value: 'text' is a 'let' constant

func fixSpaces(text: String) -> String {
    // TODO: Replace this line with your code
    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 code
    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 {
    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 {
    // TODO: Replace this line with your code
    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 code
    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 {
    // TODO: Replace this line with your code
    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 code
    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 {
    return text.replaceOccurrences(of: " ", with: "_")
       .replaceOccurrences(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: "_")
       .replaceOccurrences(of: "  ", with: "-")
}
```
return text.replaceOccurrences(of: " ", with: "_") // value of type 'String' has no member 'replaceOccurrences'

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 convert return expression of type '()' to return type 'String'
return text.replace(" ", with: "-") // cannot use mutating member on immutable value: 'text' is a 'let' constant

func fileNameCheck(fileName: String) -> String {
    // TODO: Implement this function
    let fileNameArray = fileName.split(separator: ".")
    let fileNameBeforeDot = fileNameArray[0]
    let fileNameAfterDot = fileNameArray[1]
    let fileNameBeforeDotArray = fileNameBeforeDot.split(separator: "")
    let fileNameAfterDotArray = fileNameAfterDot.split(separator: "")
    
    if fileNameBeforeDotArray.count > 3 || fileNameAfterDotArray.count > 3 {
        return "No"
    }
    
    if fileNameBeforeDotArray.count == 0 || fileNameBeforeDotArray[0].isLetter == false {
        return "No"
    }
    
    if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "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 fileNameBeforeDot = fileNameArray[0]
    let fileNameAfterDot = fileNameArray[1]
    let fileNameBeforeDotArray = fileNameBeforeDot.split(separator: "")
    let fileNameAfterDotArray = fileNameAfterDot.split(separator: "")
    
    if fileNameBeforeDotArray.count > 3 || fileNameAfterDotArray.count > 3 {
        return "No"
    }
    
    if fileNameBeforeDotArray.count == 0 || fileNameBeforeDotArray[0].isLetter == false {
        return "No"
    }
    
    if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "dll" {
        return "No"
    }
    
    return "Yes"
}
```
if fileNameBeforeDotArray.count == 0 || fileNameBeforeDotArray[0].isLetter == false { // value of type 'Substring.SubSequence' (aka 'Substring') has no member 'isLetter'
if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "dll" { // cannot convert value of type 'Substring.SubSequence' (aka 'Substring') to expected argument type 'Bool'
if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "dll" { // cannot force unwrap value of non-optional type 'Substring.SubSequence' (aka 'Substring')
if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "dll" { // cannot convert value of type 'Substring.SubSequence' (aka 'Substring') to expected argument type 'Bool'
if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "dll" { // cannot force unwrap value of non-optional type 'Substring.SubSequence' (aka 'Substring')
if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "dll" { // cannot force unwrap value of non-optional type 'Substring.SubSequence' (aka 'Substring')
if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "dll" { // cannot convert value of type 'Substring.SubSequence' (aka 'Substring') to expected argument type 'Bool'
if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameAfterDotArray.count == 0 || fileNameAfterDotArray[0]!= "txt" && fileNameAfterDotArray[0]!= "exe" && fileNameAfterDotArray[0]!= "dll" { // use of '=' in a boolean context, did you mean '=='?

func fileNameCheck(fileName: String) -> String {
    let fileNameArray = fileName.split(separator: ".")
    if fileNameArray.count > 3 || fileNameArray.count < 2 {
        return "No"
    }
    if fileNameArray[0].count > 3 || fileNameArray[1].count > 3 {
        return "No"
    }
    if!fileNameArray[0].hasPrefix(CharacterSet.letters.inverted) {
        return "No"
    }
    if!fileNameArray[1].hasPrefix(CharacterSet.letters.inverted) {
        return "No"
    }
    if!fileNameArray[1].hasSuffix(CharacterSet.letters.inverted) {
        return "No"
    }
    if!fileNameArray[1].hasSuffix("txt") &&!fileNameArray[1].hasSuffix("exe") &&!fileNameArray[1].hasSuffix("dll") {
        return "No"
    }
    return "Yes"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let fileNameArray = fileName.split(separator: ".")
    if fileNameArray.count > 3 || fileNameArray.count < 2 {
        return "No"
    }
    if fileNameArray[0].count > 3 || fileNameArray[1].count > 3 {
        return "No"
    }
    if!fileNameArray[0].hasPrefix(CharacterSet.letters.inverted) {
        return "No"
    }
    if!fileNameArray[1].hasPrefix(CharacterSet.letters.inverted) {
        return "No"
    }
    if!fileNameArray[1].hasSuffix(CharacterSet.letters.inverted) {
        return "No"
    }
    if!fileNameArray[1].hasSuffix("txt") &&!fileNameArray[1].hasSuffix("exe") &&!fileNameArray[1].hasSuffix("dll") {
        return "No"
    }
    return "Yes"
}
```
if!fileNameArray[0].hasPrefix(CharacterSet.letters.inverted) { // expected expression, var, or let in 'if' condition
if!fileNameArray[1].hasPrefix(CharacterSet.letters.inverted) { // expected expression, var, or let in 'if' condition
if!fileNameArray[1].hasSuffix(CharacterSet.letters.inverted) { // expected expression, var, or let in 'if' condition
if!fileNameArray[1].hasSuffix("txt") &&!fileNameArray[1].hasSuffix("exe") &&!fileNameArray[1].hasSuffix("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].count > 3 {
        return "No"
    }
    if!fileNameArray[1].hasPrefix(CharacterSet.letters.inverted) {
        return "No"
    }
    if!fileNameArray[1].hasSuffix(CharacterSet.init(charactersIn: ["txt", "exe", "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].count > 3 {
        return "No"
    }
    if!fileNameArray[1].hasPrefix(CharacterSet.letters.inverted) {
        return "No"
    }
    if!fileNameArray[1].hasSuffix(CharacterSet.init(charactersIn: ["txt", "exe", "dll"])) {
        return "No"
    }
    return "Yes"
}
```
if!fileNameArray[1].hasPrefix(CharacterSet.letters.inverted) { // expected expression, var, or let in 'if' condition
if!fileNameArray[1].hasSuffix(CharacterSet.init(charactersIn: ["txt", "exe", "dll"])) { // expected expression, var, or let in 'if' condition

func fileNameCheck(fileName: String) -> String {
    // TODO: Implement this function
    let fileName = fileName.lowercased()
    let fileNameArray = fileName.split(separator: ".")
    let fileNameArrayLength = fileNameArray.count
    let fileNameArrayFirst = fileNameArray[0]
    let fileNameArraySecond = fileNameArray[1]
    let fileNameArraySecondLength = fileNameArraySecond.count
    
    if fileNameArrayLength == 2 {
        if fileNameArrayFirst.count <= 3 && fileNameArraySecondLength == 3 {
            if fileNameArrayFirst.hasPrefix(CharacterSet.letters.inverted) && fileNameArraySecond == "txt" || fileNameArraySecond == "exe" || fileNameArraySecond == "dll" {
                return "Yes"
            }
        }
    }
    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: Implement this function
    let fileName = fileName.lowercased()
    let fileNameArray = fileName.split(separator: ".")
    let fileNameArrayLength = fileNameArray.count
    let fileNameArrayFirst = fileNameArray[0]
    let fileNameArraySecond = fileNameArray[1]
    let fileNameArraySecondLength = fileNameArraySecond.count
    
    if fileNameArrayLength == 2 {
        if fileNameArrayFirst.count <= 3 && fileNameArraySecondLength == 3 {
            if fileNameArrayFirst.hasPrefix(CharacterSet.letters.inverted) && fileNameArraySecond == "txt" || fileNameArraySecond == "exe" || fileNameArraySecond == "dll" {
                return "Yes"
            }
        }
    }
    return "No"
}
```
if fileNameArrayFirst.hasPrefix(CharacterSet.letters.inverted) && fileNameArraySecond == "txt" || fileNameArraySecond == "exe" || fileNameArraySecond == "dll" { // instance method 'hasPrefix' requires that 'CharacterSet' conform to 'StringProtocol'

func fileNameCheck(fileName: String) -> String {
    // TODO: Implement this function
    
    // Check if the file name contains more than 3 digits
    if fileName.count > 3 {
        return "No"
    }
    
    // Check if the file name contains more than one dot
    if fileName.components(separatedBy: ".").count > 1 {
        return "No"
    }
    
    // Check if the file name starts with a letter
    if!fileName.hasPrefix(CharacterSet.letters.inverted) {
        return "No"
    }
    
    // Check if the file name ends with one of the following: txt, exe, dll
    if!fileName.hasSuffix(CharacterSet.init(charactersIn: "txt exe 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
    
    // Check if the file name contains more than 3 digits
    if fileName.count > 3 {
        return "No"
    }
    
    // Check if the file name contains more than one dot
    if fileName.components(separatedBy: ".").count > 1 {
        return "No"
    }
    
    // Check if the file name starts with a letter
    if!fileName.hasPrefix(CharacterSet.letters.inverted) {
        return "No"
    }
    
    // Check if the file name ends with one of the following: txt, exe, dll
    if!fileName.hasSuffix(CharacterSet.init(charactersIn: "txt exe dll")) {
        return "No"
    }
    
    return "Yes"
}
```
if!fileName.hasPrefix(CharacterSet.letters.inverted) { // expected expression, var, or let in 'if' condition
if!fileName.hasSuffix(CharacterSet.init(charactersIn: "txt exe dll")) { // expected expression, var, or let in 'if' condition

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 {
    // 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 {
    // TODO: Implement this function
    let fileNameArray = fileName.split(separator: ".")
    if fileNameArray.count > 3 || fileNameArray.count < 2 {
        return "No"
    }
    let fileNameBeforeDot = fileNameArray[0]
    if fileNameBeforeDot.count > 3 || fileNameBeforeDot.count < 1 {
        return "No"
    }
    if!fileNameBeforeDot.hasPrefix(where: { Character.isLetter(s: $0) }) {
        return "No"
    }
    let fileNameAfterDot = fileNameArray[1]
    if!fileNameAfterDot.hasPrefix(where: { Character.isLetter(s: $0) }) {
        return "No"
    }
    if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" {
        return "No"
    }
    return "Yes"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    // TODO: Implement this function
    let fileNameArray = fileName.split(separator: ".")
    if fileNameArray.count > 3 || fileNameArray.count < 2 {
        return "No"
    }
    let fileNameBeforeDot = fileNameArray[0]
    if fileNameBeforeDot.count > 3 || fileNameBeforeDot.count < 1 {
        return "No"
    }
    if!fileNameBeforeDot.hasPrefix(where: { Character.isLetter(s: $0) }) {
        return "No"
    }
    let fileNameAfterDot = fileNameArray[1]
    if!fileNameAfterDot.hasPrefix(where: { Character.isLetter(s: $0) }) {
        return "No"
    }
    if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" {
        return "No"
    }
    return "Yes"
}
```
if!fileNameBeforeDot.hasPrefix(where: { Character.isLetter(s: $0) }) { // expected expression, var, or let in 'if' condition
if!fileNameAfterDot.hasPrefix(where: { Character.isLetter(s: $0) }) { // expected expression, var, or let in 'if' condition
if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" { // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'Bool'
if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" { // cannot force unwrap value of non-optional type 'String.SubSequence' (aka 'Substring')
if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" { // cannot assign value of type '()' to type 'String.SubSequence' (aka 'Substring')
if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" { // use of '=' in a boolean context, did you mean '=='?
if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" { // cannot force unwrap value of non-optional type 'String.SubSequence' (aka 'Substring')
if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" { // cannot convert value of type 'String.SubSequence' (aka 'Substring') to expected argument type 'Bool'
if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameAfterDot!= "txt" && fileNameAfterDot!= "exe" && fileNameAfterDot!= "dll" { // cannot force unwrap value of non-optional type 'String.SubSequence' (aka 'Substring')

func fileNameCheck(fileName: String) -> String {
    // TODO: Replace this line with your implementation
    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: Replace this line with your implementation
    return "No"
}
```
 // XCTAssertTrue failed

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 wordsInSentence(sentence: String) -> String {
    let 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 {
    let 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 {
    var result = ""
    var words = sentence.components(separatedBy: " ")
    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 {
    var result = ""
    var words = sentence.components(separatedBy: " ")
    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 {
    // 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 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.split(separator: " ").map { $0.count }
    return words.filter { $0.isPrime }.map { String($0) }.joined(separator: " ")
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.split(separator: " ").map { $0.count }
    return words.filter { $0.isPrime }.map { String($0) }.joined(separator: " ")
}
```
let words = sentence.split(separator: " ").map { $0.count } // ambiguous use of 'split(separator:maxSplits:omittingEmptySubsequences:)'

func wordsInSentence(sentence: String) -> String {
    var result = ""
    for word in sentence.split(separator: " ").map(String.init) {
        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: " ").map(String.init) {
        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 {
    var result = ""
    var words = sentence.split(separator: " ")
    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 {
    var result = ""
    var words = sentence.split(separator: " ")
    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 {
    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 {
    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.components(separatedBy: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result += word + " "
        }
    }
    return result
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    // Write your solution here
    var words = sentence.components(separatedBy: " ")
    var result = ""
    for word in words {
        if isPrime(word.count) {
            result += word + " "
        }
    }
    return result
}
```
if isPrime(word.count) { // cannot find 'isPrime' in scope

func wordsInSentence(sentence: String) -> String {
    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 {
    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 simplify(x: String, n: String) -> Bool {
    // Your code 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 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: implement me!
}
```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: implement me!
}
```
} // 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 implementation 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 implementation 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 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
}
```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 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 {
    // TODO: implement me!
}
```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 {
    // 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 {
    // TODO:
    return 0
}
```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 {
    // TODO:
    return 0
}
```
 // 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 {
    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 getMaxTriples(n: Int) -> Int {
    let a = Array(repeating: 0, count: n)
    for i in 0..<n {
        a[i] = 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 = Array(repeating: 0, count: n)
    for i in 0..<n {
        a[i] = 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
}
```
a[i] = i * i - i + 1 // cannot assign through subscript: 'a' is a 'let' constant

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 maxTriples = 0
    for i in 1...n-2 {
        for j in i+1...n-1 {
            if (i+j+n-1) % 3 == 0 {
                maxTriples += 1
            }
        }
    }
    return maxTriples
}
```swift
// You are given a positive integer n. You have to create an integer array a of length n.
// For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
// Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, 
// and a[i] + a[j] + a[k] is a multiple of 3.
// Example :
// Explanation: 
// a = [1, 3, 7, 13, 21]
// The only valid triple is (1, 7, 13).
// getMaxTriples(n: 5) == 1
func getMaxTriples(n: Int) -> Int {
    var maxTriples = 0
    for i in 1...n-2 {
        for j in i+1...n-1 {
            if (i+j+n-1) % 3 == 0 {
                maxTriples += 1
            }
        }
    }
    return maxTriples
}
```
 // XCTAssertTrue failed

func getMaxTriples(n: Int) -> Int {
    // Write your code here
    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 {
    // Write your code here
    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-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
}
```
 // 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-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-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 sortedListSum(lst: [String]) -> [String] {
    var result = lst.sorted {
        $0.count < $1.count || ($0.count == $1.count && $0 < $1)
    }
    
    for (index, word) in result.enumerated() {
        if word.count % 2!= 0 {
            result.remove(at: index)
        }
    }
    
    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.sorted {
        $0.count < $1.count || ($0.count == $1.count && $0 < $1)
    }
    
    for (index, word) in result.enumerated() {
        if word.count % 2!= 0 {
            result.remove(at: index)
        }
    }
    
    return result
}
```
if word.count % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if word.count % 2!= 0 { // '=' must have consistent whitespace on both sides
if word.count % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if word.count % 2!= 0 { // expression is not assignable: binary operator returns immutable value

func sortedListSum(lst: [String]) -> [String] {
    // TODO: Your implementation goes here
}
```swift
// Write a function that accepts an array of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted array with a sorted order,
// The array is always an array of strings and never an array of numbers,
// and it may contain duplicates.
// The order of the array should be ascending by length of each word, and you
// should return the array sorted by that rule.
// If two words have the same length, sort the array alphabetically.
// The function should return an array of strings in sorted order.
// You may assume that all words will have the same length.
// For example:
// sortedListSum(lst: ["aa", "a", "aaa"]) == ["aa"]
// sortedListSum(lst: ["ab", "a", "aaa", "cd"]) == ["ab", "cd"]
func sortedListSum(lst: [String]) -> [String] {
    // TODO: Your implementation goes here
}
```
} // missing return in global function expected to return '[String]'

func sortedListSum(lst: [String]) -> [String] {
    var result = lst.sorted {
        $0.count == $1.count? $0 < $1 : $0.count < $1.count
    }
    
    for (index, word) in result.enumerated() {
        if word.count % 2 == 1 {
            result.remove(at: index)
        }
    }
    
    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.sorted {
        $0.count == $1.count? $0 < $1 : $0.count < $1.count
    }
    
    for (index, word) in result.enumerated() {
        if word.count % 2 == 1 {
            result.remove(at: index)
        }
    }
    
    return result
}
```
$0.count == $1.count? $0 < $1 : $0.count < $1.count // consecutive statements on a line must be separated by ';'
$0.count == $1.count? $0 < $1 : $0.count < $1.count // expected expression
$0.count == $1.count? $0 < $1 : $0.count < $1.count // consecutive statements on a line must be separated by ';'
$0.count == $1.count? $0 < $1 : $0.count < $1.count // cannot use optional chaining on non-optional value of type 'Int'

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] {
    var result = lst.sorted {
        $0.count < $1.count || ($0.count == $1.count && $0 < $1)
    }
    var index = 0
    while index < result.count {
        if result[index].count % 2 == 1 {
            result.remove(at: index)
        } else {
            index += 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.sorted {
        $0.count < $1.count || ($0.count == $1.count && $0 < $1)
    }
    var index = 0
    while index < result.count {
        if result[index].count % 2 == 1 {
            result.remove(at: index)
        } else {
            index += 1
        }
    }
    return result
}
```

func sortedListSum(lst: [String]) -> [String] {
    var result = lst.sorted { $0.count < $1.count || ($0.count == $1.count && $0 < $1) }
    result.removeAll(where: { $0.count % 2 == 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.sorted { $0.count < $1.count || ($0.count == $1.count && $0 < $1) }
    result.removeAll(where: { $0.count % 2 == 1 })
    return result
}
```

func sortedListSum(lst: [String]) -> [String] {
    var sortedList = lst.sorted { $0.count < $1.count }
    sortedList.removeAll(where: { $0.count % 2 == 1 })
    return sortedList
}
```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 }
    sortedList.removeAll(where: { $0.count % 2 == 1 })
    return sortedList
}
```
 // XCTAssertTrue failed

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 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] {
    // Write your code here
    var result = lst.sorted(by: { $0.count < $1.count || ($0.count == $1.count && $0 < $1) })
    return result.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] {
    // Write your code here
    var result = lst.sorted(by: { $0.count < $1.count || ($0.count == $1.count && $0 < $1) })
    return result.filter { $0.count % 2 == 0 }
}
```
var result = lst.sorted(by: { $0.count < $1.count || ($0.count == $1.count && $0 < $1) }) // variable 'result' was never mutated; consider changing to 'let' constant

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 {
    // 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 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 {
    // 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 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 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 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 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
    }
    return Int(sum * sum) - Int(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 < 0 || i.isInteger == false {
            continue
        }
        sum += i
        sumOfSquares += i * i
    }
    return Int(sum * sum) - Int(sumOfSquares)
}
```
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 sumOfSquares = 0
    for i in lst {
        if i % 2 == 1 {
            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 == 1 {
            sum += i
            sumOfSquares += i * i
        }
    }
    return sum * sum - sumOfSquares
}
```
if i % 2 == 1 { // '%' is unavailable: For floating point numbers use truncatingRemainder instead
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 % 2 == 1 && i >= 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 == 1 && i >= 0 {
            sum += i
            sumOfSquares += i * i
        }
    }
    return sum * sum - sumOfSquares
}
```
if i % 2 == 1 && i >= 0 { // '%' is unavailable: For floating point numbers use truncatingRemainder instead
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
    var oddCount = 0
    for i in lst {
        if i.isInteger && i > 0 {
            sum += i * i
            if i % 2 == 1 {
                oddSum += i
                oddCount += 1
            }
        }
    }
    if oddCount > 1 {
        return Int(oddSum * oddSum - sum)
    } else {
        return 0
    }
}
```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
    var oddCount = 0
    for i in lst {
        if i.isInteger && i > 0 {
            sum += i * i
            if i % 2 == 1 {
                oddSum += i
                oddCount += 1
            }
        }
    }
    if oddCount > 1 {
        return Int(oddSum * oddSum - sum)
    } else {
        return 0
    }
}
```
if i.isInteger && i > 0 { // value of type 'Double' has no member 'isInteger'
sum += i * i // cannot convert value of type 'Double' to expected argument type 'Int'
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'

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 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 i in lst {
        if i > 0 && i.isInteger {
            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 > 0 && i.isInteger {
            sum += i
            sumOfSquares += i * i
        }
    }
    return sum * sum - sumOfSquares
}
```
if i > 0 && i.isInteger { // 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.isInteger && i > 0 {
            sum += i * i
            if i % 2 == 1 {
                oddSum += i
            }
        }
    }
    return Int(abs(Double(sum) - Double(2 * oddSum)))
}
```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.isInteger && i > 0 {
            sum += i * i
            if i % 2 == 1 {
                oddSum += i
            }
        }
    }
    return Int(abs(Double(sum) - Double(2 * oddSum)))
}
```
if i.isInteger && i > 0 { // value of type 'Double' has no member 'isInteger'
sum += i * i // cannot convert value of type 'Double' to expected argument type 'Int'
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'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    var oddSum = 0
    var oddCount = 0
    for i in lst {
        if i.isInteger && i > 0 {
            sum += i
            if i % 2 == 1 {
                oddSum += i
                oddCount += 1
            }
        }
    }
    if oddCount < 2 {
        return 0
    }
    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
    var oddCount = 0
    for i in lst {
        if i.isInteger && i > 0 {
            sum += i
            if i % 2 == 1 {
                oddSum += i
                oddCount += 1
            }
        }
    }
    if oddCount < 2 {
        return 0
    }
    return Int(pow(Double(oddSum), 2) - pow(Double(sum - oddSum), 2))
}
```
if i.isInteger && i > 0 { // value of type 'Double' has no member 'isInteger'
sum += i // cannot convert value of type 'Double' to expected argument type 'Int'
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'

func doubleTheDifference(lst: [Double]) -> Int {
    var sum = 0
    var oddSum = 0
    var oddCount = 0
    for i in lst {
        if i % 2 == 1 {
            oddSum += i
            oddCount += 1
        }
        sum += i
    }
    if oddCount < 2 {
        return 0
    }
    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
    var oddCount = 0
    for i in lst {
        if i % 2 == 1 {
            oddSum += i
            oddCount += 1
        }
        sum += i
    }
    if oddCount < 2 {
        return 0
    }
    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 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 (index, _) in game.enumerated() {
        if game[index] == guess[index] {
            result.append(0)
        } else {
            result.append(abs(game[index] - guess[index]))
        }
    }
    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 (index, _) in game.enumerated() {
        if game[index] == guess[index] {
            result.append(0)
        } else {
            result.append(abs(game[index] - guess[index]))
        }
    }
    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 {
    var strongest = ""
    var strength = 0
    for extension in extensions {
        let cap = extension.filter {$0.isUppercase}.count
        let sm = extension.filter {$0.isLowercase}.count
        let currentStrength = cap - sm
        if currentStrength > strength {
            strength = currentStrength
            strongest = extension
        }
    }
    return className + "." + strongest
}
```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 strongest = ""
    var strength = 0
    for extension in extensions {
        let cap = extension.filter {$0.isUppercase}.count
        let sm = extension.filter {$0.isLowercase}.count
        let currentStrength = cap - sm
        if currentStrength > strength {
            strength = currentStrength
            strongest = extension
        }
    }
    return className + "." + strongest
}
```
for extension in extensions { // expected '{' to start the body of for-each loop
for extension in extensions { // expected pattern
for extension in extensions { // expected Sequence expression for for-each loop
let cap = extension.filter {$0.isUppercase}.count // expected initial value after '='
let cap = extension.filter {$0.isUppercase}.count // expected type name in extension declaration
let cap = extension.filter {$0.isUppercase}.count // declaration is only valid at file scope
let cap = extension.filter {$0.isUppercase}.count // consecutive statements on a line must be separated by ';'
let cap = extension.filter {$0.isUppercase}.count // expected '{' in extension
let sm = extension.filter {$0.isLowercase}.count // expected type name in extension declaration
let sm = extension.filter {$0.isLowercase}.count // expected '{' in extension
let sm = extension.filter {$0.isLowercase}.count // expected initial value after '='
let sm = extension.filter {$0.isLowercase}.count // declaration is only valid at file scope
let sm = extension.filter {$0.isLowercase}.count // consecutive statements on a line must be separated by ';'
strongest = extension // expected '{' in extension
strongest = extension // declaration is only valid at file scope
strongest = extension // expected expression in assignment
} // expected type name in extension declaration

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO: Implement this method
    // Hint: You can use the following function to calculate the strength of an extension:
    // func strength(extension: String) -> Float {
    //     let capCount = extension.filter { $0.isUppercase }.count
    //     let smallCount = extension.filter { $0.isLowercase }.count
    //     return Float(capCount) - Float(smallCount)
    // }
    
    var strongest: String = ""
    var strength: Float = 0.0
    
    for extension in extensions {
        let extensionStrength = strength(extension: extension)
        if extensionStrength > strength {
            strength = extensionStrength
            strongest = extension
        }
    }
    
    return "\(className).\(strongest)"
}
```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
    // Hint: You can use the following function to calculate the strength of an extension:
    // func strength(extension: String) -> Float {
    //     let capCount = extension.filter { $0.isUppercase }.count
    //     let smallCount = extension.filter { $0.isLowercase }.count
    //     return Float(capCount) - Float(smallCount)
    // }
    
    var strongest: String = ""
    var strength: Float = 0.0
    
    for extension in extensions {
        let extensionStrength = strength(extension: extension)
        if extensionStrength > strength {
            strength = extensionStrength
            strongest = extension
        }
    }
    
    return "\(className).\(strongest)"
}
```
for extension in extensions { // expected '{' to start the body of for-each loop
for extension in extensions { // expected Sequence expression for for-each loop
for extension in extensions { // expected pattern
let extensionStrength = strength(extension: extension) // expected expression in list of expressions
let extensionStrength = strength(extension: extension) // declaration is only valid at file scope
let extensionStrength = strength(extension: extension) // expected type name in extension declaration
let extensionStrength = strength(extension: extension) // cannot call value of non-function type 'Float'
let extensionStrength = strength(extension: extension) // expected '{' in extension
let extensionStrength = strength(extension: extension) // consecutive statements on a line must be separated by ';'
strongest = extension // expected '{' in extension
strongest = extension // expected expression in assignment
strongest = extension // declaration is only valid at file scope
} // expected type name in extension declaration

func Strongest_Extension(className: String, extensions: [String]) -> String {
    var bestExtension = ""
    var bestStrength = 0.0
    for extension in extensions {
        let extensionName = extension.split(separator: ".").last!
        let extensionStrength = extensionName.uppercaseString.count - extensionName.lowercaseString.count
        if extensionStrength > bestStrength {
            bestStrength = extensionStrength
            bestExtension = extension
        }
    }
    return className + "." + bestExtension
}
```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 bestExtension = ""
    var bestStrength = 0.0
    for extension in extensions {
        let extensionName = extension.split(separator: ".").last!
        let extensionStrength = extensionName.uppercaseString.count - extensionName.lowercaseString.count
        if extensionStrength > bestStrength {
            bestStrength = extensionStrength
            bestExtension = extension
        }
    }
    return className + "." + bestExtension
}
```
for extension in extensions { // expected '{' to start the body of for-each loop
for extension in extensions { // expected pattern
for extension in extensions { // expected Sequence expression for for-each loop
let extensionName = extension.split(separator: ".").last! // expected type name in extension declaration
let extensionName = extension.split(separator: ".").last! // consecutive statements on a line must be separated by ';'
let extensionName = extension.split(separator: ".").last! // declaration is only valid at file scope
let extensionName = extension.split(separator: ".").last! // expected initial value after '='
let extensionName = extension.split(separator: ".").last! // expected '{' in extension
bestExtension = extension // declaration is only valid at file scope
bestExtension = extension // expected expression in assignment
bestExtension = extension // expected '{' in extension
} // expected type name in extension declaration

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO: Implement this function
    var maxStrength = 0
    var maxStrengthExtension = ""
    for extension in extensions {
        var strength = 0
        for character in extension {
            if character.isUpper {
                strength += 1
            }
        }
        if strength > maxStrength {
            maxStrength = strength
            maxStrengthExtension = extension
        }
    }
    return className + "." + maxStrengthExtension
}
```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 = 0
    var maxStrengthExtension = ""
    for extension in extensions {
        var strength = 0
        for character in extension {
            if character.isUpper {
                strength += 1
            }
        }
        if strength > maxStrength {
            maxStrength = strength
            maxStrengthExtension = extension
        }
    }
    return className + "." + maxStrengthExtension
}
```
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
for character in extension { // expected Sequence expression for for-each loop
for character in extension { // expected '{' to start the body of for-each loop
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

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO: Your code here
    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: Your code here
    return ""
}
```
 // XCTAssertTrue failed

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO: Implement this method
    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: Implement this method
    return ""
}
```
 // XCTAssertTrue failed

func Strongest_Extension(className: String, extensions: [String]) -> String {
    var maxStrength = 0
    var maxStrengthExtension = ""
    for extension in extensions {
        let strength = extension.countOfCharacters(whereFunction: { $0.isUppercase }) - extension.countOfCharacters(whereFunction: { $0.isLowercase })
        if strength > maxStrength {
            maxStrength = strength
            maxStrengthExtension = extension
        }
    }
    return className + "." + maxStrengthExtension
}
```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 = extension.countOfCharacters(whereFunction: { $0.isUppercase }) - extension.countOfCharacters(whereFunction: { $0.isLowercase })
        if strength > maxStrength {
            maxStrength = strength
            maxStrengthExtension = extension
        }
    }
    return className + "." + maxStrengthExtension
}
```
for extension in extensions { // expected '{' to start the body of for-each loop
for extension in extensions { // expected pattern
for extension in extensions { // expected Sequence expression for for-each loop
let strength = extension.countOfCharacters(whereFunction: { $0.isUppercase }) - extension.countOfCharacters(whereFunction: { $0.isLowercase }) // expected initial value after '='
let strength = extension.countOfCharacters(whereFunction: { $0.isUppercase }) - extension.countOfCharacters(whereFunction: { $0.isLowercase }) // declaration is only valid at file scope
let strength = extension.countOfCharacters(whereFunction: { $0.isUppercase }) - extension.countOfCharacters(whereFunction: { $0.isLowercase }) // expected '{' in extension
let strength = extension.countOfCharacters(whereFunction: { $0.isUppercase }) - extension.countOfCharacters(whereFunction: { $0.isLowercase }) // declaration is only valid at file scope
let strength = extension.countOfCharacters(whereFunction: { $0.isUppercase }) - extension.countOfCharacters(whereFunction: { $0.isLowercase }) // expected type name in extension declaration
let strength = extension.countOfCharacters(whereFunction: { $0.isUppercase }) - extension.countOfCharacters(whereFunction: { $0.isLowercase }) // expected type name in extension declaration
let strength = extension.countOfCharacters(whereFunction: { $0.isUppercase }) - extension.countOfCharacters(whereFunction: { $0.isLowercase }) // consecutive statements on a line must be separated by ';'
let strength = extension.countOfCharacters(whereFunction: { $0.isUppercase }) - extension.countOfCharacters(whereFunction: { $0.isLowercase }) // expected '{' in extension
maxStrengthExtension = extension // expected '{' in extension
maxStrengthExtension = extension // expected expression in assignment
maxStrengthExtension = extension // declaration is only valid at file scope
} // expected type name in extension declaration

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO: Implement this method
    // Hint: Use the "Strength" function to calculate the strength of an extension
    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: Implement this method
    // Hint: Use the "Strength" function to calculate the strength of an extension
    return ""
}
```
 // XCTAssertTrue failed

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO: Implement this function
    // Hint: Use the strength function to calculate the strength of each extension
    // and then use the max function to find the strongest extension
    // Hint: Use the String.index(of:) function to find the index of the first uppercase letter
    // in an extension's name
    
    // Your code here
    
    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: Implement this function
    // Hint: Use the strength function to calculate the strength of each extension
    // and then use the max function to find the strongest extension
    // Hint: Use the String.index(of:) function to find the index of the first uppercase letter
    // in an extension's name
    
    // Your code here
    
    return ""
}
```
 // XCTAssertTrue failed

func Strongest_Extension(className: String, extensions: [String]) -> String {
    // TODO: implement this function
    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: implement this function
    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
    }
    for i in 0..<aLen {
        if a.hasPrefix(b) {
            return true
        }
        a.insert(a[aLen - 1], at: 0)
        a.removeAtIndex(aLen - 1)
    }
    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 {
        if a.hasPrefix(b) {
            return true
        }
        a.insert(a[aLen - 1], at: 0)
        a.removeAtIndex(aLen - 1)
    }
    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
a.insert(a[aLen - 1], at: 0) // no exact matches in call to instance method 'insert'
a.removeAtIndex(aLen - 1) // value of type 'String' has no member 'removeAtIndex'

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(b.characters.dropLast(1) + b.characters.first!)]
    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(b.characters.dropLast(1) + b.characters.first!)]
    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(b.characters.dropLast(1) + b.characters.first!)] // binary operator '+' cannot be applied to operands of type '[String.Element]' (aka 'Array<Character>') and 'String.Element' (aka 'Character')
if a.rangeOfString(rotation)!= nil { // '=' must have consistent whitespace on both sides

func cycpatternCheck(a: String, b: String) -> Bool {
    var a = a
    var b = b
    var aLen = a.characters.count
    var bLen = b.characters.count
    var aIndex = 0
    var bIndex = 0
    var bRotated = ""
    
    while aIndex < aLen {
        bRotated = ""
        for _ in 0..<bLen {
            bRotated.append(a[aIndex])
            aIndex = (aIndex + 1) % aLen
        }
        if bRotated == 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 {
    var a = a
    var b = b
    var aLen = a.characters.count
    var bLen = b.characters.count
    var aIndex = 0
    var bIndex = 0
    var bRotated = ""
    
    while aIndex < aLen {
        bRotated = ""
        for _ in 0..<bLen {
            bRotated.append(a[aIndex])
            aIndex = (aIndex + 1) % aLen
        }
        if bRotated == b {
            return true
        }
    }
    return false
}
```
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
var aLen = a.characters.count // 'characters' is unavailable: Please use String directly
var aLen = a.characters.count // variable 'aLen' was never mutated; consider changing to 'let' constant
var bLen = b.characters.count // variable 'bLen' was never mutated; consider changing to 'let' constant
var bLen = b.characters.count // 'characters' is unavailable: Please use String directly
var bIndex = 0 // initialization of variable 'bIndex' was never used; consider replacing with assignment to '_' or removing it
bRotated.append(a[aIndex]) // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

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 {
    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 {
    if a.count < b.count {
        return false
    }
    
    for i in 0..<b.count {
        if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: Range<String.Index>(start: a.startIndex.advancedBy(i), end: a.endIndex), locale: nil)!= 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 {
    if a.count < b.count {
        return false
    }
    
    for i in 0..<b.count {
        if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: Range<String.Index>(start: a.startIndex.advancedBy(i), end: a.endIndex), locale: nil)!= nil {
            return true
        }
    }
    
    return false
}
```
if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: Range<String.Index>(start: a.startIndex.advancedBy(i), end: a.endIndex), locale: nil)!= nil { // value of type 'String' has no member 'rangeOfString'
if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: Range<String.Index>(start: a.startIndex.advancedBy(i), end: a.endIndex), locale: nil)!= nil { // value of type 'String.Index' has no member 'advancedBy'
if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: Range<String.Index>(start: a.startIndex.advancedBy(i), end: a.endIndex), locale: nil)!= nil { // 'nil' requires a contextual type
if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: Range<String.Index>(start: a.startIndex.advancedBy(i), end: a.endIndex), locale: nil)!= nil { // no exact matches in call to initializer
if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: Range<String.Index>(start: a.startIndex.advancedBy(i), end: a.endIndex), locale: nil)!= nil { // type 'NSStringCompareOptions' has no member 'CaseInsensitiveSearch'
if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: Range<String.Index>(start: a.startIndex.advancedBy(i), end: a.endIndex), locale: nil)!= nil { // '=' must have consistent whitespace on both sides
if a.rangeOfString(b, options: NSStringCompareOptions.CaseInsensitiveSearch, range: Range<String.Index>(start: a.startIndex.advancedBy(i), end: a.endIndex), locale: nil)!= nil { // use of '=' in a boolean context, did you mean '=='?

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 bRot = b.characters.prefix(bLen - i).appending(b.characters.suffix(i))
        if a.containsString(bRot) {
            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 bRot = b.characters.prefix(bLen - i).appending(b.characters.suffix(i))
        if a.containsString(bRot) {
            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 bRot = b.characters.prefix(bLen - i).appending(b.characters.suffix(i)) // 'characters' is unavailable: Please use String directly
let bRot = b.characters.prefix(bLen - i).appending(b.characters.suffix(i)) // 'characters' is unavailable: Please use String directly
if a.containsString(bRot) { // value of type 'String' has no member 'containsString'

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(b.characters.dropLast(bLen - 1)), String(b.characters.dropLast(bLen - 2)), String(b.characters.dropLast(bLen - 3))]
    for rot in bRotations {
        if a.rangeOfString(rot)!= 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(b.characters.dropLast(bLen - 1)), String(b.characters.dropLast(bLen - 2)), String(b.characters.dropLast(bLen - 3))]
    for rot in bRotations {
        if a.rangeOfString(rot)!= 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(b.characters.dropLast(bLen - 1)), String(b.characters.dropLast(bLen - 2)), String(b.characters.dropLast(bLen - 3))] // 'characters' is unavailable: Please use String directly
let bRotations = [b, String(b.characters.dropLast(bLen - 1)), String(b.characters.dropLast(bLen - 2)), String(b.characters.dropLast(bLen - 3))] // 'characters' is unavailable: Please use String directly
let bRotations = [b, String(b.characters.dropLast(bLen - 1)), String(b.characters.dropLast(bLen - 2)), String(b.characters.dropLast(bLen - 3))] // 'characters' is unavailable: Please use String directly
if a.rangeOfString(rot)!= nil { // value of type 'String' has no member 'rangeOfString'
if a.rangeOfString(rot)!= nil { // use of '=' in a boolean context, did you mean '=='?
if a.rangeOfString(rot)!= 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 {
    // 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 evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    
    if num < 0 {
        num *= -1
    }
    
    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
    
    if num < 0 {
        num *= -1
    }
    
    while num > 0 {
        if num % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num /= 10
    }
    
    return (evenCount, oddCount)
}
```
num *= -1 // left side of mutating operator isn't mutable: 'num' is a 'let' constant
num /= 10 // left side of mutating operator isn't mutable: '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 { // cannot force unwrap value of non-optional type 'Int'
while num!= 0 { // '=' must have consistent whitespace on both sides
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)
}
```
while num!= 0 { // cannot force unwrap value of non-optional type 'Int'
while num!= 0 { // '=' must have consistent whitespace on both sides
while num!= 0 { // use of '=' in a boolean context, did you mean '=='?
num /= 10 // left side of mutating operator isn't mutable: 'num' is a 'let' constant

func evenOddCount(num: Int) -> (Int, Int) {
    let count = num.description.characters.reduce(0, combine: { (count: Int, character: Character) -> Int in
        if character.isNumber {
            return count + (character as Character).isNumber
        } else {
            return count
        }
    })
    return (count / 2, count % 2)
}
```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 count = num.description.characters.reduce(0, combine: { (count: Int, character: Character) -> Int in
        if character.isNumber {
            return count + (character as Character).isNumber
        } else {
            return count
        }
    })
    return (count / 2, count % 2)
}
```
let count = num.description.characters.reduce(0, combine: { (count: Int, character: Character) -> Int in // extraneous argument label 'combine:' in call
return count + (character as Character).isNumber // cannot convert value of type 'Bool' to expected argument type 'Int'

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)
}
```
num = num / 10 // cannot assign to value: 'num' is a 'let' constant

func evenOddCount(num: Int) -> (Int, Int) {
    var evenCount = 0
    var oddCount = 0
    
    if num < 0 {
        num = num * -1
    }
    
    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
    
    if num < 0 {
        num = num * -1
    }
    
    while num > 0 {
        if num % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
        num = num / 10
    }
    
    return (evenCount, oddCount)
}
```
num = num * -1 // cannot assign to value: 'num' is a 'let' constant
num = num / 10 // cannot assign to value: '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) {
    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)
}
```
num = num / 10 // cannot assign to value: 'num' is a 'let' constant

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.characters[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.characters[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.characters[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
    
    for i in 0..<String(num).characters.count {
        if String(num).characters[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
    
    for i in 0..<String(num).characters.count {
        if String(num).characters[i] % 2 == 0 {
            evenCount += 1
        } else {
            oddCount += 1
        }
    }
    
    return (evenCount, oddCount)
}
```
for i in 0..<String(num).characters.count { // 'characters' is unavailable: Please use String directly
if String(num).characters[i] % 2 == 0 { // cannot convert value of type 'Character' to expected argument type 'Int'

func intToMiniRoman(number: Int) -> String {
    var roman = ""
    var remainder = number
    
    // 1. Iterate over the number and add the corresponding roman numeral
    //    to the result.
    for i in 1...number {
        // 2. Check if the number is divisible by the current number.
        if i % 10 == 0 {
            // 3. If it is, add the corresponding roman numeral to the result.
            roman += miniRoman(number: i)
            remainder -= i
        } else {
            // 4. If it isn't, check if the number is divisible by the current
            //    number * 10.
            if i % 10 == 0 {
                // 5. If it is, add the corresponding roman numeral to the result.
                roman += miniRoman(number: i)
                remainder -= i
            } else {
                // 6. If it isn't, check if the number is divisible by the current
                //    number * 100.
                if i % 100 == 0 {
                    // 7. If it is, add the corresponding roman numeral to the result.
                    roman += miniRoman(number: i)
                    remainder -= i
                } else {
                    // 8. If it isn't, check if the number is divisible by the current
                    //    number * 1000.
                    if i % 1000 == 0 {
                        // 9. If it is, add the corresponding roman numeral to the result.
                        roman += miniRoman(number: i)
                        remainder -= i
                    } else {
                        // 10. If it isn't, add the corresponding roman numeral to the result.
                        roman += miniRoman(number: i)
                        remainder -= i
                    }
                }
            }
        }
    }
    
    // 11. Return the result.
    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 remainder = number
    
    // 1. Iterate over the number and add the corresponding roman numeral
    //    to the result.
    for i in 1...number {
        // 2. Check if the number is divisible by the current number.
        if i % 10 == 0 {
            // 3. If it is, add the corresponding roman numeral to the result.
            roman += miniRoman(number: i)
            remainder -= i
        } else {
            // 4. If it isn't, check if the number is divisible by the current
            //    number * 10.
            if i % 10 == 0 {
                // 5. If it is, add the corresponding roman numeral to the result.
                roman += miniRoman(number: i)
                remainder -= i
            } else {
                // 6. If it isn't, check if the number is divisible by the current
                //    number * 100.
                if i % 100 == 0 {
                    // 7. If it is, add the corresponding roman numeral to the result.
                    roman += miniRoman(number: i)
                    remainder -= i
                } else {
                    // 8. If it isn't, check if the number is divisible by the current
                    //    number * 1000.
                    if i % 1000 == 0 {
                        // 9. If it is, add the corresponding roman numeral to the result.
                        roman += miniRoman(number: i)
                        remainder -= i
                    } else {
                        // 10. If it isn't, add the corresponding roman numeral to the result.
                        roman += miniRoman(number: i)
                        remainder -= i
                    }
                }
            }
        }
    }
    
    // 11. Return the result.
    return roman
}
```
roman += miniRoman(number: i) // cannot find 'miniRoman' in scope
roman += miniRoman(number: i) // cannot find 'miniRoman' in scope
roman += miniRoman(number: i) // cannot find 'miniRoman' in scope
roman += miniRoman(number: i) // cannot find 'miniRoman' in scope
roman += miniRoman(number: i) // cannot find 'miniRoman' in scope

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

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 roman = ""
    var i = number
    var last = 0
    var lastRoman = ""
    while i > 0 {
        var roman = ""
        var i = number
        var last = 0
        var lastRoman = ""
        for j in 0..<romanNumbers.count {
            if i >= romanNumbers[j].value {
                roman += romanNumbers[j].roman
                i -= romanNumbers[j].value
                last = romanNumbers[j].value
                lastRoman = romanNumbers[j].roman
            }
        }
        if lastRoman!= "" {
            roman += lastRoman
        }
        if roman!= "" {
            roman += " "
        }
    }
    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 lastRoman = ""
    while i > 0 {
        var roman = ""
        var i = number
        var last = 0
        var lastRoman = ""
        for j in 0..<romanNumbers.count {
            if i >= romanNumbers[j].value {
                roman += romanNumbers[j].roman
                i -= romanNumbers[j].value
                last = romanNumbers[j].value
                lastRoman = romanNumbers[j].roman
            }
        }
        if lastRoman!= "" {
            roman += lastRoman
        }
        if roman!= "" {
            roman += " "
        }
    }
    return roman
}
```
for j in 0..<romanNumbers.count { // cannot find 'romanNumbers' in scope
if lastRoman!= "" { // '=' must have consistent whitespace on both sides
if lastRoman!= "" { // cannot force unwrap value of non-optional type 'String'
if lastRoman!= "" { // use of '=' in a boolean context, did you mean '=='?
if roman!= "" { // use of '=' in a boolean context, did you mean '=='?
if roman!= "" { // '=' must have consistent whitespace on both sides
if roman!= "" { // cannot force unwrap value of non-optional type 'String'

func intToMiniRoman(number: Int) -> String {
    var roman = ""
    var remainder = number
    var previous = 0
    var current = 0
    var i = 0
    
    while remainder > 0 {
        current = remainder % 10
        remainder = remainder / 10
        
        if current == 9 {
            roman += "ix"
        } else if current == 8 {
            roman += "viii"
        } else if current == 7 {
            roman += "vii"
        } else if current == 6 {
            roman += "vi"
        } else if current == 5 {
            roman += "v"
        } else if current == 4 {
            roman += "iv"
        } else if current == 3 {
            roman += "iii"
        } else if current == 2 {
            roman += "ii"
        } else if current == 1 {
            roman += "i"
        } else {
            roman += "0"
        }
        
        if previous > current {
            roman += "m"
        }
        
        previous = current
        i += 1
    }
    
    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 remainder = number
    var previous = 0
    var current = 0
    var i = 0
    
    while remainder > 0 {
        current = remainder % 10
        remainder = remainder / 10
        
        if current == 9 {
            roman += "ix"
        } else if current == 8 {
            roman += "viii"
        } else if current == 7 {
            roman += "vii"
        } else if current == 6 {
            roman += "vi"
        } else if current == 5 {
            roman += "v"
        } else if current == 4 {
            roman += "iv"
        } else if current == 3 {
            roman += "iii"
        } else if current == 2 {
            roman += "ii"
        } else if current == 1 {
            roman += "i"
        } else {
            roman += "0"
        }
        
        if previous > current {
            roman += "m"
        }
        
        previous = current
        i += 1
    }
    
    return roman
}
```
 // XCTAssertTrue failed

func intToMiniRoman(number: Int) -> String {
    var result = ""
    var num = number
    var i = 0
    var roman = [String]()
    var romanMap = [Int: String]()
    romanMap[1] = "i"
    romanMap[5] = "v"
    romanMap[10] = "x"
    romanMap[50] = "l"
    romanMap[100] = "c"
    romanMap[500] = "d"
    romanMap[1000] = "m"
    
    while num > 0 {
        var remainder = num % 10
        if remainder == 9 {
            roman.append(romanMap[10])
        } else if remainder == 4 {
            roman.append(romanMap[5])
            roman.append(romanMap[1])
        } else if remainder == 5 {
            roman.append(romanMap[5])
        } else if remainder == 6 {
            roman.append(romanMap[1])
            roman.append(romanMap[5])
        } else if remainder == 7 {
            roman.append(romanMap[10])
            roman.append(romanMap[1])
        } else if remainder == 8 {
            roman.append(romanMap[1])
            roman.append(romanMap[10])
        } else if remainder > 0 {
            roman.append(romanMap[remainder])
        }
        num /= 10
        i += 1
    }
    
    for i in roman.reverse() {
        result += i
    }
    
    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 = [String]()
    var romanMap = [Int: String]()
    romanMap[1] = "i"
    romanMap[5] = "v"
    romanMap[10] = "x"
    romanMap[50] = "l"
    romanMap[100] = "c"
    romanMap[500] = "d"
    romanMap[1000] = "m"
    
    while num > 0 {
        var remainder = num % 10
        if remainder == 9 {
            roman.append(romanMap[10])
        } else if remainder == 4 {
            roman.append(romanMap[5])
            roman.append(romanMap[1])
        } else if remainder == 5 {
            roman.append(romanMap[5])
        } else if remainder == 6 {
            roman.append(romanMap[1])
            roman.append(romanMap[5])
        } else if remainder == 7 {
            roman.append(romanMap[10])
            roman.append(romanMap[1])
        } else if remainder == 8 {
            roman.append(romanMap[1])
            roman.append(romanMap[10])
        } else if remainder > 0 {
            roman.append(romanMap[remainder])
        }
        num /= 10
        i += 1
    }
    
    for i in roman.reverse() {
        result += i
    }
    
    return result
}
```
roman.append(romanMap[10]) // value of optional type 'String?' must be unwrapped to a value of type 'String'
roman.append(romanMap[5]) // value of optional type 'String?' must be unwrapped to a value of type 'String'
roman.append(romanMap[1]) // value of optional type 'String?' must be unwrapped to a value of type 'String'
roman.append(romanMap[5]) // value of optional type 'String?' must be unwrapped to a value of type 'String'
roman.append(romanMap[1]) // value of optional type 'String?' must be unwrapped to a value of type 'String'
roman.append(romanMap[5]) // value of optional type 'String?' must be unwrapped to a value of type 'String'
roman.append(romanMap[10]) // value of optional type 'String?' must be unwrapped to a value of type 'String'
roman.append(romanMap[1]) // value of optional type 'String?' must be unwrapped to a value of type 'String'
roman.append(romanMap[1]) // value of optional type 'String?' must be unwrapped to a value of type 'String'
roman.append(romanMap[10]) // value of optional type 'String?' must be unwrapped to a value of type 'String'
roman.append(romanMap[remainder]) // value of optional type 'String?' must be unwrapped to a value of type 'String'
for i in roman.reverse() { // for-in loop requires '()' to conform to 'Sequence'

func intToMiniRoman(number: Int) -> String {
    let roman = ["I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000]
    var result = ""
    var remainder = number
    for (romanKey, romanValue) in roman {
        let quotient = remainder / romanValue
        remainder = remainder % romanValue
        for _ in 0..<quotient {
            result.append(romanKey)
        }
    }
    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 = ["I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000]
    var result = ""
    var remainder = number
    for (romanKey, romanValue) in roman {
        let quotient = remainder / romanValue
        remainder = remainder % romanValue
        for _ in 0..<quotient {
            result.append(romanKey)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func intToMiniRoman(number: Int) -> String {
    var roman = ""
    var i = number
    var prev = 0
    var curr = 0
    var diff = 0
    var digit = 0
    while i > 0 {
        digit = i % 10
        curr = digit + prev
        diff = curr - prev
        if diff == 1 {
            roman += String(Int(digit))
        } else if diff == 2 {
            roman += "x" + String(Int(digit))
        } else if diff == 3 {
            roman += "c" + String(Int(digit))
        } else if diff == 4 {
            roman += "l" + String(Int(digit))
        } else if diff == 5 {
            roman += "v" + String(Int(digit))
        } else if diff == 6 {
            roman += "x" + String(Int(digit))
        } else if diff == 7 {
            roman += "c" + String(Int(digit))
        } else if diff == 8 {
            roman += "l" + String(Int(digit))
        } else if diff == 9 {
            roman += "x" + String(Int(digit))
        } else {
            roman += String(Int(curr))
        }
        prev = curr
        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 prev = 0
    var curr = 0
    var diff = 0
    var digit = 0
    while i > 0 {
        digit = i % 10
        curr = digit + prev
        diff = curr - prev
        if diff == 1 {
            roman += String(Int(digit))
        } else if diff == 2 {
            roman += "x" + String(Int(digit))
        } else if diff == 3 {
            roman += "c" + String(Int(digit))
        } else if diff == 4 {
            roman += "l" + String(Int(digit))
        } else if diff == 5 {
            roman += "v" + String(Int(digit))
        } else if diff == 6 {
            roman += "x" + String(Int(digit))
        } else if diff == 7 {
            roman += "c" + String(Int(digit))
        } else if diff == 8 {
            roman += "l" + String(Int(digit))
        } else if diff == 9 {
            roman += "x" + String(Int(digit))
        } else {
            roman += String(Int(curr))
        }
        prev = curr
        i = i / 10
    }
    return roman
}
```
 // XCTAssertTrue failed

func intToMiniRoman(number: Int) -> String {
    var roman = ""
    var i = 0
    var num = number
    var last = 0
    var current = 0
    var next = 0
    while num > 0 {
        last = current
        current = next
        next = num / 10
        num = num % 10
        switch current {
        case 0:
            roman += "i"
        case 1:
            roman += "v"
        case 2:
            roman += "x"
        case 3:
            roman += "l"
        case 4:
            roman += "c"
        case 5:
            roman += "d"
        case 6:
            roman += "m"
        default:
            roman += "?"
        }
        i += 1
    }
    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 = 0
    var num = number
    var last = 0
    var current = 0
    var next = 0
    while num > 0 {
        last = current
        current = next
        next = num / 10
        num = num % 10
        switch current {
        case 0:
            roman += "i"
        case 1:
            roman += "v"
        case 2:
            roman += "x"
        case 3:
            roman += "l"
        case 4:
            roman += "c"
        case 5:
            roman += "d"
        case 6:
            roman += "m"
        default:
            roman += "?"
        }
        i += 1
    }
    return roman
}
```
var last = 0 // variable 'last' was written to, but never read

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 {
    // Your implementation 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 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 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 {
    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 || (count == maxCount && word < max) {
            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 || (count == maxCount && word < max) {
            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 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 maxCharCount = 0
    for word in words {
        let charCount = word.characters.reduce(0, combine: { (count, _) -> Int in
            return count + Int(Set(word).contains($0))
        })
        if charCount > maxCharCount || (charCount == maxCharCount && word < max) {
            max = word
            maxCharCount = charCount
        }
    }
    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 maxCharCount = 0
    for word in words {
        let charCount = word.characters.reduce(0, combine: { (count, _) -> Int in
            return count + Int(Set(word).contains($0))
        })
        if charCount > maxCharCount || (charCount == maxCharCount && word < max) {
            max = word
            maxCharCount = charCount
        }
    }
    return max
}
```
let charCount = word.characters.reduce(0, combine: { (count, _) -> Int in // extraneous argument label 'combine:' in call
return count + Int(Set(word).contains($0)) // anonymous closure arguments cannot be used inside a closure that has explicit arguments; did you mean 'count'?
return count + Int(Set(word).contains($0)) // cannot convert value of type 'Int' to expected argument type 'String.Element' (aka 'Character')
return count + Int(Set(word).contains($0)) // no exact matches in call to initializer
return count + Int(Set(word).contains($0)) // missing argument label '_immutableCocoaSet:' in call

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number + need
    var remaining = remaining - need
    return [eaten, remaining]
}
```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 remaining = remaining - need
    return [eaten, remaining]
}
```
var eaten = number + need // variable 'eaten' was never mutated; consider changing to 'let' constant
var remaining = remaining - need // variable 'remaining' 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] {
    var eaten = number + need
    var left = remaining - need
    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 - need
    return [eaten, left]
}
```
var eaten = number + need // variable 'eaten' was never mutated; consider changing to 'let' constant
var left = remaining - need // 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] {
    var eaten = number + need
    var left = remaining - need
    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 - need
    return [eaten, left]
}
```
var eaten = number + need // variable 'eaten' was never mutated; consider changing to 'let' constant
var left = remaining - need // variable 'left' was never mutated; consider changing to 'let' constant
 // 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] {
    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] {
    // Your code here
    let eaten = number + need
    let left = remaining - need
    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] {
    // Your code here
    let eaten = number + need
    let left = remaining - need
    return [eaten, left]
}
```
 // XCTAssertTrue failed

func eat(number: Int, need: Int, remaining: Int) -> [Int] {
    var eaten = number + need
    var left = remaining - need
    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 - need
    return [eaten, left]
}
```
var eaten = number + need // variable 'eaten' was never mutated; consider changing to 'let' constant
var left = remaining - need // variable 'left' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

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 = 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 = result ** operands[i]
        }
    }
    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 = result // operands[i]
        } else if operators[i] == "**" {
            result = 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 = result // operands[i]
        } else if operators[i] == "**" {
            result = result ** operands[i]
        }
    }
    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 {
    let result = operators.reduce(0) { (sum, operator) -> Int in
        let operand = operands.removeFirst()
        switch operator {
        case "+":
            return sum + operand
        case "-":
            return sum - operand
        case "*":
            return sum * operand
        case "//":
            return sum / operand
        case "**":
            return pow(sum, operand)
        default:
            return 0
        }
    }
    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
        let operand = operands.removeFirst()
        switch operator {
        case "+":
            return sum + operand
        case "-":
            return sum - operand
        case "*":
            return sum * operand
        case "//":
            return sum / operand
        case "**":
            return pow(sum, operand)
        default:
            return 0
        }
    }
    return result
}
```
let operand = operands.removeFirst() // cannot use mutating member on immutable value: 'operands' is a 'let' constant
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() {
        switch operator {
        case "+":
            result += operands[index + 1]
        case "-":
            result -= operands[index + 1]
        case "*":
            result *= operands[index + 1]
        case "//":
            result /= operands[index + 1]
        case "**":
            result = pow(result, operands[index + 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 = 0
    for (index, operator) in operators.enumerated() {
        switch operator {
        case "+":
            result += operands[index + 1]
        case "-":
            result -= operands[index + 1]
        case "*":
            result *= operands[index + 1]
        case "//":
            result /= operands[index + 1]
        case "**":
            result = pow(result, operands[index + 1])
        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 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() {
        if operator == "+" {
            result += operands[index + 1]
        } else if operator == "-" {
            result -= operands[index + 1]
        } else if operator == "*" {
            result *= operands[index + 1]
        } else if operator == "//" {
            result = result // operands[index + 1]
        } else if operator == "**" {
            result = result ** operands[index + 1]
        }
    }
    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() {
        if operator == "+" {
            result += operands[index + 1]
        } else if operator == "-" {
            result -= operands[index + 1]
        } else if operator == "*" {
            result *= operands[index + 1]
        } else if operator == "//" {
            result = result // operands[index + 1]
        } else if operator == "**" {
            result = result ** operands[index + 1]
        }
    }
    return result
}
```
for (index, operator) in operators.enumerated() { // expected pattern
for (index, operator) in operators.enumerated() { // expected '{' to start the body of for-each loop
for (index, operator) in operators.enumerated() { // expected Sequence expression for for-each loop
for (index, operator) in operators.enumerated() { // expected 'in' after for-each pattern
if operator == "+" { // 'operator' may only be declared at file scope
if operator == "+" { // expected expression, var, or let in 'if' condition
if operator == "+" { // operator must be declared as 'prefix', 'postfix', or 'infix'
} else if operator == "-" { // expected expression, var, or let in 'if' condition
} else if operator == "-" { // 'operator' may only be declared at file scope
} else if operator == "-" { // operator must be declared as 'prefix', 'postfix', or 'infix'
} else if operator == "*" { // 'operator' may only be declared at file scope
} else if operator == "*" { // operator must be declared as 'prefix', 'postfix', or 'infix'
} else if operator == "*" { // expected expression, var, or let in 'if' condition
} else if operator == "//" { // 'operator' may only be declared at file scope
} else if operator == "//" { // operator must be declared as 'prefix', 'postfix', or 'infix'
} else if operator == "//" { // expected expression, var, or let in 'if' condition
} else if operator == "**" { // 'operator' may only be declared at file scope
} else if operator == "**" { // expected expression, var, or let in 'if' condition
} else if operator == "**" { // operator must be declared as 'prefix', 'postfix', or 'infix'

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 = result // operands[i]
        } else if operators[i] == "**" {
            result = 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 = result // operands[i]
        } else if operators[i] == "**" {
            result = result ** operands[i]
        }
    }
    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 {
    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 pow(sum, operands.removeFirst())
        default:
            return 0
        }
    }
    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 pow(sum, operands.removeFirst())
        default:
            return 0
        }
    }
    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 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 = result // operands[i]
        } else if operators[i] == "**" {
            result = 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 = result // operands[i]
        } else if operators[i] == "**" {
            result = result ** operands[i]
        }
    }
    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-1 {
        switch operators[i-1] {
        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 = operands[0]
    for i in 1...operands.count-1 {
        switch operators[i-1] {
        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] // no operator '**' is defined; did you mean 'pow(_:_:)'?

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 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.isLower() {
                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.isLower() {
                result.append(String(c.uppercased()))
            } else {
                result.append(String(c.lowercased()))
            }
        } else {
            result.append(String(c))
        }
    }
    return result
}
```
if c.isLetter() { // cannot call value of non-function type 'Bool'
if c.isLower() { // value of type 'Character' has no member 'isLower'

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
}
```
if c.isLetter() { // cannot call value of non-function type 'Bool'
if c.isLowercase() { // cannot call value of non-function type 'Bool'

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
}
```
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
}
```
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 = [Character]()
    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 String(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 = [Character]()
    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 String(result)
}
```
if c.isLetter() { // cannot call value of non-function type 'Bool'
if c.isLowercase() { // cannot call value of non-function type 'Bool'
result.append(String(c.uppercased())) // no exact matches in call to instance method 'append'
result.append(String(c.lowercased())) // no exact matches in call to instance method 'append'
result.append(String(c)) // no exact matches in call to instance method 'append'

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 = [Character]()
    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 String(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 = [Character]()
    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 String(result)
}
```
if c.isLetter() { // cannot call value of non-function type 'Bool'
if c.isLowercase() { // cannot call value of non-function type 'Bool'
result.append(String(c.uppercased())) // no exact matches in call to instance method 'append'
result.append(String(c.lowercased())) // no exact matches in call to instance method 'append'

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.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'

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.hex
}
```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.hex
}
```
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]()
    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] = []
    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