Metadata

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

Solutions

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    for i in 0..<numbers.count - 1 {
        let first = numbers[i]
        let second = numbers[i + 1]
        if abs(first - second) <= 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 - 1 {
        let first = numbers[i]
        let second = numbers[i + 1]
        if abs(first - second) <= threshold {
            return true
        }
    }
    return false
}
```
 // XCTAssertTrue failed

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

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    var result = false
    for i in 0..<numbers.count - 1 {
        let diff = abs(numbers[i] - numbers[i + 1])
        if diff <= threshold {
            result = true
            break
        }
    }
    return result
}
```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 result = false
    for i in 0..<numbers.count - 1 {
        let diff = abs(numbers[i] - numbers[i + 1])
        if diff <= threshold {
            result = true
            break
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    var result = false
    for i in 0..<numbers.count-1 {
        let diff = abs(numbers[i] - numbers[i+1])
        if diff <= threshold {
            result = true
            break
        }
    }
    return result
}
```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 result = false
    for i in 0..<numbers.count-1 {
        let diff = abs(numbers[i] - numbers[i+1])
        if diff <= threshold {
            result = true
            break
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    var prev: Double?
    for number in numbers {
        if let prev = prev {
            if abs(prev - number) <= threshold {
                return true
            }
        }
        prev = number
    }
    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 {
    var prev: Double?
    for number in numbers {
        if let prev = prev {
            if abs(prev - number) <= threshold {
                return true
            }
        }
        prev = number
    }
    return false
}
```
 // XCTAssertTrue failed

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    var result = false
    for i in 0..<numbers.count-1 {
        if abs(numbers[i] - numbers[i+1]) <= threshold {
            result = true
            break
        }
    }
    return result
}
```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 result = false
    for i in 0..<numbers.count-1 {
        if abs(numbers[i] - numbers[i+1]) <= threshold {
            result = true
            break
        }
    }
    return result
}
```
 // XCTAssertTrue failed

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

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

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

func hasCloseElements(numbers: [Double], threshold: Double) -> Bool {
    var prev: Double?
    for num in numbers {
        if let prev = prev {
            if abs(prev - num) <= threshold {
                return true
            }
        }
        prev = num
    }
    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 {
    var prev: Double?
    for num in numbers {
        if let prev = prev {
            if abs(prev - num) <= threshold {
                return true
            }
        }
        prev = num
    }
    return false
}
```
 // XCTAssertTrue failed

func separateParenGroups(parenString: String) -> [String] {
    // Write your code here.
}
```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] {
    // Write your code here.
}
```
} // missing return in global function expected to return '[String]'

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

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

func separateParenGroups(parenString: String) -> [String] {
    // Write your code here.
}
```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] {
    // Write your code here.
}
```
} // missing return in global function expected to return '[String]'

func separateParenGroups(parenString: String) -> [String] {
    // Write your code here.
    var result = [String]()
    var temp = ""
    var count = 0
    for char in parenString {
        if char == "(" {
            count += 1
            temp += String(char)
        } else if char == ")" {
            count -= 1
            temp += String(char)
        }
        if count == 0 {
            result.append(temp)
            temp = ""
        }
    }
    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] {
    // Write your code here.
    var result = [String]()
    var temp = ""
    var count = 0
    for char in parenString {
        if char == "(" {
            count += 1
            temp += String(char)
        } else if char == ")" {
            count -= 1
            temp += String(char)
        }
        if count == 0 {
            result.append(temp)
            temp = ""
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func separateParenGroups(parenString: String) -> [String] {
    // Write your code here.
    var result = [String]()
    var temp = ""
    var count = 0
    for char in parenString {
        if char == "(" {
            count += 1
            temp += String(char)
        } else if char == ")" {
            count -= 1
            temp += String(char)
        }
        if count == 0 {
            result.append(temp)
            temp = ""
        }
    }
    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] {
    // Write your code here.
    var result = [String]()
    var temp = ""
    var count = 0
    for char in parenString {
        if char == "(" {
            count += 1
            temp += String(char)
        } else if char == ")" {
            count -= 1
            temp += String(char)
        }
        if count == 0 {
            result.append(temp)
            temp = ""
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func separateParenGroups(parenString: String) -> [String] {
    // Write your code here.
    var result = [String]()
    var temp = ""
    var count = 0
    for char in parenString {
        if char == "(" {
            count += 1
            temp += String(char)
        } else if char == ")" {
            count -= 1
            temp += String(char)
        }
        if count == 0 {
            result.append(temp)
            temp = ""
        }
    }
    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] {
    // Write your code here.
    var result = [String]()
    var temp = ""
    var count = 0
    for char in parenString {
        if char == "(" {
            count += 1
            temp += String(char)
        } else if char == ")" {
            count -= 1
            temp += String(char)
        }
        if count == 0 {
            result.append(temp)
            temp = ""
        }
    }
    return result
}
```
 // XCTAssertTrue failed

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

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

func separateParenGroups(parenString: String) -> [String] {
    // Write your code here.
    var result = [String]()
    var temp = ""
    var count = 0
    for char in parenString {
        if char == "(" {
            count += 1
            temp.append(char)
        } else if char == ")" {
            count -= 1
            temp.append(char)
        }
        if count == 0 {
            result.append(temp)
            temp = ""
        }
    }
    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] {
    // Write your code here.
    var result = [String]()
    var temp = ""
    var count = 0
    for char in parenString {
        if char == "(" {
            count += 1
            temp.append(char)
        } else if char == ")" {
            count -= 1
            temp.append(char)
        }
        if count == 0 {
            result.append(temp)
            temp = ""
        }
    }
    return result
}
```
 // XCTAssertTrue failed

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

func belowZero(operations: [Int]) -> Bool {
    var balance = 0
    for operation in operations {
        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)
    return mean(numbers: numbers) { abs($0 - mean) }
}
```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)
    return mean(numbers: numbers) { abs($0 - mean) }
}
```
let mean = mean(numbers: numbers) // use of local variable 'mean' before its declaration

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

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

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

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

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

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

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

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

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

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    var last = numbers.first
    for number in numbers.dropFirst() {
        result.append(last!)
        result.append(delimeter)
        last = number
    }
    result.append(last!)
    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]()
    var last = numbers.first
    for number in numbers.dropFirst() {
        result.append(last!)
        result.append(delimeter)
        last = number
    }
    result.append(last!)
    return result
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

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

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

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerate() {
        result.append(number)
        if index!= numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```swift
// Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
// intersperse(numbers: [] as [Int], delimeter: 4) == [] as [Int]
// intersperse(numbers: [1, 2, 3], delimeter: 4) == [1, 4, 2, 4, 3]
func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    var result = [Int]()
    for (index, number) in numbers.enumerate() {
        result.append(number)
        if index!= numbers.count - 1 {
            result.append(delimeter)
        }
    }
    return result
}
```
for (index, number) in numbers.enumerate() { // value of type '[Int]' has no member 'enumerate'
if index!= numbers.count - 1 { // '=' must have consistent whitespace on both sides

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

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

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

func intersperse(numbers: [Int], delimeter: Int) -> [Int] {
    return numbers.reduce([Int]()) { (result, number) in
        result + [number] + (result.isEmpty? [] : [delimeter])
    }
}
```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] {
    return numbers.reduce([Int]()) { (result, number) in
        result + [number] + (result.isEmpty? [] : [delimeter])
    }
}
```
result + [number] + (result.isEmpty? [] : [delimeter]) // expected ',' separator
result + [number] + (result.isEmpty? [] : [delimeter]) // cannot use optional chaining on non-optional value of type 'Bool'
result + [number] + (result.isEmpty? [] : [delimeter]) // expected expression in list of expressions
result + [number] + (result.isEmpty? [] : [delimeter]) // value of optional type '[Int]?' must be unwrapped to a value of type '[Int]'
result + [number] + (result.isEmpty? [] : [delimeter]) // value of type 'Bool' has no subscripts

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

func sumProduct(numbers: [Int]) -> (Int, Int) {
    var sum = 0
    var product = 1
    for num in numbers {
        sum += num
        product *= num
    }
    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 num in numbers {
        sum += num
        product *= num
    }
    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 num in numbers {
        sum += num
        product *= num
    }
    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 num in numbers {
        sum += num
        product *= num
    }
    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 maxes = [Int]()
    var max = Int.min
    for number in numbers {
        max = max > number? 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 maxes = [Int]()
    var max = Int.min
    for number in numbers {
        max = max > number? max : number
        maxes.append(max)
    }
    return maxes
}
```
max = max > number? max : number // cannot use optional chaining on non-optional value of type 'Int'
max = max > number? max : number // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
max = max > number? max : number // variable is unused
max = max > number? max : number // expected expression
max = max > number? max : number // consecutive statements on a line must be separated by ';'
max = max > number? max : number // cannot assign value of type 'Bool' to type 'Int'
max = max > number? max : number // consecutive statements on a line must be separated by ';'

func rollingMax(numbers: [Int]) -> [Int] {
    var maxes = [Int]()
    var max = numbers[0]
    for number in numbers {
        max = max > number? 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 maxes = [Int]()
    var max = numbers[0]
    for number in numbers {
        max = max > number? max : number
        maxes.append(max)
    }
    return maxes
}
```
max = max > number? max : number // cannot use optional chaining on non-optional value of type 'Int'
max = max > number? max : number // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
max = max > number? max : number // variable is unused
max = max > number? max : number // expected expression
max = max > number? max : number // consecutive statements on a line must be separated by ';'
max = max > number? max : number // cannot assign value of type 'Bool' to type 'Int'
max = max > number? max : number // consecutive statements on a line must be separated by ';'

func rollingMax(numbers: [Int]) -> [Int] {
    var maxes: [Int] = []
    var max = numbers[0]
    for number in numbers {
        max = max > number? 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 maxes: [Int] = []
    var max = numbers[0]
    for number in numbers {
        max = max > number? max : number
        maxes.append(max)
    }
    return maxes
}
```
max = max > number? max : number // cannot use optional chaining on non-optional value of type 'Int'
max = max > number? max : number // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
max = max > number? max : number // variable is unused
max = max > number? max : number // expected expression
max = max > number? max : number // consecutive statements on a line must be separated by ';'
max = max > number? max : number // cannot assign value of type 'Bool' to type 'Int'
max = max > number? max : number // consecutive statements on a line must be separated by ';'

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

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

func rollingMax(numbers: [Int]) -> [Int] {
    var maxes = [Int]()
    var max = Int.min
    for number in numbers {
        max = max > number? 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 maxes = [Int]()
    var max = Int.min
    for number in numbers {
        max = max > number? max : number
        maxes.append(max)
    }
    return maxes
}
```
max = max > number? max : number // cannot use optional chaining on non-optional value of type 'Int'
max = max > number? max : number // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
max = max > number? max : number // variable is unused
max = max > number? max : number // expected expression
max = max > number? max : number // consecutive statements on a line must be separated by ';'
max = max > number? max : number // cannot assign value of type 'Bool' to type 'Int'
max = max > number? max : number // consecutive statements on a line must be separated by ';'

func rollingMax(numbers: [Int]) -> [Int] {
    var maxes = [Int]()
    var max = numbers[0]
    maxes.append(max)
    for i in 1..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        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 maxes = [Int]()
    var max = numbers[0]
    maxes.append(max)
    for i in 1..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        maxes.append(max)
    }
    return maxes
}
```
 // Fatal error: Index out of range

func rollingMax(numbers: [Int]) -> [Int] {
    var maxes = [Int]()
    var max = numbers[0]
    maxes.append(max)
    for i in 1..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        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 maxes = [Int]()
    var max = numbers[0]
    maxes.append(max)
    for i in 1..<numbers.count {
        if numbers[i] > max {
            max = numbers[i]
        }
        maxes.append(max)
    }
    return maxes
}
```
 // Fatal error: Index out of range

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

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

func makePalindrome(string: String) -> String {
    let palindrome = string.palindrome
    let prefix = string.prefix(upTo: palindrome.startIndex)
    let suffix = string.suffix(from: palindrome.endIndex)
    return suffix + string + prefix
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    let palindrome = string.palindrome
    let prefix = string.prefix(upTo: palindrome.startIndex)
    let suffix = string.suffix(from: palindrome.endIndex)
    return suffix + string + prefix
}
```
let palindrome = string.palindrome // value of type 'String' has no member 'palindrome'

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

func makePalindrome(string: String) -> String {
    let reversed = String(string.reversed())
    let palindrome = string + reversed
    let palindromePrefix = palindrome.prefix(palindrome.count / 2)
    let palindromeSuffix = palindrome.suffix(palindrome.count / 2)
    if palindromeSuffix == palindromeSuffix.reversed() {
        return palindrome
    } else {
        return makePalindrome(string: String(palindromePrefix.reversed())) + palindromeSuffix
    }
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    let reversed = String(string.reversed())
    let palindrome = string + reversed
    let palindromePrefix = palindrome.prefix(palindrome.count / 2)
    let palindromeSuffix = palindrome.suffix(palindrome.count / 2)
    if palindromeSuffix == palindromeSuffix.reversed() {
        return palindrome
    } else {
        return makePalindrome(string: String(palindromePrefix.reversed())) + palindromeSuffix
    }
}
```
if palindromeSuffix == palindromeSuffix.reversed() { // cannot convert value of type '[Substring.Element]' (aka 'Array<Character>') to expected argument type 'String.SubSequence' (aka 'Substring')

func makePalindrome(string: String) -> String {
    let reversed = string.reversed()
    let prefix = string.prefix(string.count / 2)
    let postfix = string.suffix(string.count / 2)
    if postfix == postfix.reversed() {
        return string + reversed
    } else {
        return makePalindrome(string: string + reversed)
    }
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    let reversed = string.reversed()
    let prefix = string.prefix(string.count / 2)
    let postfix = string.suffix(string.count / 2)
    if postfix == postfix.reversed() {
        return string + reversed
    } else {
        return makePalindrome(string: string + reversed)
    }
}
```
if postfix == postfix.reversed() { // cannot convert value of type '[Substring.Element]' (aka 'Array<Character>') to expected argument type 'String.SubSequence' (aka 'Substring')

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

    let reversedString = String(string.reversed())
    let palindrome = string + reversedString

    var leftIndex = 0
    var rightIndex = palindrome.count - 1
    while leftIndex < rightIndex {
        if palindrome[leftIndex]!= palindrome[rightIndex] {
            break
        }
        leftIndex += 1
        rightIndex -= 1
    }

    let prefix = String(palindrome[leftIndex..<rightIndex])
    let suffix = String(palindrome[rightIndex...])
    let reversedPrefix = String(prefix.reversed())

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

    let reversedString = String(string.reversed())
    let palindrome = string + reversedString

    var leftIndex = 0
    var rightIndex = palindrome.count - 1
    while leftIndex < rightIndex {
        if palindrome[leftIndex]!= palindrome[rightIndex] {
            break
        }
        leftIndex += 1
        rightIndex -= 1
    }

    let prefix = String(palindrome[leftIndex..<rightIndex])
    let suffix = String(palindrome[rightIndex...])
    let reversedPrefix = String(prefix.reversed())

    return suffix + reversedPrefix + string
}
```
guard!string.isEmpty else { return "" } // expected expression, var, let or case in 'guard' condition
if palindrome[leftIndex]!= palindrome[rightIndex] { // cannot force unwrap value of non-optional type 'Character'
if palindrome[leftIndex]!= palindrome[rightIndex] { // use of '=' in a boolean context, did you mean '=='?
if palindrome[leftIndex]!= palindrome[rightIndex] { // '=' must have consistent whitespace on both sides
let prefix = String(palindrome[leftIndex..<rightIndex]) // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.
let suffix = String(palindrome[rightIndex...]) // 'subscript(_:)' is unavailable: cannot subscript String with an integer range, use a String.Index range instead.

func makePalindrome(string: String) -> String {
    let reversed = string.reversed()
    let palindrome = string + reversed
    let palindromeIndex = palindrome.index(palindrome.startIndex, offsetBy: string.count)
    let palindromePrefix = palindrome.prefix(upTo: palindromeIndex)
    let palindromeSuffix = palindrome.suffix(from: palindromeIndex)
    return string + String(palindromeSuffix.reversed())
}
```swift
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of supplied string that is a palindrome.
// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
// makePalindrome(string: "") == ""
// makePalindrome(string: "cat") == "catac"
// makePalindrome(string: "cata") == "catac"
func makePalindrome(string: String) -> String {
    let reversed = string.reversed()
    let palindrome = string + reversed
    let palindromeIndex = palindrome.index(palindrome.startIndex, offsetBy: string.count)
    let palindromePrefix = palindrome.prefix(upTo: palindromeIndex)
    let palindromeSuffix = palindrome.suffix(from: palindromeIndex)
    return string + String(palindromeSuffix.reversed())
}
```
let palindromePrefix = palindrome.prefix(upTo: palindromeIndex) // initialization of immutable value 'palindromePrefix' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

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

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

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

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

func stringXor(a: String, b: String) -> String {
    var result = ""
    for (index, char) in a.enumerated() {
        let bChar = b[b.index(b.startIndex, offsetBy: index)]
        result += String(char!= bChar? "1" : "0")
    }
    return result
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    var result = ""
    for (index, char) in a.enumerated() {
        let bChar = b[b.index(b.startIndex, offsetBy: index)]
        result += String(char!= bChar? "1" : "0")
    }
    return result
}
```
result += String(char!= bChar? "1" : "0") // value of optional type 'Character?' must be unwrapped to a value of type 'Character'
result += String(char!= bChar? "1" : "0") // cannot convert value of type 'String' to expected argument type 'String.Encoding'
result += String(char!= bChar? "1" : "0") // missing argument labels 'bytes:encoding:' in call
result += String(char!= bChar? "1" : "0") // expected ',' separator
result += String(char!= bChar? "1" : "0") // '=' must have consistent whitespace on both sides
result += String(char!= bChar? "1" : "0") // cannot force unwrap value of non-optional type 'String.Element' (aka 'Character')
result += String(char!= bChar? "1" : "0") // value of optional type 'String?' must be unwrapped to a value of type 'String'
result += String(char!= bChar? "1" : "0") // cannot use optional chaining on non-optional value of type 'Character'
result += String(char!= bChar? "1" : "0") // type '()' cannot conform to 'Sequence'

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

func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        if a[i] == b[i] {
            result.append("0")
        } else {
            result.append("1")
        }
    }
    return result
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        if a[i] == b[i] {
            result.append("0")
        } else {
            result.append("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, j) in zip(a, b) {
        result += String(i!= j? "1" : "0")
    }
    return result
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    var result = ""
    for (i, j) in zip(a, b) {
        result += String(i!= j? "1" : "0")
    }
    return result
}
```
result += String(i!= j? "1" : "0") // cannot force unwrap value of non-optional type 'String.Element' (aka 'Character')
result += String(i!= j? "1" : "0") // type '()' cannot conform to 'Sequence'
result += String(i!= j? "1" : "0") // '=' must have consistent whitespace on both sides
result += String(i!= j? "1" : "0") // cannot use optional chaining on non-optional value of type 'String.Element' (aka 'Character')
result += String(i!= j? "1" : "0") // cannot convert value of type 'String' to expected argument type 'String.Encoding'
result += String(i!= j? "1" : "0") // expected ',' separator
result += String(i!= j? "1" : "0") // value of optional type 'String.Element?' (aka 'Optional<Character>') must be unwrapped to a value of type 'String.Element' (aka 'Character')
result += String(i!= j? "1" : "0") // value of optional type 'String?' must be unwrapped to a value of type 'String'
result += String(i!= j? "1" : "0") // missing argument labels 'bytes:encoding:' in call

func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        if a[i] == b[i] {
            result.append("0")
        } else {
            result.append("1")
        }
    }
    return result
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    var result = ""
    for i in 0..<a.count {
        if a[i] == b[i] {
            result.append("0")
        } else {
            result.append("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, j) in zip(a, b) {
        result += String(i!= j? "1" : "0")
    }
    return result
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    var result = ""
    for (i, j) in zip(a, b) {
        result += String(i!= j? "1" : "0")
    }
    return result
}
```
result += String(i!= j? "1" : "0") // cannot force unwrap value of non-optional type 'String.Element' (aka 'Character')
result += String(i!= j? "1" : "0") // type '()' cannot conform to 'Sequence'
result += String(i!= j? "1" : "0") // '=' must have consistent whitespace on both sides
result += String(i!= j? "1" : "0") // cannot use optional chaining on non-optional value of type 'String.Element' (aka 'Character')
result += String(i!= j? "1" : "0") // cannot convert value of type 'String' to expected argument type 'String.Encoding'
result += String(i!= j? "1" : "0") // expected ',' separator
result += String(i!= j? "1" : "0") // value of optional type 'String.Element?' (aka 'Optional<Character>') must be unwrapped to a value of type 'String.Element' (aka 'Character')
result += String(i!= j? "1" : "0") // value of optional type 'String?' must be unwrapped to a value of type 'String'
result += String(i!= j? "1" : "0") // missing argument labels 'bytes:encoding:' in call

func stringXor(a: String, b: String) -> String {
    // TODO: Write your code here
    return ""
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    // TODO: Write your code here
    return ""
}
```
 // XCTAssertTrue failed

func stringXor(a: String, b: String) -> String {
    return ""
}
```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 ""
}
```
 // XCTAssertTrue failed

func stringXor(a: String, b: String) -> String {
    // TODO: Implement this function
    return ""
}
```swift
// Input are two strings a and b consisting only of 1s and 0s.
// Perform binary XOR on these inputs and return result also as a string.
// stringXor(a: "010", b: "110") == "100"
func stringXor(a: String, b: String) -> String {
    // TODO: Implement this function
    return ""
}
```
 // XCTAssertTrue failed

func stringXor(a: String, b: String) -> String {
    return ""
}
```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 ""
}
```
 // XCTAssertTrue failed

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

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

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

func longest(strings: [String]) -> String? {
    // TODO: Implement this function
    return nil
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    // TODO: Implement this function
    return nil
}
```
 // XCTAssertTrue failed

func longest(strings: [String]) -> String? {
    // TODO: Implement this function
    return nil
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    // TODO: Implement this function
    return nil
}
```
 // XCTAssertTrue failed

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

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

func longest(strings: [String]) -> String? {
    // TODO: Implement this function
    return nil
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    // TODO: Implement this function
    return nil
}
```
 // XCTAssertTrue failed

func longest(strings: [String]) -> String? {
    var longestString: String?
    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: String?
    for string in strings {
        if longestString == nil || string.count > longestString!.count {
            longestString = string
        }
    }
    return longestString
}
```

func longest(strings: [String]) -> String? {
    // TODO: Implement this function
    return nil
}
```swift
// Out of array of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return nil in case the input array is empty.
// longest(strings: [] as [String]) == nil
// longest(strings: ["a", "b", "c"]) == "a"
// longest(strings: ["a", "bb", "ccc"]) == "ccc"
func longest(strings: [String]) -> String? {
    // TODO: Implement this function
    return nil
}
```
 // XCTAssertTrue failed

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

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

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

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

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

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

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

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

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

func allPrefixes(string: String) -> [String] {
    var prefixes = [String]()
    for i in 0..<string.count {
        prefixes.append(string.substring(to: 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.substring(to: i))
    }
    return prefixes
}
```
prefixes.append(string.substring(to: i)) // cannot convert value of type 'Int' to expected argument type 'String.Index'

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

func countDistinctCharacters(string: String) -> Int {
    return Set(string.lowercased()).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 {
    return Set(string.lowercased()).count
}
```

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

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

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

func countDistinctCharacters(string: String) -> Int {
    // TODO: Write your code here
    return 0
}
```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: Write your code here
    return 0
}
```
 // XCTAssertTrue failed

func countDistinctCharacters(string: String) -> Int {
    return Set(string.lowercased()).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 {
    return Set(string.lowercased()).count
}
```

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

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

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 0
    var currentNote = 0
    for char in musicString {
        switch char {
        case "o":
            currentBeat += 4
        case "o|":
            currentBeat += 2
        case ".|":
            currentBeat += 1
        default:
            break
        }
        if currentBeat == 4 {
            result.append(currentNote)
            currentBeat = 0
            currentNote += 1
        }
    }
    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
    var currentNote = 0
    for char in musicString {
        switch char {
        case "o":
            currentBeat += 4
        case "o|":
            currentBeat += 2
        case ".|":
            currentBeat += 1
        default:
            break
        }
        if currentBeat == 4 {
            result.append(currentNote)
            currentBeat = 0
            currentNote += 1
        }
    }
    return result
}
```
case "o|": // expression pattern of type 'String' cannot match values of type 'Character'
case ".|": // expression pattern of type 'String' cannot match values of type 'Character'

func parseMusic(musicString: String) -> [Int] {
    // Write your code here
    var result = [Int]()
    var count = 0
    for char in musicString {
        if char == "o" {
            count += 1
        } else if char == "|" {
            result.append(count)
            count = 0
        }
    }
    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] {
    // Write your code here
    var result = [Int]()
    var count = 0
    for char in musicString {
        if char == "o" {
            count += 1
        } else if char == "|" {
            result.append(count)
            count = 0
        }
    }
    return result
}
```
 // XCTAssertTrue failed

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

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 0
    var currentNote = 0
    for char in musicString {
        switch char {
        case "o":
            currentBeat += 4
        case "o|":
            currentBeat += 2
        case ".|":
            currentBeat += 1
        default:
            break
        }
        if currentBeat >= 4 {
            result.append(currentNote)
            currentBeat = 0
            currentNote += 1
        }
    }
    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
    var currentNote = 0
    for char in musicString {
        switch char {
        case "o":
            currentBeat += 4
        case "o|":
            currentBeat += 2
        case ".|":
            currentBeat += 1
        default:
            break
        }
        if currentBeat >= 4 {
            result.append(currentNote)
            currentBeat = 0
            currentNote += 1
        }
    }
    return result
}
```
case "o|": // expression pattern of type 'String' cannot match values of type 'Character'
case ".|": // expression pattern of type 'String' cannot match values of type 'Character'

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 0
    var currentNote = 0
    for char in musicString {
        switch char {
        case "o":
            currentBeat += 4
        case "o|":
            currentBeat += 2
        case ".|":
            currentBeat += 1
        default:
            break
        }
        if currentBeat == 4 {
            result.append(currentNote)
            currentNote = 0
            currentBeat = 0
        } else {
            currentNote += 1
        }
    }
    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
    var currentNote = 0
    for char in musicString {
        switch char {
        case "o":
            currentBeat += 4
        case "o|":
            currentBeat += 2
        case ".|":
            currentBeat += 1
        default:
            break
        }
        if currentBeat == 4 {
            result.append(currentNote)
            currentNote = 0
            currentBeat = 0
        } else {
            currentNote += 1
        }
    }
    return result
}
```
case "o|": // expression pattern of type 'String' cannot match values of type 'Character'
case ".|": // expression pattern of type 'String' cannot match values of type 'Character'

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

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var currentBeat = 0
    var currentNote = 0
    for char in musicString {
        switch char {
        case "o":
            currentBeat += 4
        case "o|":
            currentBeat += 2
        case ".|":
            currentBeat += 1
        default:
            break
        }
        if currentBeat == 4 {
            result.append(currentNote)
            currentBeat = 0
            currentNote = 0
        } else {
            currentNote += 1
        }
    }
    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
    var currentNote = 0
    for char in musicString {
        switch char {
        case "o":
            currentBeat += 4
        case "o|":
            currentBeat += 2
        case ".|":
            currentBeat += 1
        default:
            break
        }
        if currentBeat == 4 {
            result.append(currentNote)
            currentBeat = 0
            currentNote = 0
        } else {
            currentNote += 1
        }
    }
    return result
}
```
case "o|": // expression pattern of type 'String' cannot match values of type 'Character'
case ".|": // expression pattern of type 'String' cannot match values of type 'Character'

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

func parseMusic(musicString: String) -> [Int] {
    var result = [Int]()
    var count = 0
    for char in musicString {
        switch char {
        case "o":
            count += 4
        case "o|":
            count += 2
        case ".|":
            count += 1
        default:
            break
        }
        result.append(count)
    }
    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 count = 0
    for char in musicString {
        switch char {
        case "o":
            count += 4
        case "o|":
            count += 2
        case ".|":
            count += 1
        default:
            break
        }
        result.append(count)
    }
    return result
}
```
case "o|": // expression pattern of type 'String' cannot match values of type 'Character'
case ".|": // expression pattern of type 'String' cannot match values of type 'Character'

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

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index < string.endIndex {
        if string[index] == substring[substring.startIndex] {
            var subIndex = substring.startIndex
            var subString = string[index..<string.endIndex]
            while subIndex < substring.endIndex {
                if subString[subIndex] == substring[subIndex] {
                    subIndex = subIndex.advancedBy(1)
                } else {
                    break
                }
            }
            if subIndex == substring.endIndex {
                count++
                index = index.advancedBy(1)
            } else {
                index = index.advancedBy(1)
            }
        } else {
            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.startIndex
    while index < string.endIndex {
        if string[index] == substring[substring.startIndex] {
            var subIndex = substring.startIndex
            var subString = string[index..<string.endIndex]
            while subIndex < substring.endIndex {
                if subString[subIndex] == substring[subIndex] {
                    subIndex = subIndex.advancedBy(1)
                } else {
                    break
                }
            }
            if subIndex == substring.endIndex {
                count++
                index = index.advancedBy(1)
            } else {
                index = index.advancedBy(1)
            }
        } else {
            index = index.advancedBy(1)
        }
    }
    return count
}
```
subIndex = subIndex.advancedBy(1) // value of type 'String.Index' has no member 'advancedBy'
count++ // cannot find operator '++' in scope; did you mean '+= 1'?
index = index.advancedBy(1) // value of type 'String.Index' has no member 'advancedBy'
index = index.advancedBy(1) // value of type 'String.Index' has no member 'advancedBy'
index = index.advancedBy(1) // value of type 'String.Index' has no member 'advancedBy'

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

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index!= string.endIndex {
        if string.hasPrefix(substring) {
            count += 1
            index = string.index(index, offsetBy: substring.count)
        } else {
            index = string.index(index, offsetBy: 1)
        }
    }
    return count
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index!= string.endIndex {
        if string.hasPrefix(substring) {
            count += 1
            index = string.index(index, offsetBy: substring.count)
        } else {
            index = string.index(index, offsetBy: 1)
        }
    }
    return count
}
```
while index!= string.endIndex { // use of '=' in a boolean context, did you mean '=='?
while index!= string.endIndex { // cannot force unwrap value of non-optional type 'String.Index'
while index!= string.endIndex { // '=' must have consistent whitespace on both sides

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index < string.endIndex {
        if string[index] == substring[substring.startIndex] {
            var subIndex = substring.startIndex
            var subString = string[index..<string.endIndex]
            while subIndex < substring.endIndex {
                if subString[subIndex] == substring[subIndex] {
                    subIndex = subIndex.advancedBy(1)
                } else {
                    break
                }
            }
            if subIndex == substring.endIndex {
                count++
                index = index.advancedBy(1)
            } else {
                index = index.advancedBy(1)
            }
        } else {
            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.startIndex
    while index < string.endIndex {
        if string[index] == substring[substring.startIndex] {
            var subIndex = substring.startIndex
            var subString = string[index..<string.endIndex]
            while subIndex < substring.endIndex {
                if subString[subIndex] == substring[subIndex] {
                    subIndex = subIndex.advancedBy(1)
                } else {
                    break
                }
            }
            if subIndex == substring.endIndex {
                count++
                index = index.advancedBy(1)
            } else {
                index = index.advancedBy(1)
            }
        } else {
            index = index.advancedBy(1)
        }
    }
    return count
}
```
subIndex = subIndex.advancedBy(1) // value of type 'String.Index' has no member 'advancedBy'
count++ // cannot find operator '++' in scope; did you mean '+= 1'?
index = index.advancedBy(1) // value of type 'String.Index' has no member 'advancedBy'
index = index.advancedBy(1) // value of type 'String.Index' has no member 'advancedBy'
index = index.advancedBy(1) // value of type 'String.Index' has no member 'advancedBy'

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index < string.endIndex {
        if string[index] == substring[substring.startIndex] {
            var i = index
            var j = substring.startIndex
            while i < string.endIndex && j < substring.endIndex {
                if string[i] == substring[j] {
                    i += 1
                    j += 1
                } else {
                    break
                }
            }
            if j == substring.endIndex {
                count += 1
                index = i
            } else {
                index += 1
            }
        } else {
            index += 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.startIndex
    while index < string.endIndex {
        if string[index] == substring[substring.startIndex] {
            var i = index
            var j = substring.startIndex
            while i < string.endIndex && j < substring.endIndex {
                if string[i] == substring[j] {
                    i += 1
                    j += 1
                } else {
                    break
                }
            }
            if j == substring.endIndex {
                count += 1
                index = i
            } else {
                index += 1
            }
        } else {
            index += 1
        }
    }
    return count
}
```
i += 1 // binary operator '+=' cannot be applied to operands of type 'String.Index' and 'Int'
j += 1 // binary operator '+=' cannot be applied to operands of type 'String.Index' and 'Int'
index += 1 // binary operator '+=' cannot be applied to operands of type 'String.Index' and 'Int'
index += 1 // 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 = 0
    while index < string.count {
        if string.hasPrefix(substring) {
            count += 1
            index += substring.count
        } else {
            index += 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 = 0
    while index < string.count {
        if string.hasPrefix(substring) {
            count += 1
            index += substring.count
        } else {
            index += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index!= string.endIndex {
        if string.hasPrefix(substring) {
            count += 1
            index = string.index(index, offsetBy: substring.count)
        } else {
            index = string.index(index, offsetBy: 1)
        }
    }
    return count
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index!= string.endIndex {
        if string.hasPrefix(substring) {
            count += 1
            index = string.index(index, offsetBy: substring.count)
        } else {
            index = string.index(index, offsetBy: 1)
        }
    }
    return count
}
```
while index!= string.endIndex { // use of '=' in a boolean context, did you mean '=='?
while index!= string.endIndex { // cannot force unwrap value of non-optional type 'String.Index'
while index!= string.endIndex { // '=' must have consistent whitespace on both sides

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index < string.endIndex {
        if string[index] == substring[substring.startIndex] {
            var index2 = index
            var index3 = substring.startIndex
            while index2 < string.endIndex && index3 < substring.endIndex && string[index2] == substring[index3] {
                index2 = string.index(after: index2)
                index3 = substring.index(after: index3)
            }
            if index3 == substring.endIndex {
                count += 1
            }
        }
        index = string.index(after: index)
    }
    return count
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index < string.endIndex {
        if string[index] == substring[substring.startIndex] {
            var index2 = index
            var index3 = substring.startIndex
            while index2 < string.endIndex && index3 < substring.endIndex && string[index2] == substring[index3] {
                index2 = string.index(after: index2)
                index3 = substring.index(after: index3)
            }
            if index3 == substring.endIndex {
                count += 1
            }
        }
        index = string.index(after: index)
    }
    return count
}
```

func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index < string.endIndex {
        if string[index] == substring[substring.startIndex] {
            var i = index
            var j = substring.startIndex
            while i < string.endIndex && j < substring.endIndex && string[i] == substring[j] {
                i = string.index(after: i)
                j = substring.index(after: j)
            }
            if j == substring.endIndex {
                count += 1
            }
        }
        index = string.index(after: index)
    }
    return count
}
```swift
// Find how many times a given substring can be found in the original string. Count overlaping cases.
// howManyTimes(string: "", substring: "a") == 0
// howManyTimes(string: "aaa", substring: "a") == 3
// howManyTimes(string: "aaaa", substring: "aa") == 3
func howManyTimes(string: String, substring: String) -> Int {
    var count = 0
    var index = string.startIndex
    while index < string.endIndex {
        if string[index] == substring[substring.startIndex] {
            var i = index
            var j = substring.startIndex
            while i < string.endIndex && j < substring.endIndex && string[i] == substring[j] {
                i = string.index(after: i)
                j = substring.index(after: j)
            }
            if j == substring.endIndex {
                count += 1
            }
        }
        index = string.index(after: index)
    }
    return count
}
```

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

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

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

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

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

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

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

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    let sorted = numbers.sorted()
    let first = sorted[0]
    let last = sorted[sorted.count - 1]
    let firstIndex = sorted.firstIndex(of: first)!
    let lastIndex = sorted.firstIndex(of: last)!
    let firstDistance = abs(first - numbers[firstIndex - 1])
    let lastDistance = abs(last - numbers[lastIndex + 1])
    if firstDistance < lastDistance {
        return (first, numbers[firstIndex - 1])
    } else {
        return (last, numbers[lastIndex + 1])
    }
}
```swift
// From a supplied array of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
func findClosestElements(numbers: [Double]) -> (Double, Double) {
    let sorted = numbers.sorted()
    let first = sorted[0]
    let last = sorted[sorted.count - 1]
    let firstIndex = sorted.firstIndex(of: first)!
    let lastIndex = sorted.firstIndex(of: last)!
    let firstDistance = abs(first - numbers[firstIndex - 1])
    let lastDistance = abs(last - numbers[lastIndex + 1])
    if firstDistance < lastDistance {
        return (first, numbers[firstIndex - 1])
    } else {
        return (last, numbers[lastIndex + 1])
    }
}

findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
```
 // Fatal error: Index out of range

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

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

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

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

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

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

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

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

// 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,
 // XCTAssertTrue failed

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

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

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

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

func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var minDiff = Double.greatestFiniteMagnitude
    var minDiffIndex = 0
    var maxDiffIndex = 1
    var minDiffElement = numbers[0]
    var maxDiffElement = numbers[1]
    for i in 0..<numbers.count {
        let diff = numbers[i] - numbers[i+1]
        if diff < minDiff {
            minDiff = diff
            minDiffIndex = i
            maxDiffIndex = i + 1
        }
    }
    return (numbers[minDiffIndex], numbers[maxDiffIndex])
}
```swift
// From a supplied array of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
// findClosestElements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
func findClosestElements(numbers: [Double]) -> (Double, Double) {
    var minDiff = Double.greatestFiniteMagnitude
    var minDiffIndex = 0
    var maxDiffIndex = 1
    var minDiffElement = numbers[0]
    var maxDiffElement = numbers[1]
    for i in 0..<numbers.count {
        let diff = numbers[i] - numbers[i+1]
        if diff < minDiff {
            minDiff = diff
            minDiffIndex = i
            maxDiffIndex = i + 1
        }
    }
    return (numbers[minDiffIndex], numbers[maxDiffIndex])
}
```
var minDiffElement = numbers[0] // initialization of variable 'minDiffElement' was never used; consider replacing with assignment to '_' or removing it
var maxDiffElement = numbers[1] // initialization of variable 'maxDiffElement' was never used; consider replacing with assignment to '_' or removing it
 // Fatal error: Index out of range

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

func rescaleToUnit(numbers: [Double]) -> [Double] {
    // TODO: implement
    return []
}
```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] {
    // TODO: implement
    return []
}
```
 // XCTAssertTrue failed

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

func rescaleToUnit(numbers: [Double]) -> [Double] {
    // TODO: Implement this function
    return []
}
```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] {
    // TODO: Implement this function
    return []
}
```
 // XCTAssertTrue failed

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.min()!
    let max = numbers.max()!
    let range = max - min
    return numbers.map { $0 - min }
       .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 min = numbers.min()!
    let max = numbers.max()!
    let range = max - min
    return numbers.map { $0 - min }
       .map { $0 / range }
}
```

func rescaleToUnit(numbers: [Double]) -> [Double] {
    let min = numbers.min()!
    let max = numbers.max()!
    let range = max - min
    return numbers.map { $0 - min }
       .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 min = numbers.min()!
    let max = numbers.max()!
    let range = max - min
    return numbers.map { $0 - min }
       .map { $0 / range }
}
```

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

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

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

func rescaleToUnit(numbers: [Double]) -> [Double] {
    // TODO: implement this function
    return []
}
```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] {
    // TODO: implement this function
    return []
}
```
 // XCTAssertTrue failed

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

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

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

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

func filterIntegers(values: [AnyHashable]) -> [Int] {
    return values.filter { $0 is Int } 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 } as! [Int]
}
```

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            factors.append(i)
            number /= 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 number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            factors.append(i)
            number /= i
        } else {
            i += 1
        }
    }
    return factors
}
```

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            factors.append(i)
            number /= 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 number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            factors.append(i)
            number /= i
        } else {
            i += 1
        }
    }
    return factors
}
```

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            factors.append(i)
            number /= 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 number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            factors.append(i)
            number /= i
        } else {
            i += 1
        }
    }
    return factors
}
```

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            factors.append(i)
            number /= 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 number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            factors.append(i)
            number /= i
        } else {
            i += 1
        }
    }
    return factors
}
```

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            factors.append(i)
            number /= 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 number = n
    var i = 2
    while number > 1 {
        if number % i == 0 {
            factors.append(i)
            number /= i
        } else {
            i += 1
        }
    }
    return factors
}
```

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

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

func factorize(n: Int) -> [Int] {
    var factors = [Int]()
    var number = n
    for i in 2...number {
        while number % i == 0 {
            factors.append(i)
            number /= 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]()
    var number = n
    for i in 2...number {
        while number % i == 0 {
            factors.append(i)
            number /= i
        }
    }
    return factors
}
```

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

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

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

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

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

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

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

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

func removeDuplicates(numbers: [Int]) -> [Int] {
    var result = [Int]()
    var dict = [Int: Int]()
    for num in numbers {
        if dict[num] == nil {
            dict[num] = 1
            result.append(num)
        } else {
            dict[num]! += 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 dict = [Int: Int]()
    for num in numbers {
        if dict[num] == nil {
            dict[num] = 1
            result.append(num)
        } else {
            dict[num]! += 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

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

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

func flipCase(string: String) -> String {
    return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() }
}
```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 { $0.isUppercase? $0.lowercased() : $0.uppercased() }
}
```
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // cannot use optional chaining on non-optional value of type 'Bool'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // expected expression
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // cannot convert return expression of type '[()]' to return type 'String'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'

func flipCase(string: String) -> String {
    return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() }
}
```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 { $0.isUppercase? $0.lowercased() : $0.uppercased() }
}
```
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // cannot use optional chaining on non-optional value of type 'Bool'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // expected expression
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // cannot convert return expression of type '[()]' to return type 'String'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'

func flipCase(string: String) -> String {
    return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() }
       .joined()
}
```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 { $0.isUppercase? $0.lowercased() : $0.uppercased() }
       .joined()
}
```
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // cannot use optional chaining on non-optional value of type 'Bool'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // expected expression
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'

func flipCase(string: String) -> String {
    return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() }
       .reduce("", +)
}
```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 { $0.isUppercase? $0.lowercased() : $0.uppercased() }
       .reduce("", +)
}
```
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // cannot use optional chaining on non-optional value of type 'Bool'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // expected expression
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'

func flipCase(string: String) -> String {
    return string.map {
        if $0.isUppercase {
            return $0.lowercased()
        } else {
            return $0.uppercased()
        }
    }
   .joined()
}
```swift
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
// flipCase(string: "Hello") == "hELLO"
func flipCase(string: String) -> String {
    return string.map {
        if $0.isUppercase {
            return $0.lowercased()
        } else {
            return $0.uppercased()
        }
    }
   .joined()
}
```

func flipCase(string: String) -> String {
    return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() }
       .joined()
}
```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 { $0.isUppercase? $0.lowercased() : $0.uppercased() }
       .joined()
}
```
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // cannot use optional chaining on non-optional value of type 'Bool'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // expected expression
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'

func flipCase(string: String) -> String {
    return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() }
}
```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 { $0.isUppercase? $0.lowercased() : $0.uppercased() }
}
```
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // cannot use optional chaining on non-optional value of type 'Bool'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // expected expression
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // cannot convert return expression of type '[()]' to return type 'String'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'

func flipCase(string: String) -> String {
    return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() }
}
```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 { $0.isUppercase? $0.lowercased() : $0.uppercased() }
}
```
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // cannot use optional chaining on non-optional value of type 'Bool'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // expected expression
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // cannot convert return expression of type '[()]' to return type 'String'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'

func flipCase(string: String) -> String {
    return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() }
       .reduce("", +)
}
```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 { $0.isUppercase? $0.lowercased() : $0.uppercased() }
       .reduce("", +)
}
```
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // cannot use optional chaining on non-optional value of type 'Bool'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // expected expression
return string.map { $0.isUppercase? $0.lowercased() : $0.uppercased() } // consecutive statements on a line must be separated by ';'

func flipCase(string: String) -> String {
    return string.map {
        if $0.isLowercase {
            return String($0.uppercased())
        } else {
            return String($0.lowercased())
        }
    }.reduce("", +)
}
```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())
        }
    }.reduce("", +)
}
```

func concatenate(strings: [String]) -> String {
    // TODO: Write your code here
}
```swift
// Concatenate array of strings into a single string
// concatenate(strings: [] as [String]) == ""
// concatenate(strings: ["a", "b", "c"]) == "abc"
func concatenate(strings: [String]) -> String {
    // TODO: Write your code here
}
```
} // missing return in global function expected to return 'String'

func concatenate(strings: [String]) -> String {
    var result = ""
    for string in strings {
        result += 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 += string
    }
    return result
}
```

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

func concatenate(strings: [String]) -> String {
    var result = ""
    for string in strings {
        result += 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 += string
    }
    return result
}
```

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

func concatenate(strings: [String]) -> String {
    var result = ""
    for string in strings {
        result += 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 += string
    }
    return result
}
```

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

func concatenate(strings: [String]) -> String {
    return strings.reduce("", +)
}

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

// Concatenate array of integers into a single integer
// concatenate(integers: [] as [Int]) == 0
// concatenate(integers: [1, 2, 3]) == 6
func concatenate(integers: [Int]) -> Int {
    return integers.reduce(0, +)
}
```

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

func isPrime(n: Int) -> Bool {
    // TODO: Write your code here
    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 {
    // TODO: Write your code here
    return true
}
```
 // XCTAssertTrue failed

func isPrime(n: Int) -> Bool {
    // Write your code here.
    if n <= 1 {
        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 {
    // Write your code here.
    if n <= 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

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

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

func isPrime(n: Int) -> Bool {
    // TODO: Write your code here.
    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 {
    // TODO: Write your code here.
    if n < 2 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

func isPrime(n: Int) -> Bool {
    // TODO: Write your code here.
    var count = 0
    for i in 1...n {
        if n % i == 0 {
            count += 1
        }
    }
    return count == 2
}
```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 {
    // TODO: Write your code here.
    var count = 0
    for i in 1...n {
        if n % i == 0 {
            count += 1
        }
    }
    return count == 2
}
```

func isPrime(n: Int) -> Bool {
    // TODO: Write your code here
    return false
}
```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 {
    // TODO: Write your code here
    return false
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    var l = l
    var i = 0
    while i < l.count {
        if i % 3 == 0 {
            i += 1
            continue
        }
        let j = i
        var k = j
        while k > 0 && l[k] < l[k - 1] {
            swap(&l[k], &l[k - 1])
            k -= 1
        }
        i += 1
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// sortThird(l: [1, 2, 3]) == [1, 2, 3]
// sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
func sortThird(l: [Int]) -> [Int] {
    var l = l
    var i = 0
    while i < l.count {
        if i % 3 == 0 {
            i += 1
            continue
        }
        let j = i
        var k = j
        while k > 0 && l[k] < l[k - 1] {
            swap(&l[k], &l[k - 1])
            k -= 1
        }
        i += 1
    }
    return l
}
```
swap(&l[k], &l[k - 1]) // overlapping accesses to 'l', but modification requires exclusive access; consider calling MutableCollection.swapAt(_:_:)

func sortThird(l: [Int]) -> [Int] {
    var l = l
    var sorted = [Int]()
    for i in 0..<l.count {
        if i % 3!= 0 {
            sorted.append(l[i])
        } else {
            sorted.append(l[i])
            sorted.sort()
        }
    }
    return sorted
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// sortThird(l: [1, 2, 3]) == [1, 2, 3]
// sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
func sortThird(l: [Int]) -> [Int] {
    var l = l
    var sorted = [Int]()
    for i in 0..<l.count {
        if i % 3!= 0 {
            sorted.append(l[i])
        } else {
            sorted.append(l[i])
            sorted.sort()
        }
    }
    return sorted
}
```
if i % 3!= 0 { // '=' must have consistent whitespace on both sides
if i % 3!= 0 { // expression is not assignable: binary operator returns immutable value
if i % 3!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 3!= 0 { // cannot force unwrap value of non-optional type 'Int'

func sortThird(l: [Int]) -> [Int] {
    // TODO: Implement this function
    return []
}
```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] {
    // TODO: Implement this function
    return []
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    // TODO: Implement this function
    return []
}
```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] {
    // TODO: Implement this function
    return []
}
```
 // XCTAssertTrue failed

func sortThird(l: [Int]) -> [Int] {
    // TODO: Implement this function
    return []
}
```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] {
    // TODO: Implement this function
    return []
}

// 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] {
    // TODO: Implement this function
    return []
}

// 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] {
    // TODO: Implement this function
    return []
}

// 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] {
    // TODO: Implement this function
    return []
}

// 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] {
    // TODO: Implement this function
    return []
}

// 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] {
    // TODO: Implement this function
    return []
}

// 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
 // XCTAssertTrue failed

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

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

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

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

func sortThird(l: [Int]) -> [Int] {
    var l = l
    let third = l.count / 3
    var i = 0
    while i < third {
        let j = i * 3
        let k = j + 2
        let temp = l[j]
        l[j] = l[k]
        l[k] = temp
        i += 1
    }
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corresponding indicies of l, but sorted.
// sortThird(l: [1, 2, 3]) == [1, 2, 3]
// sortThird(l: [5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
func sortThird(l: [Int]) -> [Int] {
    var l = l
    let third = l.count / 3
    var i = 0
    while i < third {
        let j = i * 3
        let k = j + 2
        let temp = l[j]
        l[j] = l[k]
        l[k] = temp
        i += 1
    }
    return l
}
```
 // 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]()
    for item in l {
        if!result.contains(item) {
            result.append(item)
        }
    }
    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 item in l {
        if!result.contains(item) {
            result.append(item)
        }
    }
    return result
}
```
if!result.contains(item) { // expected expression, var, or let in 'if' condition

func unique(l: [Int]) -> [Int] {
    return Array(Set(l))
}
```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] {
    return Array(Set(l))
}
```
 // XCTAssertTrue failed

func unique(l: [Int]) -> [Int] {
    var set = Set<Int>()
    var array = [Int]()
    for i in l {
        if!set.contains(i) {
            set.insert(i)
            array.append(i)
        }
    }
    return array
}
```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 set = Set<Int>()
    var array = [Int]()
    for i in l {
        if!set.contains(i) {
            set.insert(i)
            array.append(i)
        }
    }
    return array
}
```
if!set.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] {
    return Array(Set(l))
}
```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] {
    return Array(Set(l))
}
```
 // XCTAssertTrue failed

func unique(l: [Int]) -> [Int] {
    return Array(Set(l))
}
```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] {
    return Array(Set(l))
}
```
 // XCTAssertTrue failed

func maxElement(l: [Int]) -> Int {
    return l.max()?? 0
}
```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 {
    return l.max()?? 0
}
```
return l.max()?? 0 // consecutive statements on a line must be separated by ';'
return l.max()?? 0 // integer literal is unused
return l.max()?? 0 // cannot use optional chaining on non-optional value of type 'Int'

func maxElement(l: [Int]) -> Int {
    return l.reduce(0, 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 {
    return l.reduce(0, 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 {
    return l.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 {
    return l.max()!
}
```

func maxElement(l: [Int]) -> Int {
    return l.reduce(Int.min) { max($0, $1) }
}
```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 {
    return l.reduce(Int.min) { max($0, $1) }
}
```

func maxElement(l: [Int]) -> Int {
    return l.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 {
    return l.max()!
}
```

func maxElement(l: [Int]) -> Int {
    return l.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 {
    return l.max()!
}
```

func maxElement(l: [Int]) -> Int {
    return l.reduce(Int.min) { max($0, $1) }
}
```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 {
    return l.reduce(Int.min) { max($0, $1) }
}
```

func maxElement(l: [Int]) -> Int {
    return l.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 {
    return l.max()!
}
```

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

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

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

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

func sortEven(l: [Int]) -> [Int] {
    // TODO: Implement this function
    return []
}
```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] {
    // TODO: Implement this function
    return []
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    return l.enumerated().map { (index, value) in
        if index % 2 == 0 {
            return value
        } else {
            return l.sorted()[index]
        }
    }
}
```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] {
    return l.enumerated().map { (index, value) in
        if index % 2 == 0 {
            return value
        } else {
            return l.sorted()[index]
        }
    }
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    // TODO: Implement this function
    return []
}
```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] {
    // TODO: Implement this function
    return []
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    return l.enumerated().map { (index, value) -> Int in
        if index % 2 == 0 {
            return value
        } else {
            return l.sorted()[index]
        }
    }
}
```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] {
    return l.enumerated().map { (index, value) -> Int in
        if index % 2 == 0 {
            return value
        } else {
            return l.sorted()[index]
        }
    }
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    return l.enumerated().map { (i, x) in
        if i % 2 == 0 {
            return x
        } else {
            return l.sorted()[i]
        }
    }
}
```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] {
    return l.enumerated().map { (i, x) in
        if i % 2 == 0 {
            return x
        } else {
            return l.sorted()[i]
        }
    }
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    return l.enumerated().map { (index, value) in
        if index % 2 == 0 {
            return value
        } else {
            return l.sorted()[index]
        }
    }
}
```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] {
    return l.enumerated().map { (index, value) in
        if index % 2 == 0 {
            return value
        } else {
            return l.sorted()[index]
        }
    }
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    return l.enumerated().map { (index, value) in
        if index % 2 == 0 {
            return value
        } else {
            return l.sorted()[index]
        }
    }
}
```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] {
    return l.enumerated().map { (index, value) in
        if index % 2 == 0 {
            return value
        } else {
            return l.sorted()[index]
        }
    }
}
```
 // XCTAssertTrue failed

func sortEven(l: [Int]) -> [Int] {
    var l = l
    let even = l.filter { $0 % 2 == 0 }
    let odd = l.filter { $0 % 2!= 0 }
    l = even.sorted() + odd
    return l
}
```swift
// This function takes an array l and returns an array l' such that
// l' is identical to l in the odd indicies, while its values at the even indicies are equal
// to the values of the even indicies of l, but sorted.
// sortEven(l: [1, 2, 3]) == [1, 2, 3]
// sortEven(l: [5, 6, 3, 4]) == [3, 6, 5, 4]
func sortEven(l: [Int]) -> [Int] {
    var l = l
    let even = l.filter { $0 % 2 == 0 }
    let odd = l.filter { $0 % 2!= 0 }
    l = even.sorted() + odd
    return l
}
```
let odd = l.filter { $0 % 2!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
let odd = l.filter { $0 % 2!= 0 } // '=' must have consistent whitespace on both sides
let odd = l.filter { $0 % 2!= 0 } // expression is not assignable: binary operator returns immutable value
let odd = l.filter { $0 % 2!= 0 } // cannot force unwrap value of non-optional type 'Int'

func sortEven(l: [Int]) -> [Int] {
    return l.enumerated().map { (i, v) in
        if i % 2 == 0 {
            return v
        } else {
            return l.sorted()[i]
        }
    }
}
```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] {
    return l.enumerated().map { (i, v) in
        if i % 2 == 0 {
            return v
        } else {
            return l.sorted()[i]
        }
    }
}
```
 // XCTAssertTrue failed

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

func primeFib(n: Int) -> Int {
    var fib = [Int]()
    var i = 0
    var j = 1
    var k = 1
    while i < n {
        if isPrime(num: k) {
            fib.append(k)
            i += 1
        }
        k = i + j
        i = j
        j = k
    }
    return fib.last!
}

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

func isPrime(num: Int) -> Bool {
    if num < 2 {
        return false
    }
    if num == 2 {
        return true
    }
    if num % 2 == 0 {
        return false
    }
    var i = 3
    while i * i <= num {
        if num % i == 0 {
            return false
        }
        i += 2
    }
    return true
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

func incrList(l: [Int]) -> [Int] {
    return l.map { $0 + 1 }
}
```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] {
    return l.map { $0 + 1 }
}
```

func incrList(l: [Int]) -> [Int] {
    return l.map { $0 + 1 }
}
```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] {
    return l.map { $0 + 1 }
}
```

func incrList(l: [Int]) -> [Int] {
    return l.map { $0 + 1 }
}
```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] {
    return l.map { $0 + 1 }
}
```

func incrList(l: [Int]) -> [Int] {
    return l.map { $0 + 1 }
}
```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] {
    return l.map { $0 + 1 }
}
```

func incrList(l: [Int]) -> [Int] {
    return l.map { $0 + 1 }
}
```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] {
    return l.map { $0 + 1 }
}
```

func incrList(l: [Int]) -> [Int] {
    return l.map { $0 + 1 }
}
```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] {
    return l.map { $0 + 1 }
}
```

func incrList(l: [Int]) -> [Int] {
    return l.map { $0 + 1 }
}
```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] {
    return l.map { $0 + 1 }
}
```

func incrList(l: [Int]) -> [Int] {
    return l.map { $0 + 1 }
}
```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] {
    return l.map { $0 + 1 }
}
```

func incrList(l: [Int]) -> [Int] {
    return l.map { $0 + 1 }
}
```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] {
    return l.map { $0 + 1 }
}
```

func incrList(l: [Int]) -> [Int] {
    return l.map { $0 + 1 }
}
```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] {
    return l.map { $0 + 1 }
}
```

func pairsSumToZero(l: [Int]) -> Bool {
    // Write your code here.
}
```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 {
    // Write your code here.
}
```
} // missing return in global function expected to return 'Bool'

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

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

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

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

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

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

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

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

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

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

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

func changeBase(x: Int, base: Int) -> String {
    return String(x, radix: base)
}
```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 {
    return String(x, radix: base)
}
```

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

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

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

func changeBase(x: Int, base: Int) -> String {
    var result = ""
    var num = x
    while num > 0 {
        result = "\(num % base)" + result
        num /= 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 num = x
    while num > 0 {
        result = "\(num % base)" + result
        num /= base
    }
    return result
}
```

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let mid = sorted.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.count / 2
    return Double(sorted[mid])
}
```
 // XCTAssertTrue failed

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let mid = sorted.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.count / 2
    return Double(sorted[mid])
}
```
 // XCTAssertTrue failed

func median(l: [Int]) -> Double {
    let sorted = l.sorted()
    let mid = sorted.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.count / 2
    return Double(sorted[mid])
}
```
 // XCTAssertTrue failed

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

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

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

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

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

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

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

func isPalindrome(text: String) -> Bool {
    // TODO: Implement this function
    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 {
    // TODO: Implement this function
    return true
}
```
 // XCTAssertTrue failed

func isPalindrome(text: String) -> Bool {
    return text.lowercased() == String(text.lowercased().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 {
    return text.lowercased() == String(text.lowercased().reversed())
}
```

func isPalindrome(text: String) -> Bool {
    return text == String(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 {
    return text == String(text.reversed())
}
```

func isPalindrome(text: String) -> Bool {
    // TODO: Implement this function
    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 {
    // TODO: Implement this function
    return true
}
```
 // XCTAssertTrue failed

func isPalindrome(text: String) -> Bool {
    return text == String(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 {
    return text == String(text.reversed())
}
```

func isPalindrome(text: String) -> Bool {
    return text == String(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 {
    return text == String(text.reversed())
}
```

func isPalindrome(text: String) -> Bool {
    return text == String(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 {
    return text == String(text.reversed())
}
```

func isPalindrome(text: String) -> Bool {
    return text == String(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 {
    return text == String(text.reversed())
}
```

func isPalindrome(text: String) -> Bool {
    return text.lowercased() == String(text.lowercased().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 {
    return text.lowercased() == String(text.lowercased().reversed())
}
```

func isPalindrome(text: String) -> Bool {
    return text == String(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 {
    return text == String(text.reversed())
}
```

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

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        p = (p * p) % p
        n /= 2
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        p = (p * p) % p
        n /= 2
    }
    return result
}
```
 // Fatal error: Division by zero in remainder operation

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n /= 2
        p = (p * p) % p
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n /= 2
        p = (p * p) % p
    }
    return result
}
```
 // Fatal error: Division by zero in remainder operation

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if (n & 1) == 1 {
            result = (result * p) % p
        }
        n >>= 1
        p = (p * p) % p
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if (n & 1) == 1 {
            result = (result * p) % p
        }
        n >>= 1
        p = (p * p) % p
    }
    return result
}
```
 // Fatal error: Division by zero in remainder operation

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n /= 2
        p = (p * p) % p
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n /= 2
        p = (p * p) % p
    }
    return result
}
```
 // Fatal error: Division by zero in remainder operation

func modp(n: Int, p: Int) -> Int {
    return n & p
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    return n & p
}
```
 // XCTAssertTrue failed

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n = n / 2
        p = (p * p) % p
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        n = n / 2
        p = (p * p) % p
    }
    return result
}
```
 // Fatal error: Division by zero in remainder operation

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        p = (p * p) % p
        n /= 2
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if n % 2 == 1 {
            result = (result * p) % p
        }
        p = (p * p) % p
        n /= 2
    }
    return result
}
```
 // Fatal error: Division by zero in remainder operation

func modp(n: Int, p: Int) -> Int {
    return n & p
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    return n & p
}
```
 // XCTAssertTrue failed

func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if (n & 1) == 1 {
            result = (result * p) % p
        }
        p = (p * p) % p
        n >>= 1
    }
    return result
}
```swift
// Return 2^n modulo p (be aware of numerics).
// modp(n: 3, p: 5) == 3
// modp(n: 1101, p: 101) == 2
// modp(n: 0, p: 101) == 1
// modp(n: 3, p: 11) == 8
// modp(n: 100, p: 101) == 1
func modp(n: Int, p: Int) -> Int {
    var n = n
    var p = p
    var result = 1
    while n > 0 {
        if (n & 1) == 1 {
            result = (result * p) % p
        }
        p = (p * p) % p
        n >>= 1
    }
    return result
}
```
 // Fatal error: Division by zero in remainder operation

func removeVowels(text: String) -> String {
    let vowels = "aeiou"
    var result = ""
    for char in text {
        if!vowels.contains(char) {
            result += String(char)
        }
    }
    return result
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    let vowels = "aeiou"
    var result = ""
    for char in text {
        if!vowels.contains(char) {
            result += String(char)
        }
    }
    return result
}
```
if!vowels.contains(char) { // expected expression, var, or let in 'if' condition

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

func 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 {
    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" } // 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" } // 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" } // cannot convert value of type '()' to expected argument type 'Bool'
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" } // '=' 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 '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" } // 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 assign through '!': '$0' is immutable
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" } // 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

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

func removeVowels(text: String) -> String {
    let vowels = "aeiouAEIOU"
    var result = ""
    for char in text {
        if!vowels.contains(char) {
            result.append(char)
        }
    }
    return result
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    let vowels = "aeiouAEIOU"
    var result = ""
    for char in text {
        if!vowels.contains(char) {
            result.append(char)
        }
    }
    return result
}
```
if!vowels.contains(char) { // expected expression, var, or let in 'if' condition

func removeVowels(text: String) -> String {
    let vowels = "aeiou"
    var result = ""
    for char in text {
        if!vowels.contains(char) {
            result.append(char)
        }
    }
    return result
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    let vowels = "aeiou"
    var result = ""
    for char in text {
        if!vowels.contains(char) {
            result.append(char)
        }
    }
    return result
}
```
if!vowels.contains(char) { // expected expression, var, or let in 'if' condition

func removeVowels(text: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    var newText = ""
    for char in text {
        if!vowels.contains(String(char)) {
            newText += String(char)
        }
    }
    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 = ["a", "e", "i", "o", "u"]
    var newText = ""
    for char in text {
        if!vowels.contains(String(char)) {
            newText += String(char)
        }
    }
    return newText
}
```
if!vowels.contains(String(char)) { // expected expression, var, or let in 'if' condition

func removeVowels(text: String) -> String {
    let vowels = Set("aeiouAEIOU")
    return text.filter {!vowels.contains($0) }
}
```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 = Set("aeiouAEIOU")
    return text.filter {!vowels.contains($0) }
}
```

func removeVowels(text: String) -> String {
    let vowels = "aeiouAEIOU"
    var result = ""
    for char in text {
        if!vowels.contains(char) {
            result.append(char)
        }
    }
    return result
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    let vowels = "aeiouAEIOU"
    var result = ""
    for char in text {
        if!vowels.contains(char) {
            result.append(char)
        }
    }
    return result
}
```
if!vowels.contains(char) { // expected expression, var, or let in 'if' condition

func removeVowels(text: String) -> String {
    return text.filter {!"aeiou".contains($0) }
}
```swift
// remove_vowels is a function that takes string and returns string without vowels.
// removeVowels(text: "") == ""
// removeVowels(text: "abcdef") == "bcdf"
// removeVowels(text: "aaaaa") == ""
// removeVowels(text: "aaBAA") == "B"
// removeVowels(text: "zbcd") == "zbcd"
func removeVowels(text: String) -> String {
    return text.filter {!"aeiou".contains($0) }
}
```
 // XCTAssertTrue failed

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

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

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

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

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

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

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

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

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

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

func 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 = s0
    var s1 = s1
    s0.sort()
    s1.sort()
    return s0 == s1
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    var s0 = s0
    var s1 = s1
    s0.sort()
    s1.sort()
    return s0 == s1
}
```
s0.sort() // value of type 'String' has no member 'sort'
s1.sort() // value of type 'String' has no member 'sort'

func sameChars(s0: String, s1: String) -> Bool {
    var dict = [Character: Int]()
    for char in s0 {
        dict[char] = (dict[char]?? 0) + 1
    }
    for char in s1 {
        if let count = dict[char] {
            if count == 0 {
                return false
            }
            dict[char] = count - 1
        } else {
            return false
        }
    }
    return true
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    var dict = [Character: Int]()
    for char in s0 {
        dict[char] = (dict[char]?? 0) + 1
    }
    for char in s1 {
        if let count = dict[char] {
            if count == 0 {
                return false
            }
            dict[char] = count - 1
        } else {
            return false
        }
    }
    return true
}
```
dict[char] = (dict[char]?? 0) + 1 // cannot convert value of type '(Int?, Int)' to expected argument type 'Int'
dict[char] = (dict[char]?? 0) + 1 // cannot use optional chaining on non-optional value of type 'Int'
dict[char] = (dict[char]?? 0) + 1 // expected ',' separator

func sameChars(s0: String, s1: String) -> Bool {
    var dict = [Character: Int]()
    for char in s0 {
        dict[char] = (dict[char]?? 0) + 1
    }
    for char in s1 {
        if let count = dict[char] {
            if count == 0 {
                return false
            }
            dict[char] = count - 1
        } else {
            return false
        }
    }
    return true
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    var dict = [Character: Int]()
    for char in s0 {
        dict[char] = (dict[char]?? 0) + 1
    }
    for char in s1 {
        if let count = dict[char] {
            if count == 0 {
                return false
            }
            dict[char] = count - 1
        } else {
            return false
        }
    }
    return true
}
```
dict[char] = (dict[char]?? 0) + 1 // cannot convert value of type '(Int?, Int)' to expected argument type 'Int'
dict[char] = (dict[char]?? 0) + 1 // cannot use optional chaining on non-optional value of type 'Int'
dict[char] = (dict[char]?? 0) + 1 // expected ',' separator

func sameChars(s0: String, s1: String) -> Bool {
    var dict = [Character: Int]()
    for char in s0 {
        dict[char] = (dict[char]?? 0) + 1
    }
    for char in s1 {
        dict[char] = (dict[char]?? 0) - 1
    }
    for (_, value) in dict {
        if value!= 0 {
            return false
        }
    }
    return true
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    var dict = [Character: Int]()
    for char in s0 {
        dict[char] = (dict[char]?? 0) + 1
    }
    for char in s1 {
        dict[char] = (dict[char]?? 0) - 1
    }
    for (_, value) in dict {
        if value!= 0 {
            return false
        }
    }
    return true
}
```
dict[char] = (dict[char]?? 0) + 1 // cannot convert value of type '(Int?, Int)' to expected argument type 'Int'
dict[char] = (dict[char]?? 0) + 1 // cannot use optional chaining on non-optional value of type 'Int'
dict[char] = (dict[char]?? 0) + 1 // expected ',' separator
dict[char] = (dict[char]?? 0) - 1 // expected ',' separator
dict[char] = (dict[char]?? 0) - 1 // cannot convert value of type '(Int?, Int)' to expected argument type 'Int'
dict[char] = (dict[char]?? 0) - 1 // cannot use optional chaining on non-optional value of type 'Int'
if value!= 0 { // cannot force unwrap value of non-optional type 'Int'
if value!= 0 { // use of '=' in a boolean context, did you mean '=='?
if value!= 0 { // '=' must have consistent whitespace on both sides

func sameChars(s0: String, s1: String) -> Bool {
    return Set(s0).isSubset(of: Set(s1))
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    return Set(s0).isSubset(of: Set(s1))
}
```
 // XCTAssertTrue failed

func sameChars(s0: String, s1: String) -> Bool {
    var dict = [Character: Int]()
    for char in s0 {
        dict[char] = (dict[char]?? 0) + 1
    }
    for char in s1 {
        if let count = dict[char] {
            if count == 0 {
                return false
            } else {
                dict[char] = count - 1
            }
        } else {
            return false
        }
    }
    return true
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    var dict = [Character: Int]()
    for char in s0 {
        dict[char] = (dict[char]?? 0) + 1
    }
    for char in s1 {
        if let count = dict[char] {
            if count == 0 {
                return false
            } else {
                dict[char] = count - 1
            }
        } else {
            return false
        }
    }
    return true
}
```
dict[char] = (dict[char]?? 0) + 1 // cannot convert value of type '(Int?, Int)' to expected argument type 'Int'
dict[char] = (dict[char]?? 0) + 1 // cannot use optional chaining on non-optional value of type 'Int'
dict[char] = (dict[char]?? 0) + 1 // expected ',' separator

func sameChars(s0: String, s1: String) -> Bool {
    return Set(s0).isSubset(of: Set(s1))
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    return Set(s0).isSubset(of: Set(s1))
}
```
 // XCTAssertTrue failed

func sameChars(s0: String, s1: String) -> Bool {
    var s0 = s0
    var s1 = s1
    s0 = s0.lowercased()
    s1 = s1.lowercased()
    var dict = [Character: Int]()
    for char in s0 {
        if let count = dict[char] {
            dict[char] = count + 1
        } else {
            dict[char] = 1
        }
    }
    for char in s1 {
        if let count = dict[char] {
            dict[char] = count - 1
        } else {
            dict[char] = -1
        }
    }
    for (_, value) in dict {
        if value!= 0 {
            return false
        }
    }
    return true
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    var s0 = s0
    var s1 = s1
    s0 = s0.lowercased()
    s1 = s1.lowercased()
    var dict = [Character: Int]()
    for char in s0 {
        if let count = dict[char] {
            dict[char] = count + 1
        } else {
            dict[char] = 1
        }
    }
    for char in s1 {
        if let count = dict[char] {
            dict[char] = count - 1
        } else {
            dict[char] = -1
        }
    }
    for (_, value) in dict {
        if value!= 0 {
            return false
        }
    }
    return true
}
```
if value!= 0 { // use of '=' in a boolean context, did you mean '=='?
if value!= 0 { // '=' must have consistent whitespace on both sides
if value!= 0 { // cannot force unwrap value of non-optional type 'Int'

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 {
    // Write your code here.
    var dict = [Character: Int]()
    for char in s0 {
        if let count = dict[char] {
            dict[char] = count + 1
        } else {
            dict[char] = 1
        }
    }
    for char in s1 {
        if let count = dict[char] {
            if count == 0 {
                return false
            } else {
                dict[char] = count - 1
            }
        } else {
            return false
        }
    }
    return true
}
```swift
// Check if two words have the same characters.
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddeddabc") == true
// sameChars(s0: "abcd", s1: "dddddddabc") == true
// sameChars(s0: "dddddddabc", s1: "abcd") == true
// sameChars(s0: "eabcd", s1: "dddddddabc") == false
// sameChars(s0: "abcd", s1: "dddddddabce") == false
// sameChars(s0: "eabcdzzzz", s1: "dddzzzzzzzddddabc") == false
func sameChars(s0: String, s1: String) -> Bool {
    // Write your code here.
    var dict = [Character: Int]()
    for char in s0 {
        if let count = dict[char] {
            dict[char] = count + 1
        } else {
            dict[char] = 1
        }
    }
    for char in s1 {
        if let count = dict[char] {
            if count == 0 {
                return false
            } else {
                dict[char] = count - 1
            }
        } else {
            return false
        }
    }
    return true
}
```
 // XCTAssertTrue failed

func fib(n: Int) -> Int {
    // Write your code here.
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    // Write your code here.
}
```
} // missing return in global function expected to return 'Int'

func fib(n: Int) -> Int {
    // Write your code here
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func fib(n: Int) -> Int {
    // Write your code here
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func fib(n: Int) -> Int {
    guard n > 1 else { return n }
    return fib(n: n - 1) + fib(n: n - 2)
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    guard n > 1 else { return n }
    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 fib(n: Int) -> Int {
    var a = 0
    var b = 1
    for _ in 1..<n {
        let c = a + b
        a = b
        b = c
    }
    return b
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    var a = 0
    var b = 1
    for _ in 1..<n {
        let c = a + b
        a = b
        b = c
    }
    return b
}
```

func fib(n: Int) -> Int {
    var a = 0
    var b = 1
    for _ in 1..<n {
        let c = a + b
        a = b
        b = c
    }
    return b
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    var a = 0
    var b = 1
    for _ in 1..<n {
        let c = a + b
        a = b
        b = c
    }
    return b
}
```

func fib(n: Int) -> Int {
    guard n > 1 else { return n }
    var a = 1
    var b = 1
    for _ in 2..<n {
        let c = a + b
        a = b
        b = c
    }
    return b
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    guard n > 1 else { return n }
    var a = 1
    var b = 1
    for _ in 2..<n {
        let c = a + b
        a = b
        b = c
    }
    return b
}
```

func fib(n: Int) -> Int {
    var a = 0
    var b = 1
    for _ in 1..<n {
        let c = a + b
        a = b
        b = c
    }
    return b
}
```swift
// Return n-th Fibonacci number.
// fib(n: 10) == 55
// fib(n: 1) == 1
// fib(n: 8) == 21
func fib(n: Int) -> Int {
    var a = 0
    var b = 1
    for _ in 1..<n {
        let c = a + b
        a = b
        b = c
    }
    return b
}
```

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

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

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

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

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

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

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

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

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

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

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

func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    let isMonotonic = l.reduce(true) { (result, element) in
        return result && (element >= l.first! || element <= l.first!)
    }
    return isMonotonic
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    let isMonotonic = l.reduce(true) { (result, element) in
        return result && (element >= l.first! || element <= l.first!)
    }
    return isMonotonic
}
```
 // XCTAssertTrue failed

func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var direction: Int?
    for i in 1..<l.count {
        if direction == nil {
            direction = l[i] - l[i - 1]
        } else if direction!= l[i] - l[i - 1] {
            return false
        }
    }
    return true
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var direction: Int?
    for i in 1..<l.count {
        if direction == nil {
            direction = l[i] - l[i - 1]
        } else if direction!= l[i] - l[i - 1] {
            return false
        }
    }
    return true
}
```
} else if direction!= l[i] - l[i - 1] { // use of '=' in a boolean context, did you mean '=='?
} else if direction!= l[i] - l[i - 1] { // '=' must have consistent whitespace on both sides

func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var prev = l[0]
    for i in 1..<l.count {
        if l[i] == prev { continue }
        if l[i] > prev {
            for j in i..<l.count {
                if l[j] < prev { return false }
            }
        } else {
            for j in i..<l.count {
                if l[j] > prev { return false }
            }
        }
        prev = l[i]
    }
    return true
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    guard l.count > 1 else { return true }
    var prev = l[0]
    for i in 1..<l.count {
        if l[i] == prev { continue }
        if l[i] > prev {
            for j in i..<l.count {
                if l[j] < prev { return false }
            }
        } else {
            for j in i..<l.count {
                if l[j] > prev { return false }
            }
        }
        prev = l[i]
    }
    return true
}
```
 // XCTAssertTrue failed

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

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

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

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

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

func monotonic(l: [Int]) -> Bool {
    if l.count < 2 {
        return true
    }
    var prev = l[0]
    var isDecreasing = false
    var isIncreasing = false
    for i in 1..<l.count {
        if l[i] < prev {
            isDecreasing = true
        } else if l[i] > prev {
            isIncreasing = true
        }
        if isDecreasing && isIncreasing {
            return false
        }
        prev = l[i]
    }
    return true
}
```swift
// Return true is array elements are monotonically increasing or decreasing.
// monotonic(l: [1, 2, 4, 20]) == true
// monotonic(l: [1, 20, 4, 10]) == false
// monotonic(l: [4, 1, 0, -10]) == true
func monotonic(l: [Int]) -> Bool {
    if l.count < 2 {
        return true
    }
    var prev = l[0]
    var isDecreasing = false
    var isIncreasing = false
    for i in 1..<l.count {
        if l[i] < prev {
            isDecreasing = true
        } else if l[i] > prev {
            isIncreasing = true
        }
        if isDecreasing && isIncreasing {
            return false
        }
        prev = l[i]
    }
    return true
}
```

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

func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    while!l1.isEmpty &&!l2.isEmpty {
        let l1First = l1.first!
        let l2First = l2.first!
        if l1First == l2First {
            result.append(l1First)
            l1.removeFirst()
            l2.removeFirst()
        } else if l1First < l2First {
            l1.removeFirst()
        } else {
            l2.removeFirst()
        }
    }
    return result
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    while!l1.isEmpty &&!l2.isEmpty {
        let l1First = l1.first!
        let l2First = l2.first!
        if l1First == l2First {
            result.append(l1First)
            l1.removeFirst()
            l2.removeFirst()
        } else if l1First < l2First {
            l1.removeFirst()
        } else {
            l2.removeFirst()
        }
    }
    return result
}
```
while!l1.isEmpty &&!l2.isEmpty { // expected expression, var, or let in 'while' condition

func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    while!l1.isEmpty &&!l2.isEmpty {
        let l1First = l1.first!
        let l2First = l2.first!
        if l1First == l2First {
            result.append(l1First)
            l1.removeFirst()
            l2.removeFirst()
        } else if l1First < l2First {
            l1.removeFirst()
        } else {
            l2.removeFirst()
        }
    }
    return result
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    var l1 = l1
    var l2 = l2
    l1.sort()
    l2.sort()
    while!l1.isEmpty &&!l2.isEmpty {
        let l1First = l1.first!
        let l2First = l2.first!
        if l1First == l2First {
            result.append(l1First)
            l1.removeFirst()
            l2.removeFirst()
        } else if l1First < l2First {
            l1.removeFirst()
        } else {
            l2.removeFirst()
        }
    }
    return result
}
```
while!l1.isEmpty &&!l2.isEmpty { // expected expression, var, or let in 'while' condition

func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    var l1 = l1
    var l2 = l2
    while!l1.isEmpty &&!l2.isEmpty {
        if l1.first! == l2.first! {
            result.append(l1.removeFirst())
            l2.removeFirst()
        } else if l1.first! < l2.first! {
            l1.removeFirst()
        } else {
            l2.removeFirst()
        }
    }
    return result
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    var l1 = l1
    var l2 = l2
    while!l1.isEmpty &&!l2.isEmpty {
        if l1.first! == l2.first! {
            result.append(l1.removeFirst())
            l2.removeFirst()
        } else if l1.first! < l2.first! {
            l1.removeFirst()
        } else {
            l2.removeFirst()
        }
    }
    return result
}
```
while!l1.isEmpty &&!l2.isEmpty { // expected expression, var, or let in 'while' condition

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

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

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

func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    var l1 = l1
    var l2 = l2
    while!l1.isEmpty &&!l2.isEmpty {
        if l1[0] == l2[0] {
            result.append(l1[0])
            l1.removeFirst()
            l2.removeFirst()
        } else if l1[0] < l2[0] {
            l1.removeFirst()
        } else {
            l2.removeFirst()
        }
    }
    return result
}
```swift
// Return sorted unique common elements for two arrays.
// common(l1: [1, 4, 3, 34, 653, 2, 5], l2: [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
// common(l1: [5, 3, 2, 8], l2: [3, 2]) == [2, 3]
func common(l1: [Int], l2: [Int]) -> [Int] {
    var result = [Int]()
    var l1 = l1
    var l2 = l2
    while!l1.isEmpty &&!l2.isEmpty {
        if l1[0] == l2[0] {
            result.append(l1[0])
            l1.removeFirst()
            l2.removeFirst()
        } else if l1[0] < l2[0] {
            l1.removeFirst()
        } else {
            l2.removeFirst()
        }
    }
    return result
}
```
while!l1.isEmpty &&!l2.isEmpty { // expected expression, var, or let in 'while' condition

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

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

func common(l1: [Int], l2: [Int]) -> [Int] {
    return l1.filter { l2.contains($0) }
}
```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] {
    return l1.filter { l2.contains($0) }
}
```
 // XCTAssertTrue failed

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largestPrimeFactor = 1
    while n % 2 == 0 {
        largestPrimeFactor = 2
        n /= 2
    }
    for i in 3..<Int(sqrt(Double(n)))+1, 2 {
        while n % i == 0 {
            largestPrimeFactor = i
            n /= i
        }
    }
    if n > 2 {
        largestPrimeFactor = n
    }
    return largestPrimeFactor
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largestPrimeFactor = 1
    while n % 2 == 0 {
        largestPrimeFactor = 2
        n /= 2
    }
    for i in 3..<Int(sqrt(Double(n)))+1, 2 {
        while n % i == 0 {
            largestPrimeFactor = i
            n /= i
        }
    }
    if n > 2 {
        largestPrimeFactor = n
    }
    return largestPrimeFactor
}
```
for i in 3..<Int(sqrt(Double(n)))+1, 2 { // expected '{' to start the body of for-each loop

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

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

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

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

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var i = 2
    while i * i <= n {
        while n % i == 0 {
            n /= i
        }
        i += 1
    }
    return n
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var i = 2
    while i * i <= n {
        while n % i == 0 {
            n /= i
        }
        i += 1
    }
    return n
}
```
 // XCTAssertTrue failed

func largestPrimeFactor(n: Int) -> Int {
    var num = n
    var largestPrime = 0
    for i in 2...Int(sqrt(Double(num))) {
        while num % i == 0 {
            largestPrime = i
            num /= i
        }
    }
    return largestPrime
}
```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 num = n
    var largestPrime = 0
    for i in 2...Int(sqrt(Double(num))) {
        while num % i == 0 {
            largestPrime = i
            num /= i
        }
    }
    return largestPrime
}
```
 // XCTAssertTrue failed

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

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largestPrimeFactor = 1
    while n % 2 == 0 {
        largestPrimeFactor = 2
        n /= 2
    }
    for i in 3..<Int(sqrt(Double(n)))+1 {
        while n % i == 0 {
            largestPrimeFactor = i
            n /= i
        }
    }
    if n > 1 {
        largestPrimeFactor = n
    }
    return largestPrimeFactor
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largestPrimeFactor = 1
    while n % 2 == 0 {
        largestPrimeFactor = 2
        n /= 2
    }
    for i in 3..<Int(sqrt(Double(n)))+1 {
        while n % i == 0 {
            largestPrimeFactor = i
            n /= i
        }
    }
    if n > 1 {
        largestPrimeFactor = n
    }
    return largestPrimeFactor
}
```

func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largestPrimeFactor = 1
    for i in 2...Int(sqrt(Double(n))) {
        while n % i == 0 {
            n /= i
            largestPrimeFactor = i
        }
    }
    if n > 1 {
        largestPrimeFactor = n
    }
    return largestPrimeFactor
}
```swift
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
// largestPrimeFactor(n: 13195) == 29
// largestPrimeFactor(n: 2048) == 2
func largestPrimeFactor(n: Int) -> Int {
    var n = n
    var largestPrimeFactor = 1
    for i in 2...Int(sqrt(Double(n))) {
        while n % i == 0 {
            n /= i
            largestPrimeFactor = i
        }
    }
    if n > 1 {
        largestPrimeFactor = n
    }
    return largestPrimeFactor
}
```

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

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

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 {
    // Write your code here.
    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 {
    // Write your code here.
    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 {
    return (1...n).reduce(0, +)
}
```swift
// sum_to_n is a function that sums numbers from 1 to n.
// sumToN(n: 30) == 465
// sumToN(n: 100) == 5050
// sumToN(n: 5) == 15
// sumToN(n: 10) == 55
// sumToN(n: 1) == 1
func sumToN(n: Int) -> Int {
    return (1...n).reduce(0, +)
}
```

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

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

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

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```

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

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

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

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

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

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// brackets is a string of "(" and ")".
// return true if every opening bracket has a corresponding closing bracket.
// correctBracketing(brackets: "(") == false
// correctBracketing(brackets: "()") == true
// correctBracketing(brackets: "(()())") == true
// correctBracketing(brackets: ")(()") == false
func correctBracketing(brackets: String) -> Bool {
    var stack = [Character]()
    for char in brackets {
        if char == "(" {
            stack.append(char)
        } else if char == ")" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```

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

func derivative(xs: [Int]) -> [Int] {
    return xs.dropFirst().enumerated().map { index, x in
        return index + 1 * x
    }
}
```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] {
    return xs.dropFirst().enumerated().map { index, x in
        return index + 1 * x
    }
}
```
 // XCTAssertTrue failed

func derivative(xs: [Int]) -> [Int] {
    // TODO: Implement this function.
    return []
}
```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] {
    // TODO: Implement this function.
    return []
}
```
 // XCTAssertTrue failed

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

func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(i * xs[i])
    }
    return result
}
```swift
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 +....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(i * xs[i])
    }
    return result
}
```

func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<xs.count {
        if i == 0 {
            result.append(0)
        } else {
            result.append(i * xs[i])
        }
    }
    return result
}
```swift
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 +....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 0..<xs.count {
        if i == 0 {
            result.append(0)
        } else {
            result.append(i * xs[i])
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func derivative(xs: [Int]) -> [Int] {
    // TODO: Implement this function.
    return []
}
```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] {
    // TODO: Implement this function.
    return []
}
```
 // XCTAssertTrue failed

func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(i * xs[i])
    }
    return result
}
```swift
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 +....
// Return derivative of this polynomial in the same form.
// derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20]
// derivative(xs: [1, 2, 3]) == [2, 6]
func derivative(xs: [Int]) -> [Int] {
    var result = [Int]()
    for i in 1..<xs.count {
        result.append(i * xs[i])
    }
    return result
}
```

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

func derivative(xs: [Int]) -> [Int] {
    return xs.dropFirst().enumerated().map {
        $0.element * $0.offset
    }
}
```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] {
    return xs.dropFirst().enumerated().map {
        $0.element * $0.offset
    }
}
```
 // XCTAssertTrue failed

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

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

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

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

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

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

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

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

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

func fibfib(n: Int) -> Int {
    var a = 0
    var b = 0
    var c = 1
    for _ in 1...n {
        let temp = a + b + c
        a = b
        b = c
        c = temp
    }
    return a
}
```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 a = 0
    var b = 0
    var c = 1
    for _ in 1...n {
        let temp = a + b + c
        a = b
        b = c
        c = temp
    }
    return a
}
```

func vowelsCount(s: String) -> Int {
    return s.filter { "aeiou".contains($0) }.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 {
    return s.filter { "aeiou".contains($0) }.count
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    // Write your code here
}
```swift
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it is at the end of the given word.
// Example:
// vowelsCount(s: "abcde") == 2
// vowelsCount(s: "ACEDY") == 3
func vowelsCount(s: String) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func vowelsCount(s: String) -> Int {
    return s.filter { $0 == "a" || $0 == "e" || $0 == "i" || $0 == "o" || $0 == "u" }.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 {
    return s.filter { $0 == "a" || $0 == "e" || $0 == "i" || $0 == "o" || $0 == "u" }.count
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    return s.filter { $0 == "a" || $0 == "e" || $0 == "i" || $0 == "o" || $0 == "u" }.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 {
    return s.filter { $0 == "a" || $0 == "e" || $0 == "i" || $0 == "o" || $0 == "u" }.count
}
```
 // XCTAssertTrue failed

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

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

func vowelsCount(s: String) -> Int {
    var vowels = 0
    for char in s {
        if "aeiou".contains(char) {
            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 char in s {
        if "aeiou".contains(char) {
            vowels += 1
        }
    }
    return vowels
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    return s.filter { $0 == "a" || $0 == "e" || $0 == "i" || $0 == "o" || $0 == "u" }.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 {
    return s.filter { $0 == "a" || $0 == "e" || $0 == "i" || $0 == "o" || $0 == "u" }.count
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    return s.filter { $0 == "a" || $0 == "e" || $0 == "i" || $0 == "o" || $0 == "u" }.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 {
    return s.filter { $0 == "a" || $0 == "e" || $0 == "i" || $0 == "o" || $0 == "u" }.count
}
```
 // XCTAssertTrue failed

func vowelsCount(s: String) -> Int {
    // Write your code here
    var count = 0
    let vowels = ["a", "e", "i", "o", "u"]
    for char in s {
        if vowels.contains(String(char)) {
            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 {
    // Write your code here
    var count = 0
    let vowels = ["a", "e", "i", "o", "u"]
    for char in s {
        if vowels.contains(String(char)) {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    return String(shifted.map { $0 % 10 })
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    return String(shifted.map { $0 % 10 })
}
```
return String(shifted.map { $0 % 10 }) // no exact matches in call to initializer

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    let result = shifted.map { $0 % 10 }
    return String(result.reversed())
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    let result = shifted.map { $0 % 10 }
    return String(result.reversed())
}
```
return String(result.reversed()) // no exact matches in call to initializer

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shift = shift % digits.count
    let shifted = digits.suffix(digits.count - shift) + digits.prefix(shift)
    return String(shifted.reversed())
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shift = shift % digits.count
    let shifted = digits.suffix(digits.count - shift) + digits.prefix(shift)
    return String(shifted.reversed())
}
```
return String(shifted.reversed()) // no exact matches in call to initializer

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    let shiftedDigits = shifted.map { $0 % 10 }
    let reversed = shiftedDigits.reversed()
    return String(reversed)
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    let shiftedDigits = shifted.map { $0 % 10 }
    let reversed = shiftedDigits.reversed()
    return String(reversed)
}
```
return String(reversed) // no exact matches in call to initializer

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    let shiftedDigits = shifted.map { $0 % 10 }
    let reversed = shiftedDigits.reversed()
    return String(reversed)
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    let shiftedDigits = shifted.map { $0 % 10 }
    let reversed = shiftedDigits.reversed()
    return String(reversed)
}
```
return String(reversed) // no exact matches in call to initializer

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shift = shift % digits.count
    let shifted = digits.suffix(digits.count - shift) + digits.prefix(shift)
    return String(shifted.reversed())
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shift = shift % digits.count
    let shifted = digits.suffix(digits.count - shift) + digits.prefix(shift)
    return String(shifted.reversed())
}
```
return String(shifted.reversed()) // no exact matches in call to initializer

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    let shiftedDigits = shifted.map { $0 % 10 }
    return String(shiftedDigits.reversed())
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    let shiftedDigits = shifted.map { $0 % 10 }
    return String(shiftedDigits.reversed())
}
```
return String(shiftedDigits.reversed()) // no exact matches in call to initializer

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    let shiftedDigits = shifted.map { $0 % 10 }
    return String(shiftedDigits.reversed())
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    let shiftedDigits = shifted.map { $0 % 10 }
    return String(shiftedDigits.reversed())
}
```
return String(shiftedDigits.reversed()) // no exact matches in call to initializer

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    return String(shifted.map { $0 % 10 })
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shifted = digits.map { $0 + shift }
    return String(shifted.map { $0 % 10 })
}
```
return String(shifted.map { $0 % 10 }) // no exact matches in call to initializer

func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shift = shift % digits.count
    return String(digits[digits.count - shift..<digits.count] + digits[0..<digits.count - shift])
}
```swift
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
// circularShift(x: 12, shift: 1) == "21"
// circularShift(x: 12, shift: 2) == "12"
func circularShift(x: Int, shift: Int) -> String {
    let digits = String(x).map { Int(String($0))! }
    let shift = shift % digits.count
    return String(digits[digits.count - shift..<digits.count] + digits[0..<digits.count - shift])
}
```

func digitSum(s: String) -> Int {
    var sum = 0
    for char in s.uppercased() {
        sum += Int(char.asciiValue!)
    }
    return sum
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    var sum = 0
    for char in s.uppercased() {
        sum += Int(char.asciiValue!)
    }
    return sum
}
```
 // XCTAssertTrue failed

func digitSum(s: String) -> Int {
    return s.uppercased().filter { $0.isUppercase }.reduce(0, { $0 + Int($0.asciiValue!)! })
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    return s.uppercased().filter { $0.isUppercase }.reduce(0, { $0 + Int($0.asciiValue!)! })
}
```
return s.uppercased().filter { $0.isUppercase }.reduce(0, { $0 + Int($0.asciiValue!)! }) // contextual closure type '(Int, String.Element) throws -> Int' (aka '(Int, Character) throws -> Int') expects 2 arguments, but 1 was used in closure body
return s.uppercased().filter { $0.isUppercase }.reduce(0, { $0 + Int($0.asciiValue!)! }) // value of type 'Int' has no member 'asciiValue'

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

func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(String(char).unicodeScalars.first!.value)
        }
    }
    return sum
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(String(char).unicodeScalars.first!.value)
        }
    }
    return sum
}
```

func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(String(char).unicodeScalars.first!.value)
        }
    }
    return sum
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(String(char).unicodeScalars.first!.value)
        }
    }
    return sum
}
```

func digitSum(s: String) -> Int {
    let sum = s.uppercased().filter { $0.isUppercase }.reduce(0) { $0 + Int(String($1).unicodeScalars.first!.value) }
    return sum
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    let sum = s.uppercased().filter { $0.isUppercase }.reduce(0) { $0 + Int(String($1).unicodeScalars.first!.value) }
    return sum
}
```
 // XCTAssertTrue failed

func digitSum(s: String) -> Int {
    return s.uppercased().filter { $0.isUppercase }.reduce(0, { $0 + Int(String($1).unicodeScalars.first!.value) })
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    return s.uppercased().filter { $0.isUppercase }.reduce(0, { $0 + Int(String($1).unicodeScalars.first!.value) })
}
```
 // XCTAssertTrue failed

func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(String(char).unicodeScalars.first!.value)
        }
    }
    return sum
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(String(char).unicodeScalars.first!.value)
        }
    }
    return sum
}
```

func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(String(char).unicodeScalars.first!.value)
        }
    }
    return sum
}
```swift
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
// digitSum(s: "") == 0
// digitSum(s: "abAB") == 131
// digitSum(s: "abcCd") == 67
// digitSum(s: "helloE") == 69
// digitSum(s: "woArBld") == 131
// digitSum(s: "aAaaaXa") == 153
func digitSum(s: String) -> Int {
    var sum = 0
    for char in s {
        if char.isUppercase {
            sum += Int(String(char).unicodeScalars.first!.value)
        }
    }
    return sum
}
```

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

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " apples and ").last?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    let total = applesCount + orangesCount
    let mangoCount = total - n
    return mangoCount
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " apples and ").last?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    let total = applesCount + orangesCount
    let mangoCount = total - n
    return mangoCount
}
```
let apples = s.components(separatedBy: " apples and ").first?? "" // string literal is unused
let apples = s.components(separatedBy: " apples and ").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let apples = s.components(separatedBy: " apples and ").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " apples and ").last?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " apples and ").last?? "" // string literal is unused
let oranges = s.components(separatedBy: " apples and ").last?? "" // cannot use optional chaining on non-optional value of type 'String'
let applesCount = Int(apples)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let applesCount = Int(apples)?? 0 // consecutive statements on a line must be separated by ';'
let applesCount = Int(apples)?? 0 // integer literal is unused
let orangesCount = Int(oranges)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let orangesCount = Int(oranges)?? 0 // consecutive statements on a line must be separated by ';'
let orangesCount = Int(oranges)?? 0 // integer literal is unused

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    return applesCount + orangesCount
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    return applesCount + orangesCount
}
```
let apples = s.components(separatedBy: " apples and ").first?? "" // string literal is unused
let apples = s.components(separatedBy: " apples and ").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let apples = s.components(separatedBy: " apples and ").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let oranges = s.components(separatedBy: " oranges").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // string literal is unused
let applesCount = Int(apples)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let applesCount = Int(apples)?? 0 // consecutive statements on a line must be separated by ';'
let applesCount = Int(apples)?? 0 // integer literal is unused
let orangesCount = Int(oranges)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let orangesCount = Int(oranges)?? 0 // consecutive statements on a line must be separated by ';'
let orangesCount = Int(oranges)?? 0 // integer literal is unused
return applesCount + orangesCount // cannot convert return expression of type 'String' to return type 'Int'

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    return applesCount + orangesCount
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    return applesCount + orangesCount
}
```
let apples = s.components(separatedBy: " apples and ").first?? "" // string literal is unused
let apples = s.components(separatedBy: " apples and ").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let apples = s.components(separatedBy: " apples and ").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let oranges = s.components(separatedBy: " oranges").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // string literal is unused
let applesCount = Int(apples)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let applesCount = Int(apples)?? 0 // consecutive statements on a line must be separated by ';'
let applesCount = Int(apples)?? 0 // integer literal is unused
let orangesCount = Int(oranges)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let orangesCount = Int(oranges)?? 0 // consecutive statements on a line must be separated by ';'
let orangesCount = Int(oranges)?? 0 // integer literal is unused
return applesCount + orangesCount // cannot convert return expression of type 'String' to return type 'Int'

func fruitDistribution(s: String, n: Int) -> Int {
    let fruits = s.components(separatedBy: " and ")
    let apples = Int(fruits[0])?? 0
    let oranges = Int(fruits[1])?? 0
    let mangoes = n - apples - oranges
    return mangoes
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let fruits = s.components(separatedBy: " and ")
    let apples = Int(fruits[0])?? 0
    let oranges = Int(fruits[1])?? 0
    let mangoes = n - apples - oranges
    return mangoes
}
```
let apples = Int(fruits[0])?? 0 // integer literal is unused
let apples = Int(fruits[0])?? 0 // consecutive statements on a line must be separated by ';'
let apples = Int(fruits[0])?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let oranges = Int(fruits[1])?? 0 // consecutive statements on a line must be separated by ';'
let oranges = Int(fruits[1])?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let oranges = Int(fruits[1])?? 0 // integer literal is unused

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    return applesCount + orangesCount
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    return applesCount + orangesCount
}
```
let apples = s.components(separatedBy: " apples and ").first?? "" // string literal is unused
let apples = s.components(separatedBy: " apples and ").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let apples = s.components(separatedBy: " apples and ").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let oranges = s.components(separatedBy: " oranges").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // string literal is unused
let applesCount = Int(apples)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let applesCount = Int(apples)?? 0 // consecutive statements on a line must be separated by ';'
let applesCount = Int(apples)?? 0 // integer literal is unused
let orangesCount = Int(oranges)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let orangesCount = Int(oranges)?? 0 // consecutive statements on a line must be separated by ';'
let orangesCount = Int(oranges)?? 0 // integer literal is unused
return applesCount + orangesCount // cannot convert return expression of type 'String' to return type 'Int'

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    return applesCount + orangesCount
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    return applesCount + orangesCount
}
```
let apples = s.components(separatedBy: " apples and ").first?? "" // string literal is unused
let apples = s.components(separatedBy: " apples and ").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let apples = s.components(separatedBy: " apples and ").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let oranges = s.components(separatedBy: " oranges").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // string literal is unused
let applesCount = Int(apples)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let applesCount = Int(apples)?? 0 // consecutive statements on a line must be separated by ';'
let applesCount = Int(apples)?? 0 // integer literal is unused
let orangesCount = Int(oranges)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let orangesCount = Int(oranges)?? 0 // consecutive statements on a line must be separated by ';'
let orangesCount = Int(oranges)?? 0 // integer literal is unused
return applesCount + orangesCount // cannot convert return expression of type 'String' to return type 'Int'

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    return applesCount + orangesCount
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    return applesCount + orangesCount
}
```
let apples = s.components(separatedBy: " apples and ").first?? "" // string literal is unused
let apples = s.components(separatedBy: " apples and ").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let apples = s.components(separatedBy: " apples and ").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let oranges = s.components(separatedBy: " oranges").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // string literal is unused
let applesCount = Int(apples)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let applesCount = Int(apples)?? 0 // consecutive statements on a line must be separated by ';'
let applesCount = Int(apples)?? 0 // integer literal is unused
let orangesCount = Int(oranges)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let orangesCount = Int(oranges)?? 0 // consecutive statements on a line must be separated by ';'
let orangesCount = Int(oranges)?? 0 // integer literal is unused
return applesCount + orangesCount // cannot convert return expression of type 'String' to return type 'Int'

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    let mangoCount = applesCount + orangesCount
    return mangoCount > n? mangoCount - n : 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 {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    let mangoCount = applesCount + orangesCount
    return mangoCount > n? mangoCount - n : 0
}
```
let apples = s.components(separatedBy: " apples and ").first?? "" // string literal is unused
let apples = s.components(separatedBy: " apples and ").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let apples = s.components(separatedBy: " apples and ").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let oranges = s.components(separatedBy: " oranges").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // string literal is unused
let applesCount = Int(apples)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let applesCount = Int(apples)?? 0 // consecutive statements on a line must be separated by ';'
let applesCount = Int(apples)?? 0 // integer literal is unused
let orangesCount = Int(oranges)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let orangesCount = Int(oranges)?? 0 // consecutive statements on a line must be separated by ';'
let orangesCount = Int(oranges)?? 0 // integer literal is unused
return mangoCount > n? mangoCount - n : 0 // expected expression
return mangoCount > n? mangoCount - n : 0 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return mangoCount > n? mangoCount - n : 0 // consecutive statements on a line must be separated by ';'
return mangoCount > n? mangoCount - n : 0 // cannot convert return expression of type 'Bool' to return type 'Int'
return mangoCount > n? mangoCount - n : 0 // cannot use optional chaining on non-optional value of type 'Int'
return mangoCount > n? mangoCount - n : 0 // consecutive statements on a line must be separated by ';'

func fruitDistribution(s: String, n: Int) -> Int {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    let totalCount = applesCount + orangesCount
    return totalCount > n? totalCount - n : 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 {
    let apples = s.components(separatedBy: " apples and ").first?? ""
    let oranges = s.components(separatedBy: " oranges").first?? ""
    let applesCount = Int(apples)?? 0
    let orangesCount = Int(oranges)?? 0
    let totalCount = applesCount + orangesCount
    return totalCount > n? totalCount - n : 0
}
```
let apples = s.components(separatedBy: " apples and ").first?? "" // string literal is unused
let apples = s.components(separatedBy: " apples and ").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let apples = s.components(separatedBy: " apples and ").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // cannot use optional chaining on non-optional value of type 'String'
let oranges = s.components(separatedBy: " oranges").first?? "" // consecutive statements on a line must be separated by ';'
let oranges = s.components(separatedBy: " oranges").first?? "" // string literal is unused
let applesCount = Int(apples)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let applesCount = Int(apples)?? 0 // consecutive statements on a line must be separated by ';'
let applesCount = Int(apples)?? 0 // integer literal is unused
let orangesCount = Int(oranges)?? 0 // cannot use optional chaining on non-optional value of type 'Int'
let orangesCount = Int(oranges)?? 0 // consecutive statements on a line must be separated by ';'
let orangesCount = Int(oranges)?? 0 // integer literal is unused
return totalCount > n? totalCount - n : 0 // consecutive statements on a line must be separated by ';'
return totalCount > n? totalCount - n : 0 // expected expression
return totalCount > n? totalCount - n : 0 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return totalCount > n? totalCount - n : 0 // cannot convert return expression of type 'Bool' to return type 'Int'
return totalCount > n? totalCount - n : 0 // consecutive statements on a line must be separated by ';'
return totalCount > n? totalCount - n : 0 // cannot use optional chaining on non-optional value of type 'Int'

func fruitDistribution(s: String, n: Int) -> Int {
    let fruits = s.components(separatedBy: " and ")
    let apples = fruits[0].components(separatedBy: " ").first!
    let oranges = fruits[1].components(separatedBy: " ").first!
    let applesCount = Int(apples)!
    let orangesCount = Int(oranges)!
    let totalFruits = applesCount + orangesCount
    let mangoFruits = totalFruits - n
    return mangoFruits
}
```swift
// In this task, you will be given a string that represents a number of apples and oranges 
// that are distributed in a basket of fruit this basket contains 
// apples, oranges, and mango fruits. Given the string that represents the total number of 
// the oranges and apples and an integer that represent the total number of the fruits 
// in the basket return the number of the mango fruits in the basket.
// for examble:
// fruitDistribution(s: "5 apples and 6 oranges", n: 19) == 8
// fruitDistribution(s: "0 apples and 1 oranges", n: 3) == 2
// fruitDistribution(s: "2 apples and 3 oranges", n: 100) == 95
// fruitDistribution(s: "100 apples and 1 oranges", n: 120) == 19
func fruitDistribution(s: String, n: Int) -> Int {
    let fruits = s.components(separatedBy: " and ")
    let apples = fruits[0].components(separatedBy: " ").first!
    let oranges = fruits[1].components(separatedBy: " ").first!
    let applesCount = Int(apples)!
    let orangesCount = Int(oranges)!
    let totalFruits = applesCount + orangesCount
    let mangoFruits = totalFruits - n
    return mangoFruits
}
```
 // XCTAssertTrue failed

func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min!= Int.max {
        result.append(min)
        result.append(minIndex)
    }
    return result
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min!= Int.max {
        result.append(min)
        result.append(minIndex)
    }
    return result
}
```
if min!= Int.max { // '=' must have consistent whitespace on both sides
if min!= Int.max { // cannot force unwrap value of non-optional type 'Int'
if min!= Int.max { // use of '=' in a boolean context, did you mean '=='?

func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min!= Int.max {
        result.append(min)
        result.append(minIndex)
    }
    return result
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min!= Int.max {
        result.append(min)
        result.append(minIndex)
    }
    return result
}
```
if min!= Int.max { // '=' must have consistent whitespace on both sides
if min!= Int.max { // cannot force unwrap value of non-optional type 'Int'
if min!= Int.max { // use of '=' in a boolean context, did you mean '=='?

func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min!= Int.max {
        result.append(min)
        result.append(minIndex)
    }
    return result
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min!= Int.max {
        result.append(min)
        result.append(minIndex)
    }
    return result
}
```
if min!= Int.max { // '=' must have consistent whitespace on both sides
if min!= Int.max { // cannot force unwrap value of non-optional type 'Int'
if min!= Int.max { // use of '=' in a boolean context, did you mean '=='?

func pluck(arr: [Int]) -> [Int] {
    var result: [Int] = []
    var minValue = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minValue {
            minValue = value
            minIndex = index
        }
    }
    if minValue!= Int.max {
        result = [minValue, minIndex]
    }
    return result
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    var result: [Int] = []
    var minValue = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < minValue {
            minValue = value
            minIndex = index
        }
    }
    if minValue!= Int.max {
        result = [minValue, minIndex]
    }
    return result
}
```
if minValue!= Int.max { // cannot force unwrap value of non-optional type 'Int'
if minValue!= Int.max { // use of '=' in a boolean context, did you mean '=='?
if minValue!= Int.max { // '=' must have consistent whitespace on both sides

func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min!= Int.max {
        result.append(min)
        result.append(minIndex)
    }
    return result
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min!= Int.max {
        result.append(min)
        result.append(minIndex)
    }
    return result
}
```
if min!= Int.max { // '=' must have consistent whitespace on both sides
if min!= Int.max { // cannot force unwrap value of non-optional type 'Int'
if min!= Int.max { // use of '=' in a boolean context, did you mean '=='?

func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min!= Int.max {
        result.append(min)
        result.append(minIndex)
    }
    return result
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min!= Int.max {
        result.append(min)
        result.append(minIndex)
    }
    return result
}
```
if min!= Int.max { // '=' must have consistent whitespace on both sides
if min!= Int.max { // cannot force unwrap value of non-optional type 'Int'
if min!= Int.max { // use of '=' in a boolean context, did you mean '=='?

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

func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min!= Int.max {
        result.append(min)
        result.append(minIndex)
    }
    return result
}
```swift
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes with the same smallest even value are found return the node that has smallest index.
// The plucked node should be returned in an array, [ smalest_value, its index ],
// If there are no even values or the given array is empty, return [].
// Example 1:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 2:
// Explanation: 2 has the smallest even value, and 2 has the smallest index.
// Example 3:
// Example 4:
// Explanation: 0 is the smallest value, but  there are two zeros,
// so we will choose the first zero, which has the smallest index.
// Constraints:
// * 1 <= nodes.length <= 10000
// * 0 <= node.value
// pluck(arr: [4, 2, 3]) == [2, 1]
// pluck(arr: [1, 2, 3]) == [2, 1]
// pluck(arr: [] as [Int]) == [] as [Int]
// pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1]
func pluck(arr: [Int]) -> [Int] {
    var result = [Int]()
    var min = Int.max
    var minIndex = 0
    for (index, value) in arr.enumerated() {
        if value % 2 == 0 && value < min {
            min = value
            minIndex = index
        }
    }
    if min!= Int.max {
        result.append(min)
        result.append(minIndex)
    }
    return result
}
```
if min!= Int.max { // '=' must have consistent whitespace on both sides
if min!= Int.max { // cannot force unwrap value of non-optional type 'Int'
if min!= Int.max { // use of '=' in a boolean context, did you mean '=='?

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

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

func search(lst: [Int]) -> Int {
    var max = -1
    var maxFreq = -1
    var freq = [Int: Int]()
    for num in lst {
        if let count = freq[num] {
            freq[num] = count + 1
        } else {
            freq[num] = 1
        }
        if freq[num] > maxFreq {
            max = num
            maxFreq = freq[num]!
        }
    }
    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 maxFreq = -1
    var freq = [Int: Int]()
    for num in lst {
        if let count = freq[num] {
            freq[num] = count + 1
        } else {
            freq[num] = 1
        }
        if freq[num] > maxFreq {
            max = num
            maxFreq = freq[num]!
        }
    }
    return max
}
```
if freq[num] > maxFreq { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

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

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for i in lst {
        if let count = dict[i] {
            dict[i] = count + 1
        } else {
            dict[i] = 1
        }
    }
    for (key, value) in dict {
        if value >= key {
            return key
        }
    }
    return -1
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for i in lst {
        if let count = dict[i] {
            dict[i] = count + 1
        } else {
            dict[i] = 1
        }
    }
    for (key, value) in dict {
        if value >= key {
            return key
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for i in lst {
        if let count = dict[i] {
            dict[i] = count + 1
        } else {
            dict[i] = 1
        }
    }
    for (key, value) in dict {
        if value >= key {
            return key
        }
    }
    return -1
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for i in lst {
        if let count = dict[i] {
            dict[i] = count + 1
        } else {
            dict[i] = 1
        }
    }
    for (key, value) in dict {
        if value >= key {
            return key
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

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

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        if let count = dict[num] {
            dict[num] = count + 1
        } else {
            dict[num] = 1
        }
    }
    for (key, value) in dict {
        if value >= key {
            return key
        }
    }
    return -1
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        if let count = dict[num] {
            dict[num] = count + 1
        } else {
            dict[num] = 1
        }
    }
    for (key, value) in dict {
        if value >= key {
            return key
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        if let count = dict[num] {
            dict[num] = count + 1
        } else {
            dict[num] = 1
        }
    }
    var maxNum = 0
    var maxCount = 0
    for (num, count) in dict {
        if count >= num && count > maxCount {
            maxNum = num
            maxCount = count
        }
    }
    return maxNum
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        if let count = dict[num] {
            dict[num] = count + 1
        } else {
            dict[num] = 1
        }
    }
    var maxNum = 0
    var maxCount = 0
    for (num, count) in dict {
        if count >= num && count > maxCount {
            maxNum = num
            maxCount = count
        }
    }
    return maxNum
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        if let count = dict[num] {
            dict[num] = count + 1
        } else {
            dict[num] = 1
        }
    }
    for (key, value) in dict {
        if key > 0 && value >= key {
            return key
        }
    }
    return -1
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        if let count = dict[num] {
            dict[num] = count + 1
        } else {
            dict[num] = 1
        }
    }
    for (key, value) in dict {
        if key > 0 && value >= key {
            return key
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        if let count = dict[num] {
            dict[num] = count + 1
        } else {
            dict[num] = 1
        }
    }
    for num in lst {
        if let count = dict[num] {
            if count >= num {
                return num
            }
        }
    }
    return -1
}
```swift
// You are given a non-empty array of positive integers. Return the greatest integer that is greater than 
// zero, and has a frequency greater than or equal to the value of the integer itself. 
// The frequency of an integer is the number of times it appears in the array.
// If no such a value exist, return -1.
// Examples:
// search(lst: [4, 1, 2, 2, 3, 1]) == 2
// search(lst: [1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3
// search(lst: [5, 5, 4, 4, 4]) == -1
func search(lst: [Int]) -> Int {
    var dict = [Int: Int]()
    for num in lst {
        if let count = dict[num] {
            dict[num] = count + 1
        } else {
            dict[num] = 1
        }
    }
    for num in lst {
        if let count = dict[num] {
            if count >= num {
                return num
            }
        }
    }
    return -1
}
```
 // XCTAssertTrue failed

func search(lst: [Int]) -> Int {
    var max = 0
    var maxFreq = 0
    var maxFreqInt = 0
    for i in lst {
        let freq = lst.filter { $0 == i }.count
        if freq > maxFreq {
            max = i
            maxFreq = freq
            maxFreqInt = i
        } else if freq == maxFreq && i > maxFreqInt {
            max = i
            maxFreqInt = 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 = 0
    var maxFreq = 0
    var maxFreqInt = 0
    for i in lst {
        let freq = lst.filter { $0 == i }.count
        if freq > maxFreq {
            max = i
            maxFreq = freq
            maxFreqInt = i
        } else if freq == maxFreq && i > maxFreqInt {
            max = i
            maxFreqInt = i
        }
    }
    return max
}
```
 // XCTAssertTrue failed

func strangeSortList(lst: [Int]) -> [Int] {
    var result = [Int]()
    var min = lst.min()
    var max = lst.max()
    while min!= nil || max!= nil {
        if min!= nil {
            result.append(min!)
            min = lst.min()
        }
        if max!= nil {
            result.append(max!)
            max = lst.max()
        }
    }
    return result
}
```swift
// Given array of integers, return array in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// strangeSortList(lst: [1, 2, 3, 4]) == [1, 4, 2, 3]
// strangeSortList(lst: [5, 5, 5, 5]) == [5, 5, 5, 5]
// strangeSortList(lst: [] as [Int]) == [] as [Int]
func strangeSortList(lst: [Int]) -> [Int] {
    var result = [Int]()
    var min = lst.min()
    var max = lst.max()
    while min!= nil || max!= nil {
        if min!= nil {
            result.append(min!)
            min = lst.min()
        }
        if max!= nil {
            result.append(max!)
            max = lst.max()
        }
    }
    return result
}
```
while min!= nil || max!= nil { // cannot assign value of type '()' to type 'Int'
while min!= nil || max!= nil { // 'nil' is not compatible with expected argument type 'Bool'
while min!= nil || max!= nil { // use of '=' in a boolean context, did you mean '=='?
while min!= nil || max!= nil { // 'nil' cannot be assigned to type 'Bool'
while min!= nil || max!= nil { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
while min!= nil || max!= nil { // '=' must have consistent whitespace on both sides
while min!= nil || max!= nil { // '=' must have consistent whitespace on both sides
if min!= nil { // use of '=' in a boolean context, did you mean '=='?
if min!= nil { // 'nil' cannot be assigned to type 'Int'
if min!= nil { // '=' must have consistent whitespace on both sides
if max!= nil { // '=' must have consistent whitespace on both sides
if max!= nil { // 'nil' cannot be assigned to type 'Int'
if max!= nil { // use of '=' in a boolean context, did you mean '=='?

func strangeSortList(lst: [Int]) -> [Int] {
    var result = [Int]()
    var min = Int.max
    var max = Int.min
    var minIndex = 0
    var maxIndex = 0
    for (index, value) in lst.enumerated() {
        if value < min {
            min = value
            minIndex = index
        }
        if value > max {
            max = value
            maxIndex = index
        }
    }
    result.append(min)
    result.append(max)
    result.append(contentsOf: lst.filter { $0!= min && $0!= 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 = Int.max
    var max = Int.min
    var minIndex = 0
    var maxIndex = 0
    for (index, value) in lst.enumerated() {
        if value < min {
            min = value
            minIndex = index
        }
        if value > max {
            max = value
            maxIndex = index
        }
    }
    result.append(min)
    result.append(max)
    result.append(contentsOf: lst.filter { $0!= min && $0!= max })
    return result
}
```
result.append(contentsOf: lst.filter { $0!= min && $0!= max }) // trailing closure passed to parameter of type 'Predicate<Int>' that does not accept a closure
result.append(contentsOf: lst.filter { $0!= min && $0!= max }) // '=' must have consistent whitespace on both sides
result.append(contentsOf: lst.filter { $0!= min && $0!= max }) // '=' must have consistent whitespace on both sides
result.append(contentsOf: lst.filter { $0!= min && $0!= max }) // type 'Int' cannot be used as a boolean; test for '!= 0' instead

func strangeSortList(lst: [Int]) -> [Int] {
    var result = [Int]()
    var min = lst.min()
    var max = lst.max()
    while min!= nil || max!= nil {
        result.append(min!)
        result.append(max!)
        min = lst.min()
        max = lst.max()
        lst.remove(min!)
        lst.remove(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.min()
    var max = lst.max()
    while min!= nil || max!= nil {
        result.append(min!)
        result.append(max!)
        min = lst.min()
        max = lst.max()
        lst.remove(min!)
        lst.remove(max!)
    }
    return result
}
```
while min!= nil || max!= nil { // cannot assign value of type '()' to type 'Int'
while min!= nil || max!= nil { // 'nil' is not compatible with expected argument type 'Bool'
while min!= nil || max!= nil { // use of '=' in a boolean context, did you mean '=='?
while min!= nil || max!= nil { // 'nil' cannot be assigned to type 'Bool'
while min!= nil || max!= nil { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
while min!= nil || max!= nil { // '=' must have consistent whitespace on both sides
while min!= nil || max!= nil { // '=' must have consistent whitespace on both sides
lst.remove(min!) // no exact matches in call to instance method 'remove'
lst.remove(max!) // no exact matches in call to instance method 'remove'

func strangeSortList(lst: [Int]) -> [Int] {
    var result = [Int]()
    var min = lst.min()
    var max = lst.max()
    while min!= nil || max!= nil {
        if min!= nil {
            result.append(min!)
            min = lst.min()
        }
        if max!= nil {
            result.append(max!)
            max = lst.max()
        }
    }
    return result
}
```swift
// Given array of integers, return array in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
// strangeSortList(lst: [1, 2, 3, 4]) == [1, 4, 2, 3]
// strangeSortList(lst: [5, 5, 5, 5]) == [5, 5, 5, 5]
// strangeSortList(lst: [] as [Int]) == [] as [Int]
func strangeSortList(lst: [Int]) -> [Int] {
    var result = [Int]()
    var min = lst.min()
    var max = lst.max()
    while min!= nil || max!= nil {
        if min!= nil {
            result.append(min!)
            min = lst.min()
        }
        if max!= nil {
            result.append(max!)
            max = lst.max()
        }
    }
    return result
}
```
while min!= nil || max!= nil { // cannot assign value of type '()' to type 'Int'
while min!= nil || max!= nil { // 'nil' is not compatible with expected argument type 'Bool'
while min!= nil || max!= nil { // use of '=' in a boolean context, did you mean '=='?
while min!= nil || max!= nil { // 'nil' cannot be assigned to type 'Bool'
while min!= nil || max!= nil { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
while min!= nil || max!= nil { // '=' must have consistent whitespace on both sides
while min!= nil || max!= nil { // '=' must have consistent whitespace on both sides
if min!= nil { // use of '=' in a boolean context, did you mean '=='?
if min!= nil { // 'nil' cannot be assigned to type 'Int'
if min!= nil { // '=' must have consistent whitespace on both sides
if max!= nil { // '=' must have consistent whitespace on both sides
if max!= nil { // 'nil' cannot be assigned to type 'Int'
if max!= nil { // use of '=' in a boolean context, did you mean '=='?

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

func strangeSortList(lst: [Int]) -> [Int] {
    var result = [Int]()
    var sorted = lst.sorted()
    while sorted.count > 0 {
        result.append(sorted.removeFirst())
        result.append(sorted.removeLast())
    }
    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()
    while sorted.count > 0 {
        result.append(sorted.removeFirst())
        result.append(sorted.removeLast())
    }
    return result
}
```
 // Fatal error: Can't remove last element from an empty collection

func strangeSortList(lst: [Int]) -> [Int] {
    return lst.sorted { $0 < $1 }
}
```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] {
    return lst.sorted { $0 < $1 }
}
```
 // XCTAssertTrue failed

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

func strangeSortList(lst: [Int]) -> [Int] {
    var result = [Int]()
    var sorted = lst.sorted()
    var min = sorted.removeFirst()
    var max = sorted.removeLast()
    result.append(min)
    result.append(max)
    while sorted.count > 0 {
        min = sorted.removeFirst()
        result.append(min)
        max = sorted.removeLast()
        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 sorted = lst.sorted()
    var min = sorted.removeFirst()
    var max = sorted.removeLast()
    result.append(min)
    result.append(max)
    while sorted.count > 0 {
        min = sorted.removeFirst()
        result.append(min)
        max = sorted.removeLast()
        result.append(max)
    }
    return result
}
```
 // Fatal error: Can't remove last element from an empty collection

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

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

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

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

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

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

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```swift
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle. 
// Otherwise return -1
// Three sides make a valid triangle when the sum of any two sides is greater 
// than the third side.
// Example:
// triangleArea(a: 3, b: 4, c: 5) == 6.0
// triangleArea(a: 1, b: 2, c: 10) == -1
func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let s = (a + b + c) / 2
    let area = sqrt(s * (s - a) * (s - b) * (s - c))
    return area
}
```
let area = sqrt(s * (s - a) * (s - b) * (s - c)) // cannot convert value of type 'Int' to expected argument type 'Double'

func triangleArea(a: Int, b: Int, c: Int) -> Double {
    let sides = [a, b, c]
    let sortedSides = sides.sorted()
    let sumOfTwoSides = sortedSides[0] + sortedSides[1]
    if sumOfTwoSides > sortedSides[2] {
        let s = (sortedSides[0] + sortedSides[1] + sortedSides[2]) / 2
        let area = sqrt(s * (s - sortedSides[0]) * (s - sortedSides[1]) * (s - sortedSides[2]))
        return area
    }
    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 {
    let sides = [a, b, c]
    let sortedSides = sides.sorted()
    let sumOfTwoSides = sortedSides[0] + sortedSides[1]
    if sumOfTwoSides > sortedSides[2] {
        let s = (sortedSides[0] + sortedSides[1] + sortedSides[2]) / 2
        let area = sqrt(s * (s - sortedSides[0]) * (s - sortedSides[1]) * (s - sortedSides[2]))
        return area
    }
    return -1
}
```
let area = sqrt(s * (s - sortedSides[0]) * (s - sortedSides[1]) * (s - sortedSides[2])) // cannot convert value of type 'Int' to expected argument type 'Double'

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

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let maxWeight = q.reduce(0, { max($0, $1) })
    return sum <= w && q.reduce(true, { $0 && $1 == $2 })
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let maxWeight = q.reduce(0, { max($0, $1) })
    return sum <= w && q.reduce(true, { $0 && $1 == $2 })
}
```
return sum <= w && q.reduce(true, { $0 && $1 == $2 }) // contextual closure type '(Bool, Int) throws -> Bool' expects 2 arguments, but 3 were used in closure body

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let max = q.reduce(0, { max($0, $1) })
    return sum <= w && q.reduce(true, { $0 && $1 == $2 })
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let max = q.reduce(0, { max($0, $1) })
    return sum <= w && q.reduce(true, { $0 && $1 == $2 })
}
```
let max = q.reduce(0, { max($0, $1) }) // cannot call value of non-function type 'Int'
return sum <= w && q.reduce(true, { $0 && $1 == $2 }) // contextual closure type '(Bool, Int) throws -> Bool' expects 2 arguments, but 3 were used in closure body

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let maxWeight = q.count * w
    return sum <= maxWeight && q.reduce(true, { $0 && $1 == $2 })
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let maxWeight = q.count * w
    return sum <= maxWeight && q.reduce(true, { $0 && $1 == $2 })
}
```
return sum <= maxWeight && q.reduce(true, { $0 && $1 == $2 }) // contextual closure type '(Bool, Int) throws -> Bool' expects 2 arguments, but 3 were used in closure body

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let max = q.reduce(0, { max($0, $1) })
    return sum <= w && q.reduce(true, { $0 && $1 == $2 })
}
```swift
// Write a function that returns true if the object q will fly, and false otherwise.
// The object q will fly if it's balanced (it is a palindromic array) and the sum of its elements is less than or equal the maximum possible weight w.
// Example:
// # 1+2 is less than the maximum possible weight, but it's unbalanced.
// # it's balanced, but 3+2+3 is more than the maximum possible weight.
// # 3+2+3 is less than the maximum possible weight, and it's balanced.
// # 3 is less than the maximum possible weight, and it's balanced.
// willItFly(q: [1, 2], w: 5) == false
// willItFly(q: [3, 2, 3], w: 1) == false
// willItFly(q: [3, 2, 3], w: 9) == true
// willItFly(q: [3], w: 5) == true
func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let max = q.reduce(0, { max($0, $1) })
    return sum <= w && q.reduce(true, { $0 && $1 == $2 })
}
```
let max = q.reduce(0, { max($0, $1) }) // cannot call value of non-function type 'Int'
return sum <= w && q.reduce(true, { $0 && $1 == $2 }) // contextual closure type '(Bool, Int) throws -> Bool' expects 2 arguments, but 3 were used in closure body

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let isBalanced = q.reduce(true) { $0 && $1 == $2 }
    return isBalanced && 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 {
    let sum = q.reduce(0, +)
    let isBalanced = q.reduce(true) { $0 && $1 == $2 }
    return isBalanced && sum <= w
}
```
let isBalanced = q.reduce(true) { $0 && $1 == $2 } // contextual closure type '(Bool, Int) throws -> Bool' expects 2 arguments, but 3 were used in closure body

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

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let isBalanced = q.reduce(true) { $0 && $1 == $2 }
    return isBalanced && 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 {
    let sum = q.reduce(0, +)
    let isBalanced = q.reduce(true) { $0 && $1 == $2 }
    return isBalanced && sum <= w
}
```
let isBalanced = q.reduce(true) { $0 && $1 == $2 } // contextual closure type '(Bool, Int) throws -> Bool' expects 2 arguments, but 3 were used in closure body

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let isBalanced = q.count == q.reduce(0, { $0 == $1? $0 : 0 })
    return isBalanced && 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 {
    let sum = q.reduce(0, +)
    let isBalanced = q.count == q.reduce(0, { $0 == $1? $0 : 0 })
    return isBalanced && sum <= w
}
```
let isBalanced = q.count == q.reduce(0, { $0 == $1? $0 : 0 }) // cannot use optional chaining on non-optional value of type 'Int'
let isBalanced = q.count == q.reduce(0, { $0 == $1? $0 : 0 }) // consecutive statements on a line must be separated by ';'
let isBalanced = q.count == q.reduce(0, { $0 == $1? $0 : 0 }) // expected expression
let isBalanced = q.count == q.reduce(0, { $0 == $1? $0 : 0 }) // consecutive statements on a line must be separated by ';'

func willItFly(q: [Int], w: Int) -> Bool {
    let sum = q.reduce(0, +)
    let isBalanced = q.count == q.reduce(0, { $0 == $1? $0 : 0 })
    return isBalanced && 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 {
    let sum = q.reduce(0, +)
    let isBalanced = q.count == q.reduce(0, { $0 == $1? $0 : 0 })
    return isBalanced && sum <= w
}
```
let isBalanced = q.count == q.reduce(0, { $0 == $1? $0 : 0 }) // cannot use optional chaining on non-optional value of type 'Int'
let isBalanced = q.count == q.reduce(0, { $0 == $1? $0 : 0 }) // consecutive statements on a line must be separated by ';'
let isBalanced = q.count == q.reduce(0, { $0 == $1? $0 : 0 }) // expected expression
let isBalanced = q.count == q.reduce(0, { $0 == $1? $0 : 0 }) // consecutive statements on a line must be separated by ';'

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

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            right -= 1
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            right -= 1
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```
if arr[left]!= arr[right] { // '=' must have consistent whitespace on both sides
if arr[left]!= arr[right] { // use of '=' in a boolean context, did you mean '=='?
if arr[left]!= arr[right] { // cannot force unwrap value of non-optional type 'Int'

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            if arr[left] < arr[right] {
                right -= 1
            } else {
                left += 1
            }
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            if arr[left] < arr[right] {
                right -= 1
            } else {
                left += 1
            }
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```
if arr[left]!= arr[right] { // '=' must have consistent whitespace on both sides
if arr[left]!= arr[right] { // use of '=' in a boolean context, did you mean '=='?
if arr[left]!= arr[right] { // cannot force unwrap value of non-optional type 'Int'

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            left += 1
            right -= 1
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            left += 1
            right -= 1
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```
if arr[left]!= arr[right] { // '=' must have consistent whitespace on both sides
if arr[left]!= arr[right] { // use of '=' in a boolean context, did you mean '=='?
if arr[left]!= arr[right] { // cannot force unwrap value of non-optional type 'Int'

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            if arr[left] < arr[right] {
                arr[right] = arr[left]
            } else {
                arr[left] = arr[right]
            }
        }
        left += 1
        right -= 1
    }
    return count
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            if arr[left] < arr[right] {
                arr[right] = arr[left]
            } else {
                arr[left] = arr[right]
            }
        }
        left += 1
        right -= 1
    }
    return count
}
```
if arr[left]!= arr[right] { // '=' must have consistent whitespace on both sides
if arr[left]!= arr[right] { // use of '=' in a boolean context, did you mean '=='?
if arr[left]!= arr[right] { // cannot force unwrap value of non-optional type 'Int'
arr[right] = arr[left] // cannot assign through subscript: 'arr' is a 'let' constant
arr[left] = arr[right] // cannot assign through subscript: 'arr' is a 'let' constant

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            left += 1
            right -= 1
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            left += 1
            right -= 1
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```
if arr[left]!= arr[right] { // '=' must have consistent whitespace on both sides
if arr[left]!= arr[right] { // use of '=' in a boolean context, did you mean '=='?
if arr[left]!= arr[right] { // cannot force unwrap value of non-optional type 'Int'

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            left += 1
            right -= 1
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            left += 1
            right -= 1
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```
if arr[left]!= arr[right] { // '=' must have consistent whitespace on both sides
if arr[left]!= arr[right] { // use of '=' in a boolean context, did you mean '=='?
if arr[left]!= arr[right] { // cannot force unwrap value of non-optional type 'Int'

func smallestChange(arr: [Int]) -> Int {
    var count = 0
    var left = 0
    var right = arr.count - 1
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            left += 1
            right -= 1
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var count = 0
    var left = 0
    var right = arr.count - 1
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            left += 1
            right -= 1
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```
if arr[left]!= arr[right] { // '=' must have consistent whitespace on both sides
if arr[left]!= arr[right] { // use of '=' in a boolean context, did you mean '=='?
if arr[left]!= arr[right] { // cannot force unwrap value of non-optional type 'Int'

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

func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            right -= 1
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var left = 0
    var right = arr.count - 1
    var count = 0
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            right -= 1
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```
if arr[left]!= arr[right] { // '=' must have consistent whitespace on both sides
if arr[left]!= arr[right] { // use of '=' in a boolean context, did you mean '=='?
if arr[left]!= arr[right] { // cannot force unwrap value of non-optional type 'Int'

func smallestChange(arr: [Int]) -> Int {
    var count = 0
    var left = 0
    var right = arr.count - 1
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            if arr[left] < arr[right] {
                right -= 1
            } else {
                left += 1
            }
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```swift
// Given an array arr of integers, find the minimum number of elements that
// need to be changed to make the array palindromic. A palindromic array is an array that
// is read the same backwards and forwards. In one change, you can change one element to any other element.
// For example:
// smallestChange(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4
// smallestChange(arr: [1, 2, 3, 4, 3, 2, 2]) == 1
// smallestChange(arr: [1, 2, 3, 2, 1]) == 0
func smallestChange(arr: [Int]) -> Int {
    var count = 0
    var left = 0
    var right = arr.count - 1
    while left < right {
        if arr[left]!= arr[right] {
            count += 1
            if arr[left] < arr[right] {
                right -= 1
            } else {
                left += 1
            }
        } else {
            left += 1
            right -= 1
        }
    }
    return count
}
```
if arr[left]!= arr[right] { // '=' must have consistent whitespace on both sides
if arr[left]!= arr[right] { // use of '=' in a boolean context, did you mean '=='?
if arr[left]!= arr[right] { // cannot force unwrap value of non-optional type 'Int'

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result = [String]()
    var min = lst1.count < lst2.count? lst1 : lst2
    var max = lst1.count < lst2.count? lst2 : lst1
    for i in 0..<min.count {
        if min[i].count < max[i].count {
            result.append(min[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]()
    var min = lst1.count < lst2.count? lst1 : lst2
    var max = lst1.count < lst2.count? lst2 : lst1
    for i in 0..<min.count {
        if min[i].count < max[i].count {
            result.append(min[i])
        }
    }
    return result
}
```
var min = lst1.count < lst2.count? lst1 : lst2 // consecutive statements on a line must be separated by ';'
var min = lst1.count < lst2.count? lst1 : lst2 // expression of type '[String]' is unused
var min = lst1.count < lst2.count? lst1 : lst2 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
var min = lst1.count < lst2.count? lst1 : lst2 // consecutive statements on a line must be separated by ';'
var min = lst1.count < lst2.count? lst1 : lst2 // cannot use optional chaining on non-optional value of type 'Int'
var min = lst1.count < lst2.count? lst1 : lst2 // expected expression
var max = lst1.count < lst2.count? lst2 : lst1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
var max = lst1.count < lst2.count? lst2 : lst1 // cannot use optional chaining on non-optional value of type 'Int'
var max = lst1.count < lst2.count? lst2 : lst1 // expected expression
var max = lst1.count < lst2.count? lst2 : lst1 // expression of type '[String]' is unused
var max = lst1.count < lst2.count? lst2 : lst1 // consecutive statements on a line must be separated by ';'
var max = lst1.count < lst2.count? lst2 : lst1 // consecutive statements on a line must be separated by ';'

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

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

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

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

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result: [String] = []
    var min = lst1.count < lst2.count? lst1.count : lst2.count
    for i in 0..<min {
        if lst1[i].count < lst2[i].count {
            result.append(lst1[i])
        } else if lst2[i].count < lst1[i].count {
            result.append(lst2[i])
        }
    }
    return result
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result: [String] = []
    var min = lst1.count < lst2.count? lst1.count : lst2.count
    for i in 0..<min {
        if lst1[i].count < lst2[i].count {
            result.append(lst1[i])
        } else if lst2[i].count < lst1[i].count {
            result.append(lst2[i])
        }
    }
    return result
}
```
var min = lst1.count < lst2.count? lst1.count : lst2.count // consecutive statements on a line must be separated by ';'
var min = lst1.count < lst2.count? lst1.count : lst2.count // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
var min = lst1.count < lst2.count? lst1.count : lst2.count // expression of type 'Int' is unused
var min = lst1.count < lst2.count? lst1.count : lst2.count // expected expression
var min = lst1.count < lst2.count? lst1.count : lst2.count // cannot use optional chaining on non-optional value of type 'Int'
var min = lst1.count < lst2.count? lst1.count : lst2.count // consecutive statements on a line must be separated by ';'

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

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

print(totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]))
print(totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]))
print(totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]))
print(totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]))
```

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

func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result = [String]()
    var min = 0
    var max = 0
    if lst1.count < lst2.count {
        min = lst1.count
        max = lst2.count
    } else {
        min = lst2.count
        max = lst1.count
    }
    for i in 0..<min {
        if lst1[i].count < lst2[i].count {
            result.append(lst1[i])
        } else {
            result.append(lst2[i])
        }
    }
    return result
}
```swift
// Write a function that accepts two arrays of strings and returns the array that has 
// total number of chars in the all strings of the array less than the other array.
// if the two arrays have the same number of chars, return the first array.
// Examples
// totalMatch(lst1: [] as [String], lst2: [] as [String]) == [] as [String]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"]
// totalMatch(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"]
// totalMatch(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"]
func totalMatch(lst1: [String], lst2: [String]) -> [String] {
    var result = [String]()
    var min = 0
    var max = 0
    if lst1.count < lst2.count {
        min = lst1.count
        max = lst2.count
    } else {
        min = lst2.count
        max = lst1.count
    }
    for i in 0..<min {
        if lst1[i].count < lst2[i].count {
            result.append(lst1[i])
        } else {
            result.append(lst2[i])
        }
    }
    return result
}
```
var max = 0 // variable 'max' was written to, but never read
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
}
```
} // missing return in global function expected to return 'Bool'

func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
}
```
} // missing return in global function expected to return 'Bool'

func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
}
```
} // missing return in global function expected to return 'Bool'

func isMultiplyPrime(a: Int) -> Bool {
    var a = a
    var prime = 2
    var count = 0
    while a > 1 {
        if a % prime == 0 {
            a /= prime
            count += 1
        } else {
            prime += 1
        }
    }
    return count == 3
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    var a = a
    var prime = 2
    var count = 0
    while a > 1 {
        if a % prime == 0 {
            a /= prime
            count += 1
        } else {
            prime += 1
        }
    }
    return count == 3
}

isMultiplyPrime(a: 30)
```

func isMultiplyPrime(a: Int) -> Bool {
    return false
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    return false
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // Write your code here
    return false
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    return false
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    return false
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    var a = a
    var prime1 = 0
    var prime2 = 0
    var prime3 = 0
    var primeCount = 0
    while a > 0 {
        if a % 2 == 0 {
            a /= 2
        } else if a % 3 == 0 {
            a /= 3
            prime1 = 3
            primeCount += 1
        } else if a % 5 == 0 {
            a /= 5
            prime2 = 5
            primeCount += 1
        } else if a % 7 == 0 {
            a /= 7
            prime3 = 7
            primeCount += 1
        } else {
            return false
        }
    }
    return primeCount == 3 && prime1 * prime2 * prime3 == a
}
```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 {
    var a = a
    var prime1 = 0
    var prime2 = 0
    var prime3 = 0
    var primeCount = 0
    while a > 0 {
        if a % 2 == 0 {
            a /= 2
        } else if a % 3 == 0 {
            a /= 3
            prime1 = 3
            primeCount += 1
        } else if a % 5 == 0 {
            a /= 5
            prime2 = 5
            primeCount += 1
        } else if a % 7 == 0 {
            a /= 7
            prime3 = 7
            primeCount += 1
        } else {
            return false
        }
    }
    return primeCount == 3 && prime1 * prime2 * prime3 == a
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    return false
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    return false
}
```
 // XCTAssertTrue failed

func isMultiplyPrime(a: Int) -> Bool {
    // TODO: Write your code here
    return false
}
```swift
// Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100. 
// Example:
// 30 = 2 * 3 * 5
// isMultiplyPrime(a: 30) == true
func isMultiplyPrime(a: Int) -> Bool {
    // TODO: Write your code here
    return false
}
```
 // XCTAssertTrue failed

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

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

func isSimplePower(x: Int, n: Int) -> Bool {
    return x == n ** Int(log(Double(x), Double(n)))
}
```swift
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// isSimplePower(x: 1, n: 4) == true
// isSimplePower(x: 2, n: 2) == true
// isSimplePower(x: 8, n: 2) == true
// isSimplePower(x: 3, n: 2) == false
// isSimplePower(x: 3, n: 1) == false
// isSimplePower(x: 5, n: 3) == false
func isSimplePower(x: Int, n: Int) -> Bool {
    return x == n ** Int(log(Double(x), Double(n)))
}
```
return x == n ** Int(log(Double(x), Double(n))) // no operator '**' is defined; did you mean 'pow(_:_:)'?
return x == n ** Int(log(Double(x), Double(n))) // extra argument in call

func isSimplePower(x: Int, n: Int) -> Bool {
    return x == Int(pow(Double(n), Double(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 == Int(pow(Double(n), Double(x)))
}
```
 // XCTAssertTrue failed

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

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

func isSimplePower(x: Int, n: Int) -> Bool {
    return x == Int(pow(Double(n), Double(Int(log(Double(x)) / log(Double(n))))))
}
```swift
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// isSimplePower(x: 1, n: 4) == true
// isSimplePower(x: 2, n: 2) == true
// isSimplePower(x: 8, n: 2) == true
// isSimplePower(x: 3, n: 2) == false
// isSimplePower(x: 3, n: 1) == false
// isSimplePower(x: 5, n: 3) == false
func isSimplePower(x: Int, n: Int) -> Bool {
    return x == Int(pow(Double(n), Double(Int(log(Double(x)) / log(Double(n))))))
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

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

func isSimplePower(x: Int, n: Int) -> Bool {
    return x == Int(pow(Double(n), Double(Int(log(Double(x)) / log(Double(n))))))
}
```swift
// Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// isSimplePower(x: 1, n: 4) == true
// isSimplePower(x: 2, n: 2) == true
// isSimplePower(x: 8, n: 2) == true
// isSimplePower(x: 3, n: 2) == false
// isSimplePower(x: 3, n: 1) == false
// isSimplePower(x: 5, n: 3) == false
func isSimplePower(x: Int, n: Int) -> Bool {
    return x == Int(pow(Double(n), Double(Int(log(Double(x)) / log(Double(n))))))
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func isSimplePower(x: Int, n: Int) -> Bool {
    // Write your code here
    return false
}
```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 {
    // Write your code here
    return false
}
```
 // XCTAssertTrue failed

func iscube(a: Int) -> Bool {
    return Int(pow(Double(a), 1.0/3.0)) == 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(pow(Double(a), 1.0/3.0)) == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func iscube(a: Int) -> Bool {
    return Int(pow(Double(a), 1.0/3.0)) == 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(pow(Double(a), 1.0/3.0)) == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func iscube(a: Int) -> Bool {
    return Int(pow(Double(a), 1.0/3.0)) == 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(pow(Double(a), 1.0/3.0)) == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func iscube(a: Int) -> Bool {
    return Int(pow(Double(a), 1.0/3.0)) == 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(pow(Double(a), 1.0/3.0)) == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func iscube(a: Int) -> Bool {
    return Int(pow(Double(a), 1.0/3.0)) == 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(pow(Double(a), 1.0/3.0)) == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func iscube(a: Int) -> Bool {
    return Int(pow(Double(a), 1.0/3.0)) == 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(pow(Double(a), 1.0/3.0)) == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func iscube(a: Int) -> Bool {
    return Int(pow(Double(a), 1.0/3.0)) == 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(pow(Double(a), 1.0/3.0)) == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func iscube(a: Int) -> Bool {
    return Int(pow(Double(a), 1.0/3.0)) == 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(pow(Double(a), 1.0/3.0)) == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func iscube(a: Int) -> Bool {
    return Int(pow(Double(a), 1.0/3.0)) == 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(pow(Double(a), 1.0/3.0)) == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func iscube(a: Int) -> Bool {
    return Int(pow(Double(a), 1.0/3.0)) == 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(pow(Double(a), 1.0/3.0)) == a
}
```
 // Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

func hexKey(num: String) -> Int {
    let hex = "0123456789ABCDEF"
    var count = 0
    for i in 0..<num.count {
        let char = num[i]
        if hex.contains(char) {
            let index = hex.firstIndex(of: char)!
            if isPrime(index) {
                count += 1
            }
        }
    }
    return count
}

func isPrime(_ num: Int) -> Bool {
    if num < 2 {
        return false
    }
    if num == 2 {
        return true
    }
    if num % 2 == 0 {
        return false
    }
    for i in 3...Int(sqrt(Double(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 hex = "0123456789ABCDEF"
    var count = 0
    for i in 0..<num.count {
        let char = num[i]
        if hex.contains(char) {
            let index = hex.firstIndex(of: char)!
            if isPrime(index) {
                count += 1
            }
        }
    }
    return count
}

func isPrime(_ num: Int) -> Bool {
    if num < 2 {
        return false
    }
    if num == 2 {
        return true
    }
    if num % 2 == 0 {
        return false
    }
    for i in 3...Int(sqrt(Double(num))) {
        if num % i == 0 {
            return false
        }
    }
    return true
}
```
let char = num[i] // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.
if isPrime(index) { // cannot convert value of type 'String.Index' to expected argument type 'Int'

func hexKey(num: String) -> Int {
    var count = 0
    for char in num {
        if char == "2" || char == "3" || char == "5" || char == "7" || char == "B" || char == "D" {
            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 char in num {
        if char == "2" || char == "3" || char == "5" || char == "7" || char == "B" || char == "D" {
            count += 1
        }
    }
    return count
}
```

func hexKey(num: String) -> Int {
    var count = 0
    for char in num {
        if char == "2" || char == "3" || char == "5" || char == "7" || char == "B" || char == "D" {
            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 char in num {
        if char == "2" || char == "3" || char == "5" || char == "7" || char == "B" || char == "D" {
            count += 1
        }
    }
    return count
}

// You have been tasked to write a function that receives a string 
// and returns the number of vowels in it.
// Vowels are the following letters: A, E, I, O, U.
// Examples:
// vowelCount(str: "Hello World") == 3
// vowelCount(str: "a") == 1
// vowelCount(str: "aA") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") == 1
// vowelCount(str: "aAaa") ==

func hexKey(num: String) -> Int {
    var result = 0
    let hex = "0123456789ABCDEF"
    for char in num {
        if hex.contains(char) {
            let index = hex.index(of: char)
            if index! % 2 == 0 {
                result += 1
            }
        }
    }
    return result
}
```swift
// You have been tasked to write a function that receives 
// a hexadecimal number as a string and counts the number of hexadecimal 
// digits that are primes (prime number, or a prime, is a natural number 
// greater than 1 that is not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
// Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
// So you have to determine a number of the following digits: 2, 3, 5, 7, 
// B (=decimal 11), D (=decimal 13).
// Note: you may assume the input is always correct or empty string, 
// and symbols A,B,C,D,E,F are always uppercase.
// Examples:
// hexKey(num: "AB") == 1
// hexKey(num: "1077E") == 2
// hexKey(num: "ABED1A33") == 4
// hexKey(num: "123456789ABCDEF0") == 6
// hexKey(num: "2020") == 2
func hexKey(num: String) -> Int {
    var result = 0
    let hex = "0123456789ABCDEF"
    for char in num {
        if hex.contains(char) {
            let index = hex.index(of: char)
            if index! % 2 == 0 {
                result += 1
            }
        }
    }
    return result
}
```
let index = hex.index(of: char) // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
if index! % 2 == 0 { // cannot convert value of type 'String.Index' to expected argument type 'Int'

func hexKey(num: String) -> Int {
    var count = 0
    for char in num {
        if char == "2" || char == "3" || char == "5" || char == "7" || char == "B" || char == "D" {
            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 char in num {
        if char == "2" || char == "3" || char == "5" || char == "7" || char == "B" || char == "D" {
            count += 1
        }
    }
    return count
}
```

func hexKey(num: String) -> Int {
    let hex = "0123456789ABCDEF"
    var count = 0
    for char in num {
        if hex.contains(char) {
            if let index = hex.firstIndex(of: char) {
                let number = Int(String(hex[index]))!
                if number % 2 == 0 || number % 3 == 0 || number % 5 == 0 || number % 7 == 0 || number == 11 || number == 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 {
    let hex = "0123456789ABCDEF"
    var count = 0
    for char in num {
        if hex.contains(char) {
            if let index = hex.firstIndex(of: char) {
                let number = Int(String(hex[index]))!
                if number % 2 == 0 || number % 3 == 0 || number % 5 == 0 || number % 7 == 0 || number == 11 || number == 13 {
                    count += 1
                }
            }
        }
    }
    return count
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func hexKey(num: String) -> Int {
    var count = 0
    for char in num {
        switch char {
        case "2", "3", "5", "7", "B", "D":
            count += 1
        default:
            break
        }
    }
    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 char in num {
        switch char {
        case "2", "3", "5", "7", "B", "D":
            count += 1
        default:
            break
        }
    }
    return count
}
```

func hexKey(num: String) -> Int {
    var count = 0
    for char in num {
        if isPrime(char) {
            count += 1
        }
    }
    return count
}

func isPrime(_ char: Character) -> Bool {
    let num = Int(String(char))!
    if num == 2 || num == 3 || num == 5 || num == 7 {
        return true
    }
    return false
}
```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 char in num {
        if isPrime(char) {
            count += 1
        }
    }
    return count
}

func isPrime(_ char: Character) -> Bool {
    let num = Int(String(char))!
    if num == 2 || num == 3 || num == 5 || num == 7 {
        return true
    }
    return false
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func hexKey(num: String) -> Int {
    var count = 0
    for char in num {
        if char == "2" || char == "3" || char == "5" || char == "7" || char == "B" || char == "D" {
            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 char in num {
        if char == "2" || char == "3" || char == "5" || char == "7" || char == "B" || char == "D" {
            count += 1
        }
    }
    return count
}
```

func hexKey(num: String) -> Int {
    let hex = "0123456789ABCDEF"
    var count = 0
    for char in num {
        if hex.contains(char) {
            if isPrime(Int(String(char))!) {
                count += 1
            }
        }
    }
    return count
}

func isPrime(_ n: Int) -> Bool {
    if n <= 1 { return false }
    if n <= 3 { return true }
    if n % 2 == 0 || n % 3 == 0 { return false }
    let sqrtN = Int(sqrt(Double(n)))
    for i in 5..<sqrtN+1 {
        if n % i == 0 || n % (i+2) == 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 hex = "0123456789ABCDEF"
    var count = 0
    for char in num {
        if hex.contains(char) {
            if isPrime(Int(String(char))!) {
                count += 1
            }
        }
    }
    return count
}

func isPrime(_ n: Int) -> Bool {
    if n <= 1 { return false }
    if n <= 3 { return true }
    if n % 2 == 0 || n % 3 == 0 { return false }
    let sqrtN = Int(sqrt(Double(n)))
    for i in 5..<sqrtN+1 {
        if n % i == 0 || n % (i+2) == 0 {
            return false
        }
    }
    return true
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func decimalToBinary(decimal: Int) -> String {
    return "db\(String(decimal, radix: 2))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 {
    return "db\(String(decimal, radix: 2))db"
}
```

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal = decimal / 2
    }
    return "db" + binary + "db"
}

func binaryToDecimal(binary: String) -> Int {
    var decimal = 0
    var binary = binary.dropFirst().dropLast()
    for char in binary {
        decimal = decimal * 2 + Int(String(char))!
    }
    return decimal
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal = decimal / 2
    }
    return "db" + binary + "db"
}

// You will be given a string of binary numbers, with each character representing a binary number.
// The function should return the decimal number.
// 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:
// binaryToDecimal(binary: "db1111db") == 15
// binaryToDecimal(binary: "db100000db") == 32
func binaryToDecimal(binary: String) -> Int {
    var decimal = 0
    var binary = binary.dropFirst().dropLast()
    for char in binary {
        decimal = decimal * 2 + Int(String(char))!
    }
    return decimal
}
```
var binary = binary.dropFirst().dropLast() // variable 'binary' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    let binary = String(decimal, radix: 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 {
    let binary = String(decimal, radix: 2)
    return "db\(binary)db"
}
```

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    return "db\(String(decimal, radix: 2))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 {
    return "db\(String(decimal, radix: 2))db"
}
```

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

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal = decimal / 2
    }
    return "db" + binary + "db"
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal = decimal / 2
    }
    return "db" + binary + "db"
}
```
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    return "db\(String(decimal, radix: 2))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 {
    return "db\(String(decimal, radix: 2))db"
}
```

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal /= 2
    }
    return "db" + binary + "db"
}
```
 // XCTAssertTrue failed

func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal = decimal / 2
    }
    return "db" + binary + "db"
}
```swift
// You will be given a number in decimal form and your task is to convert it to
// binary format. The function should return a string, with each character representing a binary
// number. Each character in the string will be '0' or '1'.
// There will be an extra couple of characters 'db' at the beginning and at the end of the string.
// The extra characters are there to help with the format.
// Examples:
// decimalToBinary(decimal: 15) == "db1111db"
// decimalToBinary(decimal: 32) == "db100000db"
func decimalToBinary(decimal: Int) -> String {
    var binary = ""
    var decimal = decimal
    while decimal > 0 {
        binary = String(decimal % 2) + binary
        decimal = decimal / 2
    }
    return "db" + binary + "db"
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    let chars = Array(s)
    let count = chars.count
    guard count >= 3 else { return false }
    for i in 0..<count-2 {
        if chars[i] == chars[i+1] || chars[i] == chars[i+2] || chars[i+1] == chars[i+2] {
            return false
        }
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    let chars = Array(s)
    let count = chars.count
    guard count >= 3 else { return false }
    for i in 0..<count-2 {
        if chars[i] == chars[i+1] || chars[i] == chars[i+2] || chars[i+1] == chars[i+2] {
            return false
        }
    }
    return true
}
```

func isHappy(s: String) -> Bool {
    let chars = Array(s)
    let count = chars.count
    guard count >= 3 else {
        return false
    }
    for i in 0..<count-2 {
        let first = chars[i]
        let second = chars[i+1]
        let third = chars[i+2]
        if first == second || first == third || second == third {
            return false
        }
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    let chars = Array(s)
    let count = chars.count
    guard count >= 3 else {
        return false
    }
    for i in 0..<count-2 {
        let first = chars[i]
        let second = chars[i+1]
        let third = chars[i+2]
        if first == second || first == third || second == third {
            return false
        }
    }
    return true
}
```

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let chars = Array(s)
    var set = Set<Character>()
    for char in chars {
        if set.contains(char) { return false }
        set.insert(char)
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let chars = Array(s)
    var set = Set<Character>()
    for char in chars {
        if set.contains(char) { return false }
        set.insert(char)
    }
    return true
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    let chars = Array(s)
    let count = chars.count
    if count < 3 {
        return false
    }
    for i in 0..<count-2 {
        if chars[i] == chars[i+1] || chars[i+1] == chars[i+2] || chars[i] == chars[i+2] {
            return false
        }
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    let chars = Array(s)
    let count = chars.count
    if count < 3 {
        return false
    }
    for i in 0..<count-2 {
        if chars[i] == chars[i+1] || chars[i+1] == chars[i+2] || chars[i] == chars[i+2] {
            return false
        }
    }
    return true
}
```

func isHappy(s: String) -> Bool {
    let s = Array(s)
    let n = s.count
    if n < 3 { return false }
    for i in 0..<n-2 {
        if s[i] == s[i+1] || s[i] == s[i+2] || s[i+1] == s[i+2] {
            return false
        }
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    let s = Array(s)
    let n = s.count
    if n < 3 { return false }
    for i in 0..<n-2 {
        if s[i] == s[i+1] || s[i] == s[i+2] || s[i+1] == s[i+2] {
            return false
        }
    }
    return true
}
```

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let chars = Array(s)
    for i in 0..<chars.count - 2 {
        if chars[i] == chars[i + 1] || chars[i] == chars[i + 2] || chars[i + 1] == chars[i + 2] {
            return false
        }
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let chars = Array(s)
    for i in 0..<chars.count - 2 {
        if chars[i] == chars[i + 1] || chars[i] == chars[i + 2] || chars[i + 1] == chars[i + 2] {
            return false
        }
    }
    return true
}
```

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let chars = Array(s)
    for i in 0..<chars.count-2 {
        if chars[i] == chars[i+1] || chars[i] == chars[i+2] || chars[i+1] == chars[i+2] {
            return false
        }
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let chars = Array(s)
    for i in 0..<chars.count-2 {
        if chars[i] == chars[i+1] || chars[i] == chars[i+2] || chars[i+1] == chars[i+2] {
            return false
        }
    }
    return true
}
```

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var set = Set<Character>()
    for char in s {
        if set.contains(char) { return false }
        set.insert(char)
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    var set = Set<Character>()
    for char in s {
        if set.contains(char) { return false }
        set.insert(char)
    }
    return true
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let chars = Array(s)
    var set = Set<Character>()
    for i in 0..<chars.count {
        guard i + 2 < chars.count else { return false }
        let char = chars[i]
        let nextChar = chars[i + 1]
        let nextNextChar = chars[i + 2]
        if set.contains(char) || set.contains(nextChar) || set.contains(nextNextChar) {
            return false
        }
        set.insert(char)
        set.insert(nextChar)
        set.insert(nextNextChar)
    }
    return true
}
```swift
// You are given a string s.
// Your task is to check if the string is hapswift or not.
// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// isHappy(s: "a") == false
// isHappy(s: "aa") == false
// isHappy(s: "abcd") == true
// isHappy(s: "aabb") == false
// isHappy(s: "adb") == true
// isHappy(s: "xyy") == false
func isHappy(s: String) -> Bool {
    guard s.count >= 3 else { return false }
    let chars = Array(s)
    var set = Set<Character>()
    for i in 0..<chars.count {
        guard i + 2 < chars.count else { return false }
        let char = chars[i]
        let nextChar = chars[i + 1]
        let nextNextChar = chars[i + 2]
        if set.contains(char) || set.contains(nextChar) || set.contains(nextNextChar) {
            return false
        }
        set.insert(char)
        set.insert(nextChar)
        set.insert(nextNextChar)
    }
    return true
}
```
 // XCTAssertTrue failed

func isHappy(s: String) -> Bool {
    let chars = Array(s)
    let count = chars.count
    guard count >= 3 else { return false }
    var set = Set<Character>()
    for i in 0..<count {
        if set.contains(chars[i]) { return false }
        set.insert(chars[i])
        if set.count == 3 { return true }
    }
    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 {
    let chars = Array(s)
    let count = chars.count
    guard count >= 3 else { return false }
    var set = Set<Character>()
    for i in 0..<count {
        if set.contains(chars[i]) { return false }
        set.insert(chars[i])
        if set.count == 3 { return true }
    }
    return false
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

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

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    // Write your code here
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    // Write your code here
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades: [String] = []
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades: [String] = []
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```swift
// It is the last week of the semester and the teacher has to give the grades
// to students. The teacher has been making her own algorithm for grading.
// The only problem is, she has lost the code she used for grading.
// She has given you an array of GPAs for some students and you have to write 
// a function that can output an array of letter grades using the following table:
// GPA       |    Letter grade
// 4.0                A+
// > 3.7                A 
// > 3.3                A- 
// > 3.0                B+
// > 2.7                B 
// > 2.3                B-
// > 2.0                C+
// > 1.7                C
// > 1.3                C-
// > 1.0                D+ 
// > 0.7                D 
// > 0.0                D-
// 0.0                E
// Example:
// numericalLetterGrade(grades: [4.0, 3, 1.7, 2, 3.5]) == ["A+", "B", "C-", "C", "A-"]
func numericalLetterGrade(grades: [Double]) -> [String] {
    var letterGrades = [String]()
    for grade in grades {
        if grade >= 4.0 {
            letterGrades.append("A+")
        } else if grade >= 3.7 {
            letterGrades.append("A")
        } else if grade >= 3.3 {
            letterGrades.append("A-")
        } else if grade >= 3.0 {
            letterGrades.append("B+")
        } else if grade >= 2.7 {
            letterGrades.append("B")
        } else if grade >= 2.3 {
            letterGrades.append("B-")
        } else if grade >= 2.0 {
            letterGrades.append("C+")
        } else if grade >= 1.7 {
            letterGrades.append("C")
        } else if grade >= 1.3 {
            letterGrades.append("C-")
        } else if grade >= 1.0 {
            letterGrades.append("D+")
        } else if grade >= 0.7 {
            letterGrades.append("D")
        } else if grade >= 0.0 {
            letterGrades.append("D-")
        } else {
            letterGrades.append("E")
        }
    }
    return letterGrades
}
```
 // XCTAssertTrue failed

func primeLength(string: String) -> Bool {
    return string.count.isPrime
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    return string.count.isPrime
}
```
return string.count.isPrime // value of type 'Int' has no member 'isPrime'

func primeLength(string: String) -> Bool {
    return string.count.isPrime
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    return string.count.isPrime
}
```
return string.count.isPrime // value of type 'Int' has no member 'isPrime'

func primeLength(string: String) -> Bool {
    let length = string.count
    return isPrime(number: length)
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    let length = string.count
    return isPrime(number: length)
}
```
return isPrime(number: length) // cannot find 'isPrime' in scope

func primeLength(string: String) -> Bool {
    return string.count.isPrime
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    return string.count.isPrime
}
```
return string.count.isPrime // value of type 'Int' has no member 'isPrime'

func primeLength(string: String) -> Bool {
    return string.count.isPrime
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    return string.count.isPrime
}
```
return string.count.isPrime // value of type 'Int' has no member 'isPrime'

func primeLength(string: String) -> Bool {
    // Write your code here
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    // Write your code here
}
```
} // missing return in global function expected to return 'Bool'

func primeLength(string: String) -> Bool {
    return string.count.isPrime
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    return string.count.isPrime
}
```
return string.count.isPrime // value of type 'Int' has no member 'isPrime'

func primeLength(string: String) -> Bool {
    let length = string.count
    if length == 1 {
        return true
    } else if length == 2 {
        return false
    } else {
        for i in 2..<length {
            if length % i == 0 {
                return false
            }
        }
        return true
    }
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    let length = string.count
    if length == 1 {
        return true
    } else if length == 2 {
        return false
    } else {
        for i in 2..<length {
            if length % i == 0 {
                return false
            }
        }
        return true
    }
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func primeLength(string: String) -> Bool {
    let length = string.count
    if length == 1 {
        return false
    }
    if length == 2 {
        return true
    }
    for i in 2..<length {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    let length = string.count
    if length == 1 {
        return false
    }
    if length == 2 {
        return true
    }
    for i in 2..<length {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func primeLength(string: String) -> Bool {
    let length = string.count
    if length == 1 {
        return false
    }
    for i in 2...length/2 {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Write a function that takes a string and returns true if the string
// length is a prime number or false otherwise
// Examples
// primeLength(string: "Hello") == true
// primeLength(string: "abcdcba") == true
// primeLength(string: "kittens") == true
// primeLength(string: "orange") == false
func primeLength(string: String) -> Bool {
    let length = string.count
    if length == 1 {
        return false
    }
    for i in 2...length/2 {
        if length % i == 0 {
            return false
        }
    }
    return true
}
```
 // Fatal error: Range requires lowerBound <= upperBound

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

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

func startsOneEnds(n: Int) -> Int {
    let digits = String(n).count
    let first = pow(10, digits - 1)
    let last = pow(10, digits) - 1
    let count = last - first + 1
    return count
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    let digits = String(n).count
    let first = pow(10, digits - 1)
    let last = pow(10, digits) - 1
    let count = last - first + 1
    return count
}
```
return count // cannot convert return expression of type 'Decimal' to return type 'Int'

func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        let num = String(i)
        if num.hasPrefix("1") || num.hasSuffix("1") {
            count += 1
        }
    }
    return count
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        let num = String(i)
        if num.hasPrefix("1") || num.hasSuffix("1") {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

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

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

```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 {
    // 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
XCTAssertTrue(startsOneEnds(n: 1) == 1) // cannot find 'startsOneEnds' in scope
XCTAssertTrue(startsOneEnds(n: 2) == 18) // cannot find 'startsOneEnds' in scope
XCTAssertTrue(startsOneEnds(n: 3) == 180) // cannot find 'startsOneEnds' in scope
XCTAssertTrue(startsOneEnds(n: 4) == 1800) // cannot find 'startsOneEnds' in scope
XCTAssertTrue(startsOneEnds(n: 5) == 18000) // cannot find 'startsOneEnds' in scope

```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 {
    if n == 1 { return 1 }
    if n == 2 { return 2 }
    if n == 3 { return 3 }
    if n == 4 { return 4 }
    if n == 5 { return 5 }
    if n == 6 { return 6 }
    if n == 7 { return 7 }
    if n == 8 { return 8 }
    if n == 9 { return 9 }
    if n == 10 { return 10 }
    if n == 11 { return 11 }
    if n == 12 { return 12 }
    if n == 13 { return 13 }
    if n == 14 { return 14 }
    if n == 15 { return 15 }
    if n == 16 { return 16 }
    if n == 17 { return 17 }
    if n == 18 { return 18 }
    if n == 19 { return 19 }
    if n == 20 { return 20 }
    if n == 21 { return 21 }
    if n == 22 { return 22 }
    if n == 23 { return 23 }
    if n == 24 { return 24 }
    if n == 25 { return 25 }
    if n == 26 { return 26 }
    if n == 27 { return 27 }
    if n == 28 { return 28 }
    if n == 29 { return 29 }
    if n == 30 { return 30 }
    if n == 31 { return 31 }
    if n == 32 { return 32 }
    if n == 33 { return 33 }
    if n == 34 { return 34 }
    if n == 35 { return 35 }
    if n == 36 { return 36 }
    if n == 37 { return 37 }
    if n == 38 { return 38 }
    if n == 39 { return 39 }
    if n == 40 { return 40 }
    if n == 41 { return 41 }
    if n == 42 { return 42 }
    if n == 43 { return 43 }
    if n == 44 { return 44 }
    if n == 45 { return 45 }
    if n == 46 { return 46 }
    if n == 47 { return 47 }
    if n == 48 { return 48 }
    if n == 49 { return 49 }
    if n == 50 { return 50 }
    if n == 51 { return 51 }
    if n == 52 { return 52 }
    if n == 53 { return 53 }
    if n == 54 { return 54 }
    if n == 55 { return 55 }
    if n == 56 { return 56 }
    if n == 57 { return 57 }
    if n == 58 { return 58 }
    if n == 59 { return 59 }
    if n == 60 { return 60 }
    if n == 61 { return 61 }
    if n == 62 { return 62 }
    if n == 63 { return 63 }
    if n == 64 { return 64 }
    if n == 65 { return 65 }
    if n == 66 { return 66 }
    if n == 67 { return 67 }
    if n == 68 { return 68 }
    if n == 69 { return 69 }
    if n == 70 { return 70 }
    if n == 71 { return 71 }
    if n == 72 { return 72 }
    if n == 73 { return 73 }
    if n == 74 { return 74 }
    if n == 75 { return 75 }
    if n == 76 { return 76 }
    if n == 77 { return 77 }
    if n == 78 { return 78 }
    if n == 79 { return 79 }
    if n == 80 { return 80 }
    if
XCTAssertTrue(startsOneEnds(n: 1) == 1) // cannot find 'startsOneEnds' in scope
XCTAssertTrue(startsOneEnds(n: 2) == 18) // cannot find 'startsOneEnds' in scope
XCTAssertTrue(startsOneEnds(n: 3) == 180) // cannot find 'startsOneEnds' in scope
XCTAssertTrue(startsOneEnds(n: 4) == 1800) // cannot find 'startsOneEnds' in scope
XCTAssertTrue(startsOneEnds(n: 5) == 18000) // cannot find 'startsOneEnds' in scope

func startsOneEnds(n: Int) -> Int {
    // 10^n - 10^(n-1)
    let base = Int(pow(10, Double(n)))
    return base - Int(pow(10, Double(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 {
    // 10^n - 10^(n-1)
    let base = Int(pow(10, Double(n)))
    return base - Int(pow(10, Double(n-1)))
}
```
 // XCTAssertTrue failed

func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        let num = String(i)
        if num.hasPrefix("1") || num.hasSuffix("1") {
            count += 1
        }
    }
    return count
}
```swift
// Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
func startsOneEnds(n: Int) -> Int {
    var count = 0
    for i in 1...n {
        let num = String(i)
        if num.hasPrefix("1") || num.hasSuffix("1") {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    return String(N, radix: 2)
}
```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 {
    return String(N, radix: 2)
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    return String(N, radix: 2)
}
```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 {
    return String(N, radix: 2)
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    return String(N, radix: 2)
}
```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 {
    return String(N, radix: 2)
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    return String(N, radix: 2)
}
```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 {
    return String(N, radix: 2)
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    return String(N, radix: 2)
}
```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 {
    return String(N, radix: 2)
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    return String(N, radix: 2)
}
```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 {
    return String(N, radix: 2)
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    return String(N, radix: 2)
}
```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 {
    return String(N, radix: 2)
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    var sum = 0
    var n = N
    while n > 0 {
        sum += n % 2
        n /= 2
    }
    return String(sum)
}
```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 sum = 0
    var n = N
    while n > 0 {
        sum += n % 2
        n /= 2
    }
    return String(sum)
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    return String(N, radix: 2)
}
```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 {
    return String(N, radix: 2)
}
```
 // XCTAssertTrue failed

func solve(N: Int) -> String {
    return String(N, radix: 2)
}
```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 {
    return String(N, radix: 2)
}
```
 // XCTAssertTrue failed

func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +)
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +)
}
```
return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +) // cannot convert value of type '(Int) -> Int' to expected argument type '(Int, EnumeratedSequence<[Int]>.Element) throws -> Int' (aka '(Int, (offset: Int, element: Int)) throws -> Int')

func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +)
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +)
}
```
return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +) // cannot convert value of type '(Int) -> Int' to expected argument type '(Int, EnumeratedSequence<[Int]>.Element) throws -> Int' (aka '(Int, (offset: Int, element: Int)) throws -> Int')

func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +)
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +)
}
```
return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +) // cannot convert value of type '(Int) -> Int' to expected argument type '(Int, EnumeratedSequence<[Int]>.Element) throws -> Int' (aka '(Int, (offset: Int, element: Int)) throws -> Int')

func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +)
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +)
}
```
return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +) // cannot convert value of type '(Int) -> Int' to expected argument type '(Int, EnumeratedSequence<[Int]>.Element) throws -> Int' (aka '(Int, (offset: Int, element: Int)) throws -> Int')

func add(lst: [Int]) -> Int {
    return lst.enumerated().reduce(0) {
        $1.offset % 2 == 1? $0 + $1.element : $0
    }
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().reduce(0) {
        $1.offset % 2 == 1? $0 + $1.element : $0
    }
}
```
$1.offset % 2 == 1? $0 + $1.element : $0 // consecutive statements on a line must be separated by ';'
$1.offset % 2 == 1? $0 + $1.element : $0 // consecutive statements on a line must be separated by ';'
$1.offset % 2 == 1? $0 + $1.element : $0 // expected expression
$1.offset % 2 == 1? $0 + $1.element : $0 // cannot use optional chaining on non-optional value of type 'Int'

func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +)
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +)
}
```
return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +) // cannot convert value of type '(Int) -> Int' to expected argument type '(Int, EnumeratedSequence<[Int]>.Element) throws -> Int' (aka '(Int, (offset: Int, element: Int)) throws -> Int')

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```

func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +)
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +)
}
```
return lst.enumerated().filter { $0.offset % 2 == 1 && $0.element % 2 == 0 }.reduce(0, +) // cannot convert value of type '(Int) -> Int' to expected argument type '(Int, EnumeratedSequence<[Int]>.Element) throws -> Int' (aka '(Int, (offset: Int, element: Int)) throws -> Int')

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```

func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers lst. add the even elements that are at odd indices..
// Examples:
// add(lst: [4, 2, 6, 7]) == 2
func add(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 1 && value % 2 == 0 {
            sum += value
        }
    }
    return sum
}
```

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    let sortedWords = words.map { $0.sorted() }
    return sortedWords.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 {
    let words = s.components(separatedBy: " ")
    let sortedWords = words.map { $0.sorted() }
    return sortedWords.joined(separator: " ")
}
```
return sortedWords.joined(separator: " ") // cannot convert return expression of type 'JoinedSequence<[[String.Element]]>' (aka 'JoinedSequence<Array<Array<Character>>>') to return type 'String'

func antiShuffle(s: String) -> String {
    return s.components(separatedBy: " ").map { $0.sorted() }.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.components(separatedBy: " ").map { $0.sorted() }.joined(separator: " ")
}
```
return s.components(separatedBy: " ").map { $0.sorted() }.joined(separator: " ") // cannot convert value of type '[String.Element]' (aka 'Array<Character>') to closure result type '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 {
    return s.components(separatedBy: " ").map { $0.characters.sorted().reduce("", +) }.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.components(separatedBy: " ").map { $0.characters.sorted().reduce("", +) }.joined(separator: " ")
}

// antiShuffle(s: "Hello World!!!") == "Hello!!!Wdlor"
```
return s.components(separatedBy: " ").map { $0.characters.sorted().reduce("", +) }.joined(separator: " ") // binary operator '+' cannot be applied to operands of type 'String' and 'String.Element' (aka 'Character')

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let chars = Array(word)
        var newWord = ""
        for char in chars {
            newWord += String(char.asciiValue!)
        }
        result += newWord + " "
    }
    return result
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello!!!Wdlor"
func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    var result = ""
    for word in words {
        let chars = Array(word)
        var newWord = ""
        for char in chars {
            newWord += String(char.asciiValue!)
        }
        result += newWord + " "
    }
    return result
}
```
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    // Write your code here.
    return s
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello!!!Wdlor"
func antiShuffle(s: String) -> String {
    // Write your code here.
    return s
}
```
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    return s.components(separatedBy: " ").map { $0.sorted() }.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.components(separatedBy: " ").map { $0.sorted() }.joined(separator: " ")
}
```
return s.components(separatedBy: " ").map { $0.sorted() }.joined(separator: " ") // cannot convert value of type '[String.Element]' (aka 'Array<Character>') to closure result type 'String'

func antiShuffle(s: String) -> String {
    // Write your code here.
    return s
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello!!!Wdlor"
func antiShuffle(s: String) -> String {
    // Write your code here.
    return s
}
```
 // XCTAssertTrue failed

func antiShuffle(s: String) -> String {
    let words = s.components(separatedBy: " ")
    let newWords = words.map {
        String($0.sorted())
    }
    return newWords.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 {
    let words = s.components(separatedBy: " ")
    let newWords = words.map {
        String($0.sorted())
    }
    return newWords.joined(separator: " ")
}

print(antiShuffle(s: "Hi"))
print(antiShuffle(s: "hello"))
print(antiShuffle(s: "Hello World!!!"))
```

func antiShuffle(s: String) -> String {
    // Write your code here.
    var result = ""
    let words = s.components(separatedBy: " ")
    for word in words {
        let chars = Array(word)
        let sortedChars = chars.sorted()
        let sortedWord = String(sortedChars)
        result += sortedWord + " "
    }
    return result.trimmingCharacters(in:.whitespaces)
}
```swift
// Write a function that takes a string and returns an ordered version of it.
// Ordered version of string, is a string where all words (separated by space)
// are replaced by a new word where all the characters arranged in
// ascending order based on ascii value.
// Note: You should keep the order of words and blank spaces in the sentence.
// For example:
// antiShuffle(s: "Hi") == "Hi"
// antiShuffle(s: "hello") == "ehllo"
// antiShuffle(s: "Hello World!!!") == "Hello!!!Wdlor"
func antiShuffle(s: String) -> String {
    // Write your code here.
    var result = ""
    let words = s.components(separatedBy: " ")
    for word in words {
        let chars = Array(word)
        let sortedChars = chars.sorted()
        let sortedWord = String(sortedChars)
        result += sortedWord + " "
    }
    return result.trimmingCharacters(in:.whitespaces)
}
```

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (i, row) in lst.enumerated() {
        for (j, element) in row.enumerated() {
            if element == x {
                result.append((i, j))
            }
        }
    }
    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 (i, row) in lst.enumerated() {
        for (j, element) in row.enumerated() {
            if element == x {
                result.append((i, j))
            }
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        for (column, value) in row.enumerated() {
            if value == x {
                result.append((index, column))
            }
        }
    }
    result.sort { $0.0 < $1.0 }
    result.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 (index, row) in lst.enumerated() {
        for (column, value) in row.enumerated() {
            if value == x {
                result.append((index, column))
            }
        }
    }
    result.sort { $0.0 < $1.0 }
    result.sort { $0.1 > $1.1 }
    return result
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (i, row) in lst.enumerated() {
        for (j, column) in row.enumerated() {
            if column == x {
                result.append((i, j))
            }
        }
    }
    result.sort { $0.0 < $1.0 }
    result.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 (i, row) in lst.enumerated() {
        for (j, column) in row.enumerated() {
            if column == x {
                result.append((i, j))
            }
        }
    }
    result.sort { $0.0 < $1.0 }
    result.sort { $0.1 > $1.1 }
    return result
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (i, row) in lst.enumerated() {
        for (j, value) in row.enumerated() {
            if value == x {
                result.append((i, j))
            }
        }
    }
    result.sort { $0.0 < $1.0 }
    result.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 (i, row) in lst.enumerated() {
        for (j, value) in row.enumerated() {
            if value == x {
                result.append((i, j))
            }
        }
    }
    result.sort { $0.0 < $1.0 }
    result.sort { $0.1 > $1.1 }
    return result
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (index, row) in lst.enumerated() {
        for (index2, value) in row.enumerated() {
            if value == x {
                result.append((index, index2))
            }
        }
    }
    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 (index2, value) in row.enumerated() {
            if value == x {
                result.append((index, index2))
            }
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result: [(Int, Int)] = []
    for (index, row) in lst.enumerated() {
        for (column, value) in row.enumerated() {
            if value == x {
                result.append((index, column))
            }
        }
    }
    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 (column, value) in row.enumerated() {
            if value == x {
                result.append((index, column))
            }
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (index, row) in lst.enumerated() {
        for (column, value) in row.enumerated() {
            if value == x {
                result.append((index, column))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 }.sorted { $0.1 > $1.1 }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2)...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (index, row) in lst.enumerated() {
        for (column, value) in row.enumerated() {
            if value == x {
                result.append((index, column))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 }.sorted { $0.1 > $1.1 }
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (i, row) in lst.enumerated() {
        for (j, column) in row.enumerated() {
            if column == x {
                result.append((i, j))
            }
        }
    }
    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 (i, row) in lst.enumerated() {
        for (j, column) in row.enumerated() {
            if column == x {
                result.append((i, j))
            }
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (index, row) in lst.enumerated() {
        for (index2, item) in row.enumerated() {
            if item == x {
                result.append((index, index2))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 }
       .sorted { $0.1 > $1.1 }
}
```swift
// You are given a 2 dimensional data, as a nested arrays,
// which is similar to matrix, however, unlike matrices,
// each row may contain a different number of columns.
// Given lst, and integer x, find integers x in the array,
// and return array of tuples, [(x1, y1), (x2, y2)...] such that
// each tuple is a coordinate - (row, columns), starting with 0.
// Sort coordinates initially by rows in ascending order.
// Also, sort coordinates of the row by columns in descending order.
// Examples:
// getRow(lst: [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], x: 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
// getRow(lst: [] as [[Int]], x: 1) == [] as [(Int, Int)]
// getRow(lst: [[] as [Int], [1], [1, 2, 3]], x: 3) == [(2, 2)]
func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (index, row) in lst.enumerated() {
        for (index2, item) in row.enumerated() {
            if item == x {
                result.append((index, index2))
            }
        }
    }
    return result.sorted { $0.0 < $1.0 }
       .sorted { $0.1 > $1.1 }
}
```
 // XCTAssertTrue failed

func getRow(lst: [[Int]], x: Int) -> [(Int, Int)] {
    var result = [(Int, Int)]()
    for (index, row) in lst.enumerated() {
        for (index2, item) in row.enumerated() {
            if item == x {
                result.append((index, index2))
            }
        }
    }
    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 (index2, item) in row.enumerated() {
            if item == x {
                result.append((index, index2))
            }
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func sortArray(array: [Int]) -> [Int] {
    return array.sorted { (a, b) -> Bool in
        let sum = a + b
        return sum % 2 == 0
    }
}
```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] {
    return array.sorted { (a, b) -> Bool in
        let sum = a + b
        return sum % 2 == 0
    }
}
```
 // XCTAssertTrue failed

func sortArray(array: [Int]) -> [Int] {
    var sortedArray = array
    sortedArray.sort { $0 < $1 }
    let sum = sortedArray.first! + sortedArray.last!
    return sum % 2 == 0? sortedArray : sortedArray.reversed()
}
```swift
// Given an array of non-negative integers, return a coswift of the given array after sorting,
// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
// or sort it in descending order if the sum( first index value, last index value) is even.
// Note:
// * don't change the given array.
// Examples:
// sortArray(array: [] as [Int]) == [] as [Int]
// sortArray(array: [5]) == [5]
// sortArray(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
// sortArray(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
func sortArray(array: [Int]) -> [Int] {
    var sortedArray = array
    sortedArray.sort { $0 < $1 }
    let sum = sortedArray.first! + sortedArray.last!
    return sum % 2 == 0? sortedArray : sortedArray.reversed()
}
```
return sum % 2 == 0? sortedArray : sortedArray.reversed() // consecutive statements on a line must be separated by ';'
return sum % 2 == 0? sortedArray : sortedArray.reversed() // expected expression
return sum % 2 == 0? sortedArray : sortedArray.reversed() // cannot convert return expression of type 'Bool' to return type '[Int]'
return sum % 2 == 0? sortedArray : sortedArray.reversed() // cannot use optional chaining on non-optional value of type 'Int'
return sum % 2 == 0? sortedArray : sortedArray.reversed() // consecutive statements on a line must be separated by ';'
return sum % 2 == 0? sortedArray : sortedArray.reversed() // variable is unused

func sortArray(array: [Int]) -> [Int] {
    // Write your code here
}
```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] {
    // Write your code here
}
```
} // missing return in global function expected to return '[Int]'

func sortArray(array: [Int]) -> [Int] {
    var result = array
    result.sort { $0 < $1 }
    return result
}
```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 result = array
    result.sort { $0 < $1 }
    return result
}
```
 // XCTAssertTrue failed

func sortArray(array: [Int]) -> [Int] {
    return array.sorted { $0 + $1 % 2!= 0 }
}
```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] {
    return array.sorted { $0 + $1 % 2!= 0 }
}
```
return array.sorted { $0 + $1 % 2!= 0 } // '=' must have consistent whitespace on both sides
return array.sorted { $0 + $1 % 2!= 0 } // cannot force unwrap value of non-optional type 'Int'
return array.sorted { $0 + $1 % 2!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
return array.sorted { $0 + $1 % 2!= 0 } // expression is not assignable: binary operator returns immutable value

func sortArray(array: [Int]) -> [Int] {
    return array.sorted { (a, b) -> Bool in
        let sum = a + b
        return sum % 2 == 0
    }
}
```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] {
    return array.sorted { (a, b) -> Bool in
        let sum = a + b
        return sum % 2 == 0
    }
}
```
 // XCTAssertTrue failed

func sortArray(array: [Int]) -> [Int] {
    return array.sorted {
        let sum = $0 + $1
        return sum % 2 == 0
    }
}
```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] {
    return array.sorted {
        let sum = $0 + $1
        return sum % 2 == 0
    }
}
```
 // XCTAssertTrue failed

func sortArray(array: [Int]) -> [Int] {
    return array.sorted { (a, b) -> Bool in
        let sum = a + b
        return sum % 2 == 0
    }
}
```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] {
    return array.sorted { (a, b) -> Bool in
        let sum = a + b
        return sum % 2 == 0
    }
}
```
 // XCTAssertTrue failed

func sortArray(array: [Int]) -> [Int] {
    return array.sorted {
        let sum = $0 + $1
        return sum % 2 == 0
    }
}
```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] {
    return array.sorted {
        let sum = $0 + $1
        return sum % 2 == 0
    }
}
```
 // XCTAssertTrue failed

func sortArray(array: [Int]) -> [Int] {
    var result = array
    result.sort { (a, b) -> Bool in
        let sum = a + b
        return sum % 2 == 0
    }
    return result
}
```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 result = array
    result.sort { (a, b) -> Bool in
        let sum = a + b
        return sum % 2 == 0
    }
    return result
}
```
 // XCTAssertTrue failed

func encrypt(s: String) -> String {
    var newString = ""
    var newChar = ""
    for char in s {
        if char == " " {
            newString += " "
        } else {
            let newIndex = char.unicodeScalars.first!.value + 2
            newChar = Character(UnicodeScalar(newIndex)!)
            newString += String(newChar)
        }
    }
    return newString
}

func decrypt(s: String) -> String {
    var newString = ""
    var newChar = ""
    for char in s {
        if char == " " {
            newString += " "
        } else {
            let newIndex = char.unicodeScalars.first!.value - 2
            newChar = Character(UnicodeScalar(newIndex)!)
            newString += String(newChar)
        }
    }
    return newString
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    var newString = ""
    var newChar = ""
    for char in s {
        if char == " " {
            newString += " "
        } else {
            let newIndex = char.unicodeScalars.first!.value + 2
            newChar = Character(UnicodeScalar(newIndex)!)
            newString += String(newChar)
        }
    }
    return newString
}

// 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 {
    var newString = ""
    var newChar = ""
    for char in s {
        if char == " " {
            newString += " "
        } else {
            let newIndex = char.unicodeScalars.first!.value - 2
            newChar = Character(UnicodeScalar(newIndex)!)
            newString += String(newChar)
        }
    }
    return newString
}
```
newChar = Character(UnicodeScalar(newIndex)!) // cannot assign value of type 'Character' to type 'String'
newChar = Character(UnicodeScalar(newIndex)!) // cannot assign value of type 'Character' to type 'String'

func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    let alphabetArray = Array(alphabet)
    var newString = ""
    for char in s {
        let index = alphabetArray.firstIndex(of: String(char))
        if let index = index {
            let newIndex = (index + 2) % 26
            newString += alphabetArray[newIndex]
        } else {
            newString += String(char)
        }
    }
    return newString
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    let alphabetArray = Array(alphabet)
    var newString = ""
    for char in s {
        let index = alphabetArray.firstIndex(of: String(char))
        if let index = index {
            let newIndex = (index + 2) % 26
            newString += alphabetArray[newIndex]
        } else {
            newString += String(char)
        }
    }
    return newString
}

encrypt(s: "hi")
encrypt(s: "asdfghjkl")
encrypt(s: "gf")
encrypt(s: "et")
```
let index = alphabetArray.firstIndex(of: String(char)) // cannot convert value of type 'String' to expected argument type 'String.Element' (aka 'Character')

func encrypt(s: String) -> String {
    var result = ""
    for char in s {
        let index = alphabet.index(alphabet.startIndex, offsetBy: alphabet.count / 2)
        let newIndex = alphabet.index(index, offsetBy: alphabet.distance(from: alphabet.startIndex, to: char))
        result += String(alphabet[newIndex])
    }
    return result
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    var result = ""
    for char in s {
        let index = alphabet.index(alphabet.startIndex, offsetBy: alphabet.count / 2)
        let newIndex = alphabet.index(index, offsetBy: alphabet.distance(from: alphabet.startIndex, to: char))
        result += String(alphabet[newIndex])
    }
    return result
}
```
let index = alphabet.index(alphabet.startIndex, offsetBy: alphabet.count / 2) // cannot find 'alphabet' in scope
let index = alphabet.index(alphabet.startIndex, offsetBy: alphabet.count / 2) // cannot find 'alphabet' in scope
let index = alphabet.index(alphabet.startIndex, offsetBy: alphabet.count / 2) // cannot find 'alphabet' in scope
let newIndex = alphabet.index(index, offsetBy: alphabet.distance(from: alphabet.startIndex, to: char)) // cannot find 'alphabet' in scope
let newIndex = alphabet.index(index, offsetBy: alphabet.distance(from: alphabet.startIndex, to: char)) // cannot find 'alphabet' in scope
let newIndex = alphabet.index(index, offsetBy: alphabet.distance(from: alphabet.startIndex, to: char)) // cannot find 'alphabet' in scope
result += String(alphabet[newIndex]) // cannot find 'alphabet' in scope

func encrypt(s: String) -> String {
    var alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encrypted = ""
    for char in s {
        if let index = alphabet.index(of: char) {
            let newIndex = (index + 2) * 2
            let newChar = alphabet[alphabet.index(alphabet.startIndex, offsetBy: newIndex)]
            encrypted.append(newChar)
        } else {
            encrypted.append(char)
        }
    }
    return encrypted
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    var alphabet = "abcdefghijklmnopqrstuvwxyz"
    var encrypted = ""
    for char in s {
        if let index = alphabet.index(of: char) {
            let newIndex = (index + 2) * 2
            let newChar = alphabet[alphabet.index(alphabet.startIndex, offsetBy: newIndex)]
            encrypted.append(newChar)
        } else {
            encrypted.append(char)
        }
    }
    return encrypted
}
```
if let index = alphabet.index(of: char) { // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
let newIndex = (index + 2) * 2 // cannot convert value of type 'String.Index' to expected argument type 'Int'

func encrypt(s: String) -> String {
    var newString = ""
    for char in s {
        let newChar = char.rotate(by: 2)
        newString.append(newChar)
    }
    return newString
}

func decrypt(s: String) -> String {
    var newString = ""
    for char in s {
        let newChar = char.rotate(by: -2)
        newString.append(newChar)
    }
    return newString
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    var newString = ""
    for char in s {
        let newChar = char.rotate(by: 2)
        newString.append(newChar)
    }
    return newString
}

// 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 {
    var newString = ""
    for char in s {
        let newChar = char.rotate(by: -2)
        newString.append(newChar)
    }
    return newString
}
```
let newChar = char.rotate(by: 2) // value of type 'Character' has no member 'rotate'
let newChar = char.rotate(by: -2) // value of type 'Character' has no member 'rotate'

func encrypt(s: String) -> String {
    var result = ""
    for char in s {
        let charInt = Int(char.asciiValue!)
        let newCharInt = charInt! + 2
        let newChar = Character(UnicodeScalar(newCharInt)!)
        result.append(newChar)
    }
    return result
}

func decrypt(s: String) -> String {
    var result = ""
    for char in s {
        let charInt = Int(char.asciiValue!)
        let newCharInt = charInt! - 2
        let newChar = Character(UnicodeScalar(newCharInt)!)
        result.append(newChar)
    }
    return result
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    var result = ""
    for char in s {
        let charInt = Int(char.asciiValue!)
        let newCharInt = charInt! + 2
        let newChar = Character(UnicodeScalar(newCharInt)!)
        result.append(newChar)
    }
    return result
}

// 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 {
    var result = ""
    for char in s {
        let charInt = Int(char.asciiValue!)
        let newCharInt = charInt! - 2
        let newChar = Character(UnicodeScalar(newCharInt)!)
        result.append(newChar)
    }
    return result
}
```
let newCharInt = charInt! + 2 // cannot force unwrap value of non-optional type 'Int'
let newCharInt = charInt! - 2 // cannot force unwrap value of non-optional type 'Int'

func encrypt(s: String) -> String {
    var result = ""
    for char in s {
        let newChar = char.rotate(by: 2)
        result.append(newChar)
    }
    return result
}

func decrypt(s: String) -> String {
    var result = ""
    for char in s {
        let newChar = char.rotate(by: -2)
        result.append(newChar)
    }
    return result
}

func rotate(s: String, by: Int) -> String {
    var result = ""
    for char in s {
        let newChar = char.rotate(by: by)
        result.append(newChar)
    }
    return result
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    var result = ""
    for char in s {
        let newChar = char.rotate(by: 2)
        result.append(newChar)
    }
    return result
}

// 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 {
    var result = ""
    for char in s {
        let newChar = char.rotate(by: -2)
        result.append(newChar)
    }
    return result
}

// Create a function rotate that takes a string and an integer as arguments
// and returns a string rotated by the integer multiplied to two places.
// For example:
// rotate(s: "hi", by: 1) == "jk"
// rotate(s: "asdfghjkl", by: 2) == "ewhjklnop"
// rotate(s: "asdfghjkl", by: 3) == "cdefghijkl"
// rotate(s: "asdfghjkl", by: 4) == "bdefghijkl"
// rotate(s: "asdfghjkl", by: 5) == "adefghijkl"
func rotate(s: String, by: Int) -> String {
    var result = ""
    for char in s {
        let newChar = char.rotate(by: by)
        result.append(newChar)
    }
    return result
}
```
let newChar = char.rotate(by: 2) // value of type 'Character' has no member 'rotate'
let newChar = char.rotate(by: -2) // value of type 'Character' has no member 'rotate'
let newChar = char.rotate(by: by) // value of type 'Character' has no member 'rotate'

func encrypt(s: String) -> String {
    var result = ""
    for char in s {
        let charCode = char.asciiValue!
        let newCharCode = charCode + 2 * 2
        result += String(UnicodeScalar(newCharCode)!)
    }
    return result
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    var result = ""
    for char in s {
        let charCode = char.asciiValue!
        let newCharCode = charCode + 2 * 2
        result += String(UnicodeScalar(newCharCode)!)
    }
    return result
}
```
result += String(UnicodeScalar(newCharCode)!) // cannot force unwrap value of non-optional type 'UnicodeScalar' (aka 'Unicode.Scalar')

func encrypt(s: String) -> String {
    var result = ""
    for char in s {
        let index = alphabet.firstIndex(of: char)!
        let newIndex = index + 2
        result += alphabet[newIndex]
    }
    return result
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    var result = ""
    for char in s {
        let index = alphabet.firstIndex(of: char)!
        let newIndex = index + 2
        result += alphabet[newIndex]
    }
    return result
}

let alphabet = "abcdefghijklmnopqrstuvwxyz"

encrypt(s: "hi")
encrypt(s: "asdfghjkl")
encrypt(s: "gf")
encrypt(s: "et")
```
let index = alphabet.firstIndex(of: char)! // cannot find 'alphabet' in scope
result += alphabet[newIndex] // cannot find 'alphabet' in scope

func encrypt(s: String) -> String {
    var result = ""
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    for char in s {
        let index = alphabet.index(of: char)
        let newIndex = alphabet.index(alphabet.startIndex, offsetBy: index! + 2)
        result += String(alphabet[newIndex])
    }
    return result
}
```swift
// Create a function encrypt that takes a string as an argument and
// returns a string encrypted with the alphabet being rotated. 
// The alphabet should be rotated in a manner such that the letters 
// shift down by two multiplied to two places.
// For example:
// encrypt(s: "hi") == "lm"
// encrypt(s: "asdfghjkl") == "ewhjklnop"
// encrypt(s: "gf") == "kj"
// encrypt(s: "et") == "ix"
func encrypt(s: String) -> String {
    var result = ""
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    for char in s {
        let index = alphabet.index(of: char)
        let newIndex = alphabet.index(alphabet.startIndex, offsetBy: index! + 2)
        result += String(alphabet[newIndex])
    }
    return result
}
```
let index = alphabet.index(of: char) // 'index(of:)' is deprecated: renamed to 'firstIndex(of:)'
let newIndex = alphabet.index(alphabet.startIndex, offsetBy: index! + 2) // cannot convert value of type 'String.Index' to expected argument type 'Int'

func nextSmallest(lst: [Int]) -> Int? {
    // TODO: Write your code here
}
```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? {
    // TODO: Write your code here
}
```
} // missing return in global function expected to return 'Int?'

func nextSmallest(lst: [Int]) -> Int? {
    // Write your code here
}
```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? {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int?'

func nextSmallest(lst: [Int]) -> Int? {
    // Write your code here.
}
```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? {
    // Write your code here.
}
```
} // missing return in global function expected to return 'Int?'

func nextSmallest(lst: [Int]) -> Int? {
    // Write your code here.
}
```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? {
    // Write your code here.
}
```
} // missing return in global function expected to return 'Int?'

func nextSmallest(lst: [Int]) -> Int? {
    // Write your code here.
}
```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? {
    // Write your code here.
}
```
} // missing return in global function expected to return 'Int?'

func nextSmallest(lst: [Int]) -> Int? {
    // Write your code here
}
```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? {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int?'

func nextSmallest(lst: [Int]) -> Int? {
    // Write your code here
}
```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? {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int?'

func nextSmallest(lst: [Int]) -> Int? {
    var min = lst.min()
    var secondMin = lst.min()
    for i in lst {
        if i < min {
            secondMin = min
            min = i
        } else if i < secondMin && i!= min {
            secondMin = i
        }
    }
    return secondMin
}
```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 min = lst.min()
    var secondMin = lst.min()
    for i in lst {
        if i < min {
            secondMin = min
            min = i
        } else if i < secondMin && i!= min {
            secondMin = i
        }
    }
    return secondMin
}
```
if i < min { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
} else if i < secondMin && i!= min { // cannot force unwrap value of non-optional type 'Int'
} else if i < secondMin && i!= min { // '=' must have consistent whitespace on both sides
} else if i < secondMin && i!= min { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
} else if i < secondMin && i!= min { // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
} else if i < secondMin && i!= min { // use of '=' in a boolean context, did you mean '=='?

func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var smallest = lst[0]
    var secondSmallest = lst[1]
    for i in 2..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else { return nil }
    var smallest = lst[0]
    var secondSmallest = lst[1]
    for i in 2..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```
 // XCTAssertTrue failed

func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else {
        return nil
    }
    var smallest = lst[0]
    var secondSmallest = lst[1]
    for i in 2..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```swift
// You are given an array of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the array.
// Return nil if there is no such element.
// nextSmallest(lst: [1, 2, 3, 4, 5]) == 2
// nextSmallest(lst: [5, 1, 4, 3, 2]) == 2
// nextSmallest(lst: [] as [Int]) == nil
// nextSmallest(lst: [1, 1]) == nil
func nextSmallest(lst: [Int]) -> Int? {
    guard lst.count > 1 else {
        return nil
    }
    var smallest = lst[0]
    var secondSmallest = lst[1]
    for i in 2..<lst.count {
        if lst[i] < smallest {
            secondSmallest = smallest
            smallest = lst[i]
        } else if lst[i] < secondSmallest {
            secondSmallest = lst[i]
        }
    }
    return secondSmallest
}
```
 // XCTAssertTrue failed

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

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

func isBored(S: String) -> Int {
    let words = S.components(separatedBy: [" ", ".", "?", "!"])
    return words.filter { $0.hasPrefix("I") }.count
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let words = S.components(separatedBy: [" ", ".", "?", "!"])
    return words.filter { $0.hasPrefix("I") }.count
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var boredom = 0
    var sentence = ""
    for char in S {
        if char == "." || char == "?" || char == "!" {
            if sentence.hasPrefix("I") {
                boredom += 1
            }
            sentence = ""
        } else {
            sentence.append(char)
        }
    }
    return boredom
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    var boredom = 0
    var sentence = ""
    for char in S {
        if char == "." || char == "?" || char == "!" {
            if sentence.hasPrefix("I") {
                boredom += 1
            }
            sentence = ""
        } else {
            sentence.append(char)
        }
    }
    return boredom
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    let words = S.components(separatedBy: " ")
    var boredom = 0
    for word in words {
        if word.hasPrefix("I") {
            boredom += 1
        }
    }
    return boredom
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let words = S.components(separatedBy: " ")
    var boredom = 0
    for word in words {
        if word.hasPrefix("I") {
            boredom += 1
        }
    }
    return boredom
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var bored = 0
    var sentence = ""
    for char in S {
        if char == " " {
            if sentence.hasPrefix("I") {
                bored += 1
            }
            sentence = ""
        } else {
            sentence.append(char)
        }
    }
    if sentence.hasPrefix("I") {
        bored += 1
    }
    return bored
}
```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 bored = 0
    var sentence = ""
    for char in S {
        if char == " " {
            if sentence.hasPrefix("I") {
                bored += 1
            }
            sentence = ""
        } else {
            sentence.append(char)
        }
    }
    if sentence.hasPrefix("I") {
        bored += 1
    }
    return bored
}
```
 // XCTAssertTrue failed

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

func isBored(S: String) -> Int {
    let words = S.components(separatedBy: CharacterSet(charactersIn: ".?!"))
    return words.filter { $0.hasPrefix("I") }.count
}
```swift
// You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// isBored(S: "Hello world") == 0
// isBored(S: "The sky is blue. The sun is shining. I love this weather") == 1
func isBored(S: String) -> Int {
    let words = S.components(separatedBy: CharacterSet(charactersIn: ".?!"))
    return words.filter { $0.hasPrefix("I") }.count
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var count = 0
    var sentence = ""
    for char in S {
        if char == "." || char == "?" || char == "!" {
            if sentence.hasPrefix("I") {
                count += 1
            }
            sentence = ""
        } else {
            sentence.append(char)
        }
    }
    if sentence.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 sentence = ""
    for char in S {
        if char == "." || char == "?" || char == "!" {
            if sentence.hasPrefix("I") {
                count += 1
            }
            sentence = ""
        } else {
            sentence.append(char)
        }
    }
    if sentence.hasPrefix("I") {
        count += 1
    }
    return count
}
```
 // XCTAssertTrue failed

func isBored(S: String) -> Int {
    var count = 0
    let words = S.components(separatedBy: CharacterSet(charactersIn: ".?!"))
    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: CharacterSet(charactersIn: ".?!"))
    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 + y == z || x + z == y || y + z == x) && x.isInt && y.isInt && z.isInt
}
```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 + y == z || x + z == y || y + z == x) && x.isInt && y.isInt && z.isInt
}
```
return (x + y == z || x + z == y || y + z == x) && x.isInt && y.isInt && z.isInt // value of type 'Double' has no member 'isInt'
return (x + y == z || x + z == y || y + z == x) && x.isInt && y.isInt && z.isInt // value of type 'Double' has no member 'isInt'
return (x + y == z || x + z == y || y + z == x) && x.isInt && y.isInt && z.isInt // value of type 'Double' has no member 'isInt'

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return (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 + y == z) || (x + z == y) || (y + z == x)
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return (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 + y == z) || (x + z == y) || (y + z == x)
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return (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 + y == z) || (x + z == y) || (y + z == x)
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return (x + y == z || x + z == y || y + z == x) && (x.truncatingRemainder(dividingBy: 1) == 0 && y.truncatingRemainder(dividingBy: 1) == 0 && z.truncatingRemainder(dividingBy: 1) == 0)
}
```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 + y == z || x + z == y || y + z == x) && (x.truncatingRemainder(dividingBy: 1) == 0 && y.truncatingRemainder(dividingBy: 1) == 0 && z.truncatingRemainder(dividingBy: 1) == 0)
}
```

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return (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 + y == z) || (x + z == y) || (y + z == x)
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return (x + y == z || x + z == y || y + z == x) && (x.truncatingRemainder(dividingBy: 1) == 0 && y.truncatingRemainder(dividingBy: 1) == 0 && z.truncatingRemainder(dividingBy: 1) == 0)
}
```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 + y == z || x + z == y || y + z == x) && (x.truncatingRemainder(dividingBy: 1) == 0 && y.truncatingRemainder(dividingBy: 1) == 0 && z.truncatingRemainder(dividingBy: 1) == 0)
}
```

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return (x + y == z || x + z == y || y + z == x) && (x.truncatingRemainder(dividingBy: 1) == 0 && y.truncatingRemainder(dividingBy: 1) == 0 && z.truncatingRemainder(dividingBy: 1) == 0)
}
```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 + y == z || x + z == y || y + z == x) && (x.truncatingRemainder(dividingBy: 1) == 0 && y.truncatingRemainder(dividingBy: 1) == 0 && z.truncatingRemainder(dividingBy: 1) == 0)
}
```

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return (x == y + z) || (x == z + y) || (y == x + z) || (y == z + x) || (z == x + y) || (z == y + 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 == y + z) || (x == z + y) || (y == x + z) || (y == z + x) || (z == x + y) || (z == y + x)
}
```
 // XCTAssertTrue failed

func anyInt(x: Double, y: Double, z: Double) -> Bool {
    return (x + y == z || x + z == y || y + z == x) && (x.truncatingRemainder(dividingBy: 1) == 0 && y.truncatingRemainder(dividingBy: 1) == 0 && z.truncatingRemainder(dividingBy: 1) == 0)
}
```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 + y == z || x + z == y || y + z == x) && (x.truncatingRemainder(dividingBy: 1) == 0 && y.truncatingRemainder(dividingBy: 1) == 0 && z.truncatingRemainder(dividingBy: 1) == 0)
}
```

func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            encodedMessage.append(newChar)
        } else {
            encodedMessage.append(char)
        }
    }
    return encodedMessage
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            encodedMessage.append(newChar)
        } else {
            encodedMessage.append(char)
        }
    }
    return encodedMessage
}

// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            encodedMessage.append(newChar)
        } else {
            encodedMessage.append(char)
        }
    }
    return encodedMessage
}

// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            encodedMessage.append(newChar)
        } else {
            encodedMessage.append(char)
        }
    }
    return encodedMessage
}

// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            encodedMessage.append(newChar)
        } else {
            encodedMessage.append(char)
        }
    }
    return encodedMessage
}

// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            encodedMessage.append(newChar)
        } else {
            encodedMessage.append(char)
        }
    }
    return encodedMessage
}

// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            encodedMessage
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // expected expression
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // result of call to 'lowercased()' is unused
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // cannot use optional chaining on non-optional value of type 'Bool'

func encode(message: String) -> String {
    var result = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            result.append(newChar)
        } else {
            result.append(char)
        }
    }
    return result
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var result = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            result.append(newChar)
        } else {
            result.append(char)
        }
    }
    return result
}

// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var result = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            result.append(newChar)
        } else {
            result.append(char)
        }
    }
    return result
}

// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var result = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            result.append(newChar)
        } else {
            result.append(char)
        }
    }
    return result
}

// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var result = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            result.append(newChar)
        } else {
            result.append(char)
        }
    }
    return result
}

// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var result = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            result.append(newChar)
        } else {
            result.append(char)
        }
    }
    return result
}

// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var result = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            result.append(newChar)
        } else {
            result.append(char)
        }
    }
   
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // expected expression
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // result of call to 'lowercased()' is unused
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // cannot use optional chaining on non-optional value of type 'Bool'

func encode(message: String) -> String {
    var result = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            let newCharIndex = newChar.asciiValue! - 97
            let newChar = Character(UnicodeScalar(newCharIndex + 97)!)
            result.append(newChar)
        } else {
            result.append(char)
        }
    }
    return result
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var result = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            let newCharIndex = newChar.asciiValue! - 97
            let newChar = Character(UnicodeScalar(newCharIndex + 97)!)
            result.append(newChar)
        } else {
            result.append(char)
        }
    }
    return result
}
```
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // expected expression
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // result of call to 'lowercased()' is unused
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // cannot use optional chaining on non-optional value of type 'Bool'

func encode(message: String) -> String {
    var newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}
```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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // expected expression
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // result of call to 'lowercased()' is unused
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // cannot use optional chaining on non-optional value of type 'Bool'

func encode(message: String) -> String {
    var newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}
```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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // expected expression
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // result of call to 'lowercased()' is unused
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // cannot use optional chaining on non-optional value of type 'Bool'

func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isLetter {
            let charString = String(char)
            let encodedChar = charString.lowercased() == charString? charString.uppercased() : charString.lowercased()
            encodedMessage += encodedChar
        } else {
            encodedMessage += String(char)
        }
    }
    return encodedMessage
}
```swift
// Write a function that takes a message, and encodes in such a 
// way that it swaps case of all letters, replaces all vowels in 
// the message with the letter that appears 2 places ahead of that 
// vowel in the english alphabet. 
// Assume only letters. 
// Examples:
// encode(message: "test") == "TGST"
// encode(message: "This is a message") == "tHKS KS C MGSSCGG"
func encode(message: String) -> String {
    var encodedMessage = ""
    for char in message {
        if char.isLetter {
            let charString = String(char)
            let encodedChar = charString.lowercased() == charString? charString.uppercased() : charString.lowercased()
            encodedMessage += encodedChar
        } else {
            encodedMessage += String(char)
        }
    }
    return encodedMessage
}
```
let encodedChar = charString.lowercased() == charString? charString.uppercased() : charString.lowercased() // result of call to 'uppercased()' is unused
let encodedChar = charString.lowercased() == charString? charString.uppercased() : charString.lowercased() // consecutive statements on a line must be separated by ';'
let encodedChar = charString.lowercased() == charString? charString.uppercased() : charString.lowercased() // consecutive statements on a line must be separated by ';'
let encodedChar = charString.lowercased() == charString? charString.uppercased() : charString.lowercased() // cannot use optional chaining on non-optional value of type 'String'
let encodedChar = charString.lowercased() == charString? charString.uppercased() : charString.lowercased() // expected expression

func encode(message: String) -> String {
    var newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}
```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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}

// 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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // expected expression
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // result of call to 'lowercased()' is unused
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // cannot use optional chaining on non-optional value of type 'Bool'

func encode(message: String) -> String {
    var newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}
```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 newMessage = ""
    for char in message {
        if char.isLetter {
            let newChar = char.isUppercase? char.lowercased() : char.uppercased()
            newMessage += newChar
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}
```
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // expected expression
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // result of call to 'lowercased()' is unused
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // consecutive statements on a line must be separated by ';'
let newChar = char.isUppercase? char.lowercased() : char.uppercased() // cannot use optional chaining on non-optional value of type 'Bool'

func encode(message: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    var newMessage = ""
    for char in message {
        if vowels.contains(String(char).lowercased()) {
            let index = vowels.firstIndex(of: String(char).lowercased())!
            let newIndex = index + 2
            if newIndex >= vowels.count {
                newMessage += vowels[newIndex - vowels.count]
            } else {
                newMessage += vowels[newIndex]
            }
        } else {
            newMessage += String(char).lowercased()
        }
    }
    return newMessage
}
```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 = ["a", "e", "i", "o", "u"]
    var newMessage = ""
    for char in message {
        if vowels.contains(String(char).lowercased()) {
            let index = vowels.firstIndex(of: String(char).lowercased())!
            let newIndex = index + 2
            if newIndex >= vowels.count {
                newMessage += vowels[newIndex - vowels.count]
            } else {
                newMessage += vowels[newIndex]
            }
        } else {
            newMessage += String(char).lowercased()
        }
    }
    return newMessage
}
```
 // XCTAssertTrue failed

func encode(message: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var newMessage = ""
    for char in message.lowercased() {
        if vowels.contains(char.description) {
            let index = alphabet.index(alphabet.startIndex, offsetBy: vowels.firstIndex(of: char.description)!)
            let nextIndex = alphabet.index(index, offsetBy: 2)
            newMessage += String(alphabet[nextIndex])
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}
```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 = ["a", "e", "i", "o", "u"]
    let alphabet = "abcdefghijklmnopqrstuvwxyz"
    var newMessage = ""
    for char in message.lowercased() {
        if vowels.contains(char.description) {
            let index = alphabet.index(alphabet.startIndex, offsetBy: vowels.firstIndex(of: char.description)!)
            let nextIndex = alphabet.index(index, offsetBy: 2)
            newMessage += String(alphabet[nextIndex])
        } else {
            newMessage += String(char)
        }
    }
    return newMessage
}
```
 // XCTAssertTrue failed

func skjkasdkd(lst: [Int]) -> Int {
    let primeNumbers = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
    var maxPrime = 0
    for i in lst {
        if primeNumbers.contains(i) {
            if i > maxPrime {
                maxPrime = i
            }
        }
    }
    return maxPrime.digits.reduce(0, +)
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    let primeNumbers = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
    var maxPrime = 0
    for i in lst {
        if primeNumbers.contains(i) {
            if i > maxPrime {
                maxPrime = i
            }
        }
    }
    return maxPrime.digits.reduce(0, +)
}
```
return maxPrime.digits.reduce(0, +) // value of type 'Int' has no member 'digits'

func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    var largestPrimeSum = 0
    for number in lst {
        if number > largestPrime {
            largestPrime = number
        }
    }
    var prime = 0
    var sum = 0
    for number in lst {
        if number % largestPrime == 0 {
            prime = number
            sum = sum + number
        }
    }
    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 largestPrime = 0
    var largestPrimeSum = 0
    for number in lst {
        if number > largestPrime {
            largestPrime = number
        }
    }
    var prime = 0
    var sum = 0
    for number in lst {
        if number % largestPrime == 0 {
            prime = number
            sum = sum + number
        }
    }
    return sum
}
```
var largestPrimeSum = 0 // initialization of variable 'largestPrimeSum' was never used; consider replacing with assignment to '_' or removing it
var prime = 0 // variable 'prime' was written to, but never read
 // XCTAssertTrue failed

func skjkasdkd(lst: [Int]) -> Int {
    var maxPrime = 0
    for i in lst {
        if i > 0 {
            var prime = true
            for j in 2...i {
                if i % j == 0 && j!= i {
                    prime = false
                }
            }
            if prime {
                maxPrime = maxPrime > i? maxPrime : i
            }
        }
    }
    return 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 i > 0 {
            var prime = true
            for j in 2...i {
                if i % j == 0 && j!= i {
                    prime = false
                }
            }
            if prime {
                maxPrime = maxPrime > i? maxPrime : i
            }
        }
    }
    return maxPrime
}
```
if i % j == 0 && j!= i { // '=' must have consistent whitespace on both sides
if i % j == 0 && j!= i { // use of '=' in a boolean context, did you mean '=='?
if i % j == 0 && j!= i { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if i % j == 0 && j!= i { // cannot force unwrap value of non-optional type 'Int'
maxPrime = maxPrime > i? maxPrime : i // expected expression
maxPrime = maxPrime > i? maxPrime : i // variable is unused
maxPrime = maxPrime > i? maxPrime : i // cannot assign value of type 'Bool' to type 'Int'
maxPrime = maxPrime > i? maxPrime : i // cannot use optional chaining on non-optional value of type 'Int'
maxPrime = maxPrime > i? maxPrime : i // consecutive statements on a line must be separated by ';'
maxPrime = maxPrime > i? maxPrime : i // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
maxPrime = maxPrime > i? maxPrime : i // consecutive statements on a line must be separated by ';'

func skjkasdkd(lst: [Int]) -> Int {
    var maxPrime = 0
    var maxPrimeSum = 0
    for i in lst {
        if i == 0 {
            continue
        }
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            var sum = 0
            for k in String(i) {
                sum += Int(String(k))!
            }
            if sum > maxPrimeSum {
                maxPrimeSum = sum
                maxPrime = i
            }
        }
    }
    return maxPrimeSum
}
```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
    var maxPrimeSum = 0
    for i in lst {
        if i == 0 {
            continue
        }
        var isPrime = true
        for j in 2..<i {
            if i % j == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            var sum = 0
            for k in String(i) {
                sum += Int(String(k))!
            }
            if sum > maxPrimeSum {
                maxPrimeSum = sum
                maxPrime = i
            }
        }
    }
    return maxPrimeSum
}
```
var maxPrime = 0 // variable 'maxPrime' was written to, but never read
 // Fatal error: Range requires lowerBound <= upperBound

func skjkasdkd(lst: [Int]) -> Int {
    var maxPrime = 0
    var maxPrimeSum = 0
    for i in lst {
        if i > 0 {
            var prime = true
            for j in 2..<i {
                if i % j == 0 {
                    prime = false
                    break
                }
            }
            if prime {
                var sum = 0
                for k in String(i) {
                    sum += Int(String(k))!
                }
                if sum > maxPrimeSum {
                    maxPrimeSum = sum
                    maxPrime = i
                }
            }
        }
    }
    return maxPrimeSum
}
```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
    var maxPrimeSum = 0
    for i in lst {
        if i > 0 {
            var prime = true
            for j in 2..<i {
                if i % j == 0 {
                    prime = false
                    break
                }
            }
            if prime {
                var sum = 0
                for k in String(i) {
                    sum += Int(String(k))!
                }
                if sum > maxPrimeSum {
                    maxPrimeSum = sum
                    maxPrime = i
                }
            }
        }
    }
    return maxPrimeSum
}
```
var maxPrime = 0 // variable 'maxPrime' was written to, but never read
 // Fatal error: Range requires lowerBound <= upperBound

func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    var largestPrimeDigits = 0
    for num in lst {
        if num == 0 {
            continue
        }
        var isPrime = true
        for i in 2..<num {
            if num % i == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            largestPrime = num
            var digits = 0
            while largestPrime > 0 {
                digits += largestPrime % 10
                largestPrime /= 10
            }
            if digits > largestPrimeDigits {
                largestPrimeDigits = digits
            }
        }
    }
    return largestPrimeDigits
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    var largestPrimeDigits = 0
    for num in lst {
        if num == 0 {
            continue
        }
        var isPrime = true
        for i in 2..<num {
            if num % i == 0 {
                isPrime = false
                break
            }
        }
        if isPrime {
            largestPrime = num
            var digits = 0
            while largestPrime > 0 {
                digits += largestPrime % 10
                largestPrime /= 10
            }
            if digits > largestPrimeDigits {
                largestPrimeDigits = digits
            }
        }
    }
    return largestPrimeDigits
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func skjkasdkd(lst: [Int]) -> Int {
    var result = 0
    var maxPrime = 0
    for i in lst {
        if i > 0 {
            var isPrime = true
            for j in 2...i/2 {
                if i % j == 0 {
                    isPrime = false
                    break
                }
            }
            if isPrime {
                if i > maxPrime {
                    maxPrime = i
                }
            }
        }
    }
    while maxPrime > 0 {
        result += maxPrime % 10
        maxPrime /= 10
    }
    return result
}
```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 result = 0
    var maxPrime = 0
    for i in lst {
        if i > 0 {
            var isPrime = true
            for j in 2...i/2 {
                if i % j == 0 {
                    isPrime = false
                    break
                }
            }
            if isPrime {
                if i > maxPrime {
                    maxPrime = i
                }
            }
        }
    }
    while maxPrime > 0 {
        result += maxPrime % 10
        maxPrime /= 10
    }
    return result
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func skjkasdkd(lst: [Int]) -> Int {
    var maxPrime = 0
    for num in lst {
        if num > 1 {
            var isPrime = true
            for i in 2..<num {
                if num % i == 0 {
                    isPrime = false
                    break
                }
            }
            if isPrime {
                maxPrime = max(maxPrime, num)
            }
        }
    }
    return maxPrime.description.reduce(0, { $0 + Int(String($1))! })
}
```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 num in lst {
        if num > 1 {
            var isPrime = true
            for i in 2..<num {
                if num % i == 0 {
                    isPrime = false
                    break
                }
            }
            if isPrime {
                maxPrime = max(maxPrime, num)
            }
        }
    }
    return maxPrime.description.reduce(0, { $0 + Int(String($1))! })
}
```

func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for i in lst {
        if i > 0 {
            var isPrime = true
            for j in 2..<i {
                if i % j == 0 {
                    isPrime = false
                }
            }
            if isPrime {
                largestPrime = i
            }
        }
    }
    return largestPrime
}
```swift
// You are given an array of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// skjkasdkd(lst: [0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
// skjkasdkd(lst: [1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
// skjkasdkd(lst: [1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
// skjkasdkd(lst: [0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
// skjkasdkd(lst: [0, 81, 12, 3, 1, 21]) == 3
// skjkasdkd(lst: [0, 8, 1, 2, 1, 7]) == 7
func skjkasdkd(lst: [Int]) -> Int {
    var largestPrime = 0
    for i in lst {
        if i > 0 {
            var isPrime = true
            for j in 2..<i {
                if i % j == 0 {
                    isPrime = false
                }
            }
            if isPrime {
                largestPrime = i
            }
        }
    }
    return largestPrime
}
```
 // Fatal error: Range requires lowerBound <= upperBound

func skjkasdkd(lst: [Int]) -> Int {
    let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 }
    let sum = prime.reduce(0, +)
    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 prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 }
    let sum = prime.reduce(0, +)
    return sum
}
```
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // '=' must have consistent whitespace on both sides
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // '=' must have consistent whitespace on both sides
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // cannot force unwrap value of non-optional type 'Int'
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // '=' must have consistent whitespace on both sides
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // cannot force unwrap value of non-optional type 'Int'
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // expression is not assignable: binary operator returns immutable value
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // expression is not assignable: binary operator returns immutable value
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // cannot force unwrap value of non-optional type 'Int'
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // '=' must have consistent whitespace on both sides
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // expression is not assignable: binary operator returns immutable value
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // cannot force unwrap value of non-optional type 'Int'
let prime = lst.filter { $0 > 1 }.filter { $0 % 2!= 0 }.filter { $0 % 3!= 0 }.filter { $0 % 5!= 0 }.filter { $0 % 7!= 0 } // expression is not assignable: binary operator returns immutable value

func countUpTo(n: Int) -> [Int] {
    var primeNumbers: [Int] = []
    for i in 2...n {
        if isPrime(number: i) {
            primeNumbers.append(i)
        }
    }
    return primeNumbers
}

func isPrime(number: Int) -> Bool {
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primeNumbers: [Int] = []
    for i in 2...n {
        if isPrime(number: i) {
            primeNumbers.append(i)
        }
    }
    return primeNumbers
}

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

func countUpTo(n: Int) -> [Int] {
    var primes: [Int] = []
    var i = 2
    while i <= n {
        if isPrime(i) {
            primes.append(i)
        }
        i += 1
    }
    return primes
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primes: [Int] = []
    var i = 2
    while i <= n {
        if isPrime(i) {
            primes.append(i)
        }
        i += 1
    }
    return primes
}

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

func countUpTo(n: Int) -> [Int] {
    var primes: [Int] = []
    for i in 2...n {
        if isPrime(i) {
            primes.append(i)
        }
    }
    return primes
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 { return false }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primes: [Int] = []
    for i in 2...n {
        if isPrime(i) {
            primes.append(i)
        }
    }
    return primes
}

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

func countUpTo(n: Int) -> [Int] {
    var primeNumbers = [Int]()
    var i = 2
    while i <= n {
        if isPrime(number: i) {
            primeNumbers.append(i)
        }
        i += 1
    }
    return primeNumbers
}

func isPrime(number: Int) -> Bool {
    if number < 2 {
        return false
    }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primeNumbers = [Int]()
    var i = 2
    while i <= n {
        if isPrime(number: i) {
            primeNumbers.append(i)
        }
        i += 1
    }
    return primeNumbers
}

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

func countUpTo(n: Int) -> [Int] {
    var result = [Int]()
    var i = 2
    while i < n {
        if isPrime(i) {
            result.append(i)
        }
        i += 1
    }
    return result
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    var i = 2
    while i < n {
        if n % i == 0 {
            return false
        }
        i += 1
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var result = [Int]()
    var i = 2
    while i < n {
        if isPrime(i) {
            result.append(i)
        }
        i += 1
    }
    return result
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    var i = 2
    while i < n {
        if n % i == 0 {
            return false
        }
        i += 1
    }
    return true
}

countUpTo(n: 5)
countUpTo(n: 11)
countUpTo(n: 0)
countUpTo(n: 20)
countUpTo(n: 1)
countUpTo(n: 18)
```

func countUpTo(n: Int) -> [Int] {
    var result: [Int] = []
    var i = 2
    while i <= n {
        if isPrime(i) {
            result.append(i)
        }
        i += 1
    }
    return result
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    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
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var result: [Int] = []
    var i = 2
    while i <= n {
        if isPrime(i) {
            result.append(i)
        }
        i += 1
    }
    return result
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    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 countUpTo(n: Int) -> [Int] {
    var primeNumbers = [Int]()
    var i = 2
    while i < n {
        if isPrime(n: i) {
            primeNumbers.append(i)
        }
        i += 1
    }
    return primeNumbers
}

func isPrime(n: Int) -> Bool {
    var i = 2
    while i < n {
        if n % i == 0 {
            return false
        }
        i += 1
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primeNumbers = [Int]()
    var i = 2
    while i < n {
        if isPrime(n: i) {
            primeNumbers.append(i)
        }
        i += 1
    }
    return primeNumbers
}

func isPrime(n: Int) -> Bool {
    var i = 2
    while i < n {
        if n % i == 0 {
            return false
        }
        i += 1
    }
    return true
}
```

func countUpTo(n: Int) -> [Int] {
    var primes: [Int] = []
    var i = 2
    while i < n {
        if isPrime(i) {
            primes.append(i)
        }
        i += 1
    }
    return primes
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primes: [Int] = []
    var i = 2
    while i < n {
        if isPrime(i) {
            primes.append(i)
        }
        i += 1
    }
    return primes
}

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

func countUpTo(n: Int) -> [Int] {
    var primeNumbers: [Int] = []
    var i = 2
    while i <= n {
        if isPrime(i) {
            primeNumbers.append(i)
        }
        i += 1
    }
    return primeNumbers
}

func isPrime(_ n: Int) -> Bool {
    if n == 1 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primeNumbers: [Int] = []
    var i = 2
    while i <= n {
        if isPrime(i) {
            primeNumbers.append(i)
        }
        i += 1
    }
    return primeNumbers
}

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

func countUpTo(n: Int) -> [Int] {
    var primeNumbers: [Int] = []
    var number = 2
    while primeNumbers.count < n {
        if isPrime(number: number) {
            primeNumbers.append(number)
        }
        number += 1
    }
    return primeNumbers
}

func isPrime(number: Int) -> Bool {
    if number == 2 {
        return true
    }
    for i in 2..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// countUpTo(n: 5) == [2, 3]
// countUpTo(n: 11) == [2, 3, 5, 7]
// countUpTo(n: 0) == [] as [Int]
// countUpTo(n: 20) == [2, 3, 5, 7, 11, 13, 17, 19]
// countUpTo(n: 1) == [] as [Int]
// countUpTo(n: 18) == [2, 3, 5, 7, 11, 13, 17]
func countUpTo(n: Int) -> [Int] {
    var primeNumbers: [Int] = []
    var number = 2
    while primeNumbers.count < n {
        if isPrime(number: number) {
            primeNumbers.append(number)
        }
        number += 1
    }
    return primeNumbers
}

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

func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```
 // XCTAssertTrue failed

func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```swift
// Complete the function that takes two integers and returns 
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// multiply(a: 148, b: 412) == 16
// multiply(a: 19, b: 28) == 72
// multiply(a: 2020, b: 1851) == 0
// multiply(a: 14, b: -15) == 20
func multiply(a: Int, b: Int) -> Int {
    return (a % 10) * (b % 10)
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    return s.filter { $0.isUppercase }.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 {
    return s.filter { $0.isUppercase }.count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    return s.filter { $0.isUppercase }.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 {
    return s.filter { $0.isUppercase }.count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    return s.filter { $0.isUppercase }.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 {
    return s.filter { $0.isUppercase }.count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    return s.filter { $0.isUppercase }.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 {
    return s.filter { $0.isUppercase }.count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    return s.filter { $0.isUppercase }.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 {
    return s.filter { $0.isUppercase }.count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    return s.filter { $0.isUppercase }.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 {
    return s.filter { $0.isUppercase }.count
}
```
 // XCTAssertTrue failed

func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```swift
// Given a string s, count the number of uppercase vowels in even indices.
// For example:
// countUpper(s: "aBCdEf") == 1
// countUpper(s: "abcdefg") == 0
// countUpper(s: "dBBE") == 0
func countUpper(s: String) -> Int {
    var count = 0
    for (index, char) in s.enumerated() {
        if index % 2 == 0 && char.isUppercase {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func closestInteger(value: String) -> Int {
    let number = Double(value)?? 0
    let floor = floor(number)
    let ceil = ceil(number)
    let diffFloor = abs(number - floor)
    let diffCeil = abs(number - ceil)
    return diffFloor < diffCeil? Int(floor) : Int(ceil)
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let number = Double(value)?? 0
    let floor = floor(number)
    let ceil = ceil(number)
    let diffFloor = abs(number - floor)
    let diffCeil = abs(number - ceil)
    return diffFloor < diffCeil? Int(floor) : Int(ceil)
}
```
let number = Double(value)?? 0 // consecutive statements on a line must be separated by ';'
let number = Double(value)?? 0 // integer literal is unused
let number = Double(value)?? 0 // cannot use optional chaining on non-optional value of type 'Double'
let diffFloor = abs(number - floor) // cannot convert value of type 'Duration' to expected argument type 'Int32'
let diffCeil = abs(number - ceil) // cannot convert value of type 'Duration' to expected argument type 'Int32'
return diffFloor < diffCeil? Int(floor) : Int(ceil) // consecutive statements on a line must be separated by ';'
return diffFloor < diffCeil? Int(floor) : Int(ceil) // value of optional type 'Optional<_>' must be unwrapped to a value of type '_'
return diffFloor < diffCeil? Int(floor) : Int(ceil) // cannot convert return expression of type 'Bool' to return type 'Int'
return diffFloor < diffCeil? Int(floor) : Int(ceil) // consecutive statements on a line must be separated by ';'
return diffFloor < diffCeil? Int(floor) : Int(ceil) // expected expression

func closestInteger(value: String) -> Int {
    let number = Double(value)?? 0
    return Int(round(number))
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let number = Double(value)?? 0
    return Int(round(number))
}
```
let number = Double(value)?? 0 // cannot use optional chaining on non-optional value of type 'Double'
let number = Double(value)?? 0 // consecutive statements on a line must be separated by ';'
let number = Double(value)?? 0 // integer literal is unused

func closestInteger(value: String) -> Int {
    let number = Double(value)
    let floor = floor(number!)
    let ceil = ceil(number!)
    let diffFloor = abs(number! - floor)
    let diffCeil = abs(number! - ceil)
    return diffFloor < diffCeil? Int(floor) : Int(ceil)
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let number = Double(value)
    let floor = floor(number!)
    let ceil = ceil(number!)
    let diffFloor = abs(number! - floor)
    let diffCeil = abs(number! - ceil)
    return diffFloor < diffCeil? Int(floor) : Int(ceil)
}
```
return diffFloor < diffCeil? Int(floor) : Int(ceil) // consecutive statements on a line must be separated by ';'
return diffFloor < diffCeil? Int(floor) : Int(ceil) // cannot use optional chaining on non-optional value of type 'Double'
return diffFloor < diffCeil? Int(floor) : Int(ceil) // result of 'Int' initializer is unused
return diffFloor < diffCeil? Int(floor) : Int(ceil) // cannot convert return expression of type 'Bool' to return type 'Int'
return diffFloor < diffCeil? Int(floor) : Int(ceil) // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
return diffFloor < diffCeil? Int(floor) : Int(ceil) // consecutive statements on a line must be separated by ';'
return diffFloor < diffCeil? Int(floor) : Int(ceil) // expected expression

func closestInteger(value: String) -> Int {
    return Int(value)!
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    return Int(value)!
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func closestInteger(value: String) -> Int {
    let doubleValue = Double(value)!
    let intValue = Int(doubleValue)
    let diff1 = abs(doubleValue - Double(intValue))
    let diff2 = abs(doubleValue - Double(intValue + 1))
    return diff1 < diff2? intValue : intValue + 1
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let doubleValue = Double(value)!
    let intValue = Int(doubleValue)
    let diff1 = abs(doubleValue - Double(intValue))
    let diff2 = abs(doubleValue - Double(intValue + 1))
    return diff1 < diff2? intValue : intValue + 1
}
```
return diff1 < diff2? intValue : intValue + 1 // consecutive statements on a line must be separated by ';'
return diff1 < diff2? intValue : intValue + 1 // cannot use optional chaining on non-optional value of type 'Double'
return diff1 < diff2? intValue : intValue + 1 // cannot convert return expression of type 'Bool' to return type 'Int'
return diff1 < diff2? intValue : intValue + 1 // expected expression
return diff1 < diff2? intValue : intValue + 1 // expression of type 'Int' is unused
return diff1 < diff2? intValue : intValue + 1 // consecutive statements on a line must be separated by ';'
return diff1 < diff2? intValue : intValue + 1 // value of optional type 'Double?' must be unwrapped to a value of type 'Double'

func closestInteger(value: String) -> Int {
    return Int(value)!
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    return Int(value)!
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func closestInteger(value: String) -> Int {
    return Int(value)!
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    return Int(value)!
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func closestInteger(value: String) -> Int {
    let num = Double(value)?? 0
    let floor = floor(num)
    let ceil = ceil(num)
    let diff1 = abs(num - floor)
    let diff2 = abs(num - ceil)
    return diff1 < diff2? Int(floor) : Int(ceil)
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    let num = Double(value)?? 0
    let floor = floor(num)
    let ceil = ceil(num)
    let diff1 = abs(num - floor)
    let diff2 = abs(num - ceil)
    return diff1 < diff2? Int(floor) : Int(ceil)
}
```
let num = Double(value)?? 0 // integer literal is unused
let num = Double(value)?? 0 // cannot use optional chaining on non-optional value of type 'Double'
let num = Double(value)?? 0 // consecutive statements on a line must be separated by ';'
let diff1 = abs(num - floor) // cannot convert value of type 'Duration' to expected argument type 'Int32'
let diff2 = abs(num - ceil) // cannot convert value of type 'Duration' to expected argument type 'Int32'
return diff1 < diff2? Int(floor) : Int(ceil) // cannot convert return expression of type 'Bool' to return type 'Int'
return diff1 < diff2? Int(floor) : Int(ceil) // expected expression
return diff1 < diff2? Int(floor) : Int(ceil) // value of optional type 'Optional<_>' must be unwrapped to a value of type '_'
return diff1 < diff2? Int(floor) : Int(ceil) // consecutive statements on a line must be separated by ';'
return diff1 < diff2? Int(floor) : Int(ceil) // consecutive statements on a line must be separated by ';'

func closestInteger(value: String) -> Int {
    return Int(value)!
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    return Int(value)!
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func closestInteger(value: String) -> Int {
    return Int(value)!
}
```swift
// Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// Note:
// Rounding away from zero means that if the given number is equidistant
// from two integers, the one you should return is the one that is the
// farthest from zero. For example closest_integer("14.5") should
// return 15 and closest_integer("-14.5") should return -15.
// closestInteger(value: "10") == 10
// closestInteger(value: "15.3") == 15
func closestInteger(value: String) -> Int {
    return Int(value)!
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var stones = n
    for i in 1...n {
        result.append(stones)
        stones = stones % 2 == 0? stones / 2 : (stones + 1) / 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 stones = n
    for i in 1...n {
        result.append(stones)
        stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2
    }
    return result
}
```
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // result of operator '/' is unused
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // cannot use optional chaining on non-optional value of type 'Int'
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // consecutive statements on a line must be separated by ';'
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // expected expression
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // consecutive statements on a line must be separated by ';'
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // cannot assign value of type 'Bool' to type 'Int'

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = 1
    var stones = n
    while stones > 0 {
        result.append(stones)
        stones = level.nextOdd()
        level += 1
    }
    return result
}

extension Int {
    func nextOdd() -> Int {
        return self % 2 == 0? self + 1 : self
    }
}
```swift
// Given a positive integer n, you have to make a pile of n levels of stones.
// The first level has n stones.
// The number of stones in the next level is:
// - the next odd number if n is odd.
// - the next even number if n is even.
// Return the number of stones in each level in an array, where element at index
// i represents the number of stones in the level (i+1).
// Examples:
// makeAPile(n: 3) == [3, 5, 7]
func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var level = 1
    var stones = n
    while stones > 0 {
        result.append(stones)
        stones = level.nextOdd()
        level += 1
    }
    return result
}

extension Int {
    func nextOdd() -> Int {
        return self % 2 == 0? self + 1 : self
    }
}
```
return self % 2 == 0? self + 1 : self // consecutive statements on a line must be separated by ';'
return self % 2 == 0? self + 1 : self // consecutive statements on a line must be separated by ';'
return self % 2 == 0? self + 1 : self // cannot use optional chaining on non-optional value of type 'Int'
return self % 2 == 0? self + 1 : self // result of operator '+' is unused
return self % 2 == 0? self + 1 : self // expected expression
return self % 2 == 0? self + 1 : self // cannot convert return expression of type 'Bool' to return type 'Int'

func makeAPile(n: Int) -> [Int] {
    var result = [Int]()
    var stones = n
    for i in 1...n {
        result.append(stones)
        stones = stones % 2 == 0? stones / 2 : (stones + 1) / 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 stones = n
    for i in 1...n {
        result.append(stones)
        stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2
    }
    return result
}
```
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // result of operator '/' is unused
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // cannot use optional chaining on non-optional value of type 'Int'
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // consecutive statements on a line must be separated by ';'
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // expected expression
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // consecutive statements on a line must be separated by ';'
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // cannot assign value of type 'Bool' to type 'Int'

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

func makeAPile(n: Int) -> [Int] {
    var pile = [Int]()
    var stones = n
    while stones > 0 {
        pile.append(stones)
        stones = stones % 2 == 0? stones / 2 : (stones + 1) / 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 stones = n
    while stones > 0 {
        pile.append(stones)
        stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2
    }
    return pile
}
```
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // result of operator '/' is unused
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // cannot use optional chaining on non-optional value of type 'Int'
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // consecutive statements on a line must be separated by ';'
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // expected expression
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // consecutive statements on a line must be separated by ';'
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // cannot assign value of type 'Bool' to type 'Int'

func makeAPile(n: Int) -> [Int] {
  var result = [Int]()
  var stones = n
  while stones > 0 {
    result.append(stones)
    stones = (stones % 2 == 0)? stones / 2 : (stones + 1) / 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 stones = n
  while stones > 0 {
    result.append(stones)
    stones = (stones % 2 == 0)? stones / 2 : (stones + 1) / 2
  }
  return result
}
```
stones = (stones % 2 == 0)? stones / 2 : (stones + 1) / 2 // cannot use optional chaining on non-optional value of type 'Bool'
stones = (stones % 2 == 0)? stones / 2 : (stones + 1) / 2 // result of operator '/' is unused
stones = (stones % 2 == 0)? stones / 2 : (stones + 1) / 2 // consecutive statements on a line must be separated by ';'
stones = (stones % 2 == 0)? stones / 2 : (stones + 1) / 2 // consecutive statements on a line must be separated by ';'
stones = (stones % 2 == 0)? stones / 2 : (stones + 1) / 2 // expected expression
stones = (stones % 2 == 0)? stones / 2 : (stones + 1) / 2 // cannot assign value of type 'Bool?' to type 'Int'

func makeAPile(n: Int) -> [Int] {
    var result: [Int] = []
    var stones = n
    while stones > 0 {
        result.append(stones)
        stones = stones % 2 == 0? stones / 2 : (stones + 1) / 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 stones = n
    while stones > 0 {
        result.append(stones)
        stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2
    }
    return result
}
```
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // result of operator '/' is unused
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // cannot use optional chaining on non-optional value of type 'Int'
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // consecutive statements on a line must be separated by ';'
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // expected expression
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // consecutive statements on a line must be separated by ';'
stones = stones % 2 == 0? stones / 2 : (stones + 1) / 2 // cannot assign value of type 'Bool' to type 'Int'

func makeAPile(n: Int) -> [Int] {
    return (1...n).map {
        $0 % 2 == 0? $0 * 2 + 1 : $0 * 2
    }
}
```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] {
    return (1...n).map {
        $0 % 2 == 0? $0 * 2 + 1 : $0 * 2
    }
}
```
$0 % 2 == 0? $0 * 2 + 1 : $0 * 2 // expected expression
$0 % 2 == 0? $0 * 2 + 1 : $0 * 2 // consecutive statements on a line must be separated by ';'
$0 % 2 == 0? $0 * 2 + 1 : $0 * 2 // cannot use optional chaining on non-optional value of type 'Int'
$0 % 2 == 0? $0 * 2 + 1 : $0 * 2 // consecutive statements on a line must be separated by ';'

func makeAPile(n: Int) -> [Int] {
    var pile = [Int]()
    var stones = n
    for i in 1...n {
        if i % 2 == 1 {
            stones = stones + 1
        } else {
            stones = stones + 2
        }
        pile.append(stones)
    }
    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 stones = n
    for i in 1...n {
        if i % 2 == 1 {
            stones = stones + 1
        } else {
            stones = stones + 2
        }
        pile.append(stones)
    }
    return pile
}
```
 // XCTAssertTrue failed

func makeAPile(n: Int) -> [Int] {
    return (1...n).map {
        if $0 % 2 == 0 {
            return $0 * 2 - 1
        } else {
            return $0 * 2
        }
    }
}
```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] {
    return (1...n).map {
        if $0 % 2 == 0 {
            return $0 * 2 - 1
        } else {
            return $0 * 2
        }
    }
}
```
 // 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] {
    return s.components(separatedBy: ",")
}
```swift
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array of the words.
// For example:
// wordsString(s: "Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
// wordsString(s: "One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ",")
}
```
 // XCTAssertTrue failed

func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ",")
}
```swift
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array of the words.
// For example:
// wordsString(s: "Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
// wordsString(s: "One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]
func wordsString(s: String) -> [String] {
    return s.components(separatedBy: ",")
}
```
 // XCTAssertTrue failed

func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```swift
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusive. If 
// there's no such number, then the function should return -1.
// For example:
// chooseNum(x: 12, y: 15) == 14
// chooseNum(x: 13, y: 12) == -1
func chooseNum(x: Int, y: Int) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return.failure(-1) }
    let avg = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(), radix: 2))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return.failure(-1) }
    let avg = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(), radix: 2))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return.success(String(avg.rounded(), radix: 2)) // initializer 'init(_:radix:uppercase:)' requires that 'Double' conform to 'BinaryInteger'

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 = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(), radix: 2))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return.failure(-1) }
    let avg = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(), radix: 2))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return.success(String(avg.rounded(), radix: 2)) // initializer 'init(_:radix:uppercase:)' requires that 'Double' conform to 'BinaryInteger'

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 = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(), radix: 2))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return.failure(-1) }
    let avg = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(), radix: 2))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return.success(String(avg.rounded(), radix: 2)) // initializer 'init(_:radix:uppercase:)' requires that 'Double' conform to 'BinaryInteger'

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 = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(), radix: 2))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return.failure(-1) }
    let avg = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(), radix: 2))
}

roundedAvg(n: 1, m: 5)
roundedAvg(n: 7, m: 5)
roundedAvg(n: 10, m: 20)
roundedAvg(n: 20, m: 33)
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return.success(String(avg.rounded(), radix: 2)) // initializer 'init(_:radix:uppercase:)' requires that 'Double' conform to 'BinaryInteger'

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 = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(.toNearestOrAwayFromZero), radix: 2))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return.failure(-1) }
    let avg = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(.toNearestOrAwayFromZero), radix: 2))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return.success(String(avg.rounded(.toNearestOrAwayFromZero), radix: 2)) // initializer 'init(_:radix:uppercase:)' requires that 'Double' conform to 'BinaryInteger'

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 = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(), radix: 2))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return.failure(-1) }
    let avg = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(), radix: 2))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return.success(String(avg.rounded(), radix: 2)) // initializer 'init(_:radix:uppercase:)' requires that 'Double' conform to 'BinaryInteger'

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 = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(), radix: 2))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return.failure(-1) }
    let avg = (Double(n) + Double(m)) / 2
    return.success(String(avg.rounded(), radix: 2))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return.success(String(avg.rounded(), radix: 2)) // initializer 'init(_:radix:uppercase:)' requires that 'Double' conform to 'BinaryInteger'

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else {
        return.failure(-1)
    }
    let average = (n + m) / 2
    return.success(String(average, radix: 2))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else {
        return.failure(-1)
    }
    let average = (n + m) / 2
    return.success(String(average, radix: 2))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return.failure(-1) }
    let avg = (n + m) / 2
    return.success(String(avg, radix: 2))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return.failure(-1) }
    let avg = (n + m) / 2
    return.success(String(avg, radix: 2))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'

extension Int: Error {

}

extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return.failure(-1) }
    let avg = (Double(n) + Double(m)) / 2
    let rounded = Int(avg.rounded())
    return.success(String(rounded, radix: 2))
}
```swift
extension Int: Error {}

// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m). 
// Round the answer to the nearest integer and convert that to binary.
// If n is greater than m, return -1.
// Example:
// roundedAvg(n: 1, m: 5) ==.success("0b11")
// roundedAvg(n: 7, m: 5) ==.failure(-1)
// roundedAvg(n: 10, m: 20) ==.success("0b1111")
// roundedAvg(n: 20, m: 33) ==.success("0b11010")
func roundedAvg(n: Int, m: Int) -> Result<String, Int> {
    guard n <= m else { return.failure(-1) }
    let avg = (Double(n) + Double(m)) / 2
    let rounded = Int(avg.rounded())
    return.success(String(rounded, radix: 2))
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        if i % 2!= 0 {
            result.append(i)
        }
    }
    return result.sorted()
}
```swift
// Given an array of positive integers x. return a sorted array of all 
// elements that hasn't any even digit.
// Note: Returned array should be sorted in increasing order.
// For example:
// uniqueDigits(x: [15, 33, 1422, 1]) == [1, 15, 33]
// uniqueDigits(x: [152, 323, 1422, 10]) == [] as [Int]
func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        if i % 2!= 0 {
            result.append(i)
        }
    }
    return result.sorted()
}
```
if i % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if i % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if i % 2!= 0 { // '=' must have consistent whitespace on both sides

func uniqueDigits(x: [Int]) -> [Int] {
    // Write your code here
}
```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] {
    // Write your code here
}
```
} // missing return in global function expected to return '[Int]'

func uniqueDigits(x: [Int]) -> [Int] {
    return x.filter { $0 % 2!= 0 }
}
```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] {
    return x.filter { $0 % 2!= 0 }
}
```
return x.filter { $0 % 2!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
return x.filter { $0 % 2!= 0 } // expression is not assignable: binary operator returns immutable value
return x.filter { $0 % 2!= 0 } // cannot force unwrap value of non-optional type 'Int'
return x.filter { $0 % 2!= 0 } // '=' must have consistent whitespace on both sides

func uniqueDigits(x: [Int]) -> [Int] {
    return x.filter { $0 % 2!= 0 }
}
```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] {
    return x.filter { $0 % 2!= 0 }
}
```
return x.filter { $0 % 2!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
return x.filter { $0 % 2!= 0 } // expression is not assignable: binary operator returns immutable value
return x.filter { $0 % 2!= 0 } // cannot force unwrap value of non-optional type 'Int'
return x.filter { $0 % 2!= 0 } // '=' must have consistent whitespace on both sides

func uniqueDigits(x: [Int]) -> [Int] {
    // Write your code here
}
```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] {
    // Write your code here
}
```
} // missing return in global function expected to return '[Int]'

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        if i % 2!= 0 {
            result.append(i)
        }
    }
    return result.sorted()
}
```swift
// Given an array of positive integers x. return a sorted array of all 
// elements that hasn't any even digit.
// Note: Returned array should be sorted in increasing order.
// For example:
// uniqueDigits(x: [15, 33, 1422, 1]) == [1, 15, 33]
// uniqueDigits(x: [152, 323, 1422, 10]) == [] as [Int]
func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        if i % 2!= 0 {
            result.append(i)
        }
    }
    return result.sorted()
}
```
if i % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if i % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if i % 2!= 0 { // '=' must have consistent whitespace on both sides

func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        if i % 2!= 0 {
            result.append(i)
        }
    }
    return result
}
```swift
// Given an array of positive integers x. return a sorted array of all 
// elements that hasn't any even digit.
// Note: Returned array should be sorted in increasing order.
// For example:
// uniqueDigits(x: [15, 33, 1422, 1]) == [1, 15, 33]
// uniqueDigits(x: [152, 323, 1422, 10]) == [] as [Int]
func uniqueDigits(x: [Int]) -> [Int] {
    var result = [Int]()
    for i in x {
        if i % 2!= 0 {
            result.append(i)
        }
    }
    return result
}
```
if i % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if i % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if i % 2!= 0 { // '=' must have consistent whitespace on both sides

func uniqueDigits(x: [Int]) -> [Int] {
    return x.filter { $0 % 2!= 0 }
}
```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] {
    return x.filter { $0 % 2!= 0 }
}
```
return x.filter { $0 % 2!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
return x.filter { $0 % 2!= 0 } // expression is not assignable: binary operator returns immutable value
return x.filter { $0 % 2!= 0 } // cannot force unwrap value of non-optional type 'Int'
return x.filter { $0 % 2!= 0 } // '=' must have consistent whitespace on both sides

func uniqueDigits(x: [Int]) -> [Int] {
    return x.filter { $0 % 2!= 0 }
}
```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] {
    return x.filter { $0 % 2!= 0 }
}
```
return x.filter { $0 % 2!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
return x.filter { $0 % 2!= 0 } // expression is not assignable: binary operator returns immutable value
return x.filter { $0 % 2!= 0 } // cannot force unwrap value of non-optional type 'Int'
return x.filter { $0 % 2!= 0 } // '=' must have consistent whitespace on both sides

func uniqueDigits(x: [Int]) -> [Int] {
    return x.filter { $0 % 2!= 0 }
}
```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] {
    return x.filter { $0 % 2!= 0 }
}
```
return x.filter { $0 % 2!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
return x.filter { $0 % 2!= 0 } // expression is not assignable: binary operator returns immutable value
return x.filter { $0 % 2!= 0 } // cannot force unwrap value of non-optional type 'Int'
return x.filter { $0 % 2!= 0 } // '=' must have consistent whitespace on both sides

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    for number in arr {
        if number >= 1 && number <= 9 {
            result.append(String(number))
        }
    }
    result.reverse()
    for (index, number) in result.enumerate() {
        result[index] = number.stringByReplacingOccurrencesOfString("1", withString: "One")
        result[index] = result[index].stringByReplacingOccurrencesOfString("2", withString: "Two")
        result[index] = result[index].stringByReplacingOccurrencesOfString("3", withString: "Three")
        result[index] = result[index].stringByReplacingOccurrencesOfString("4", withString: "Four")
        result[index] = result[index].stringByReplacingOccurrencesOfString("5", withString: "Five")
        result[index] = result[index].stringByReplacingOccurrencesOfString("6", withString: "Six")
        result[index] = result[index].stringByReplacingOccurrencesOfString("7", withString: "Seven")
        result[index] = result[index].stringByReplacingOccurrencesOfString("8", withString: "Eight")
        result[index] = result[index].stringByReplacingOccurrencesOfString("9", withString: "Nine")
    }
    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 number in arr {
        if number >= 1 && number <= 9 {
            result.append(String(number))
        }
    }
    result.reverse()
    for (index, number) in result.enumerate() {
        result[index] = number.stringByReplacingOccurrencesOfString("1", withString: "One")
        result[index] = result[index].stringByReplacingOccurrencesOfString("2", withString: "Two")
        result[index] = result[index].stringByReplacingOccurrencesOfString("3", withString: "Three")
        result[index] = result[index].stringByReplacingOccurrencesOfString("4", withString: "Four")
        result[index] = result[index].stringByReplacingOccurrencesOfString("5", withString: "Five")
        result[index] = result[index].stringByReplacingOccurrencesOfString("6", withString: "Six")
        result[index] = result[index].stringByReplacingOccurrencesOfString("7", withString: "Seven")
        result[index] = result[index].stringByReplacingOccurrencesOfString("8", withString: "Eight")
        result[index] = result[index].stringByReplacingOccurrencesOfString("9", withString: "Nine")
    }
    return result
}
```
for (index, number) in result.enumerate() { // value of type '[String]' has no member 'enumerate'

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    for number in arr {
        if number < 1 || number > 9 {
            continue
        }
        result.append(String(number))
    }
    result.reverse()
    for (index, number) in result.enumerate() {
        result[index] = number.stringByReplacingOccurrencesOfString("1", withString: "One")
        result[index] = result[index].stringByReplacingOccurrencesOfString("2", withString: "Two")
        result[index] = result[index].stringByReplacingOccurrencesOfString("3", withString: "Three")
        result[index] = result[index].stringByReplacingOccurrencesOfString("4", withString: "Four")
        result[index] = result[index].stringByReplacingOccurrencesOfString("5", withString: "Five")
        result[index] = result[index].stringByReplacingOccurrencesOfString("6", withString: "Six")
        result[index] = result[index].stringByReplacingOccurrencesOfString("7", withString: "Seven")
        result[index] = result[index].stringByReplacingOccurrencesOfString("8", withString: "Eight")
        result[index] = result[index].stringByReplacingOccurrencesOfString("9", withString: "Nine")
    }
    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 number in arr {
        if number < 1 || number > 9 {
            continue
        }
        result.append(String(number))
    }
    result.reverse()
    for (index, number) in result.enumerate() {
        result[index] = number.stringByReplacingOccurrencesOfString("1", withString: "One")
        result[index] = result[index].stringByReplacingOccurrencesOfString("2", withString: "Two")
        result[index] = result[index].stringByReplacingOccurrencesOfString("3", withString: "Three")
        result[index] = result[index].stringByReplacingOccurrencesOfString("4", withString: "Four")
        result[index] = result[index].stringByReplacingOccurrencesOfString("5", withString: "Five")
        result[index] = result[index].stringByReplacingOccurrencesOfString("6", withString: "Six")
        result[index] = result[index].stringByReplacingOccurrencesOfString("7", withString: "Seven")
        result[index] = result[index].stringByReplacingOccurrencesOfString("8", withString: "Eight")
        result[index] = result[index].stringByReplacingOccurrencesOfString("9", withString: "Nine")
    }
    return result
}
```
for (index, number) in result.enumerate() { // value of type '[String]' has no member 'enumerate'

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

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

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    for number in arr {
        if number > 0 && number < 10 {
            result.append(String(number))
        }
    }
    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 number in arr {
        if number > 0 && number < 10 {
            result.append(String(number))
        }
    }
    return result.reversed()
}
```
 // XCTAssertTrue failed

func byLength(arr: [Int]) -> [String] {
    let result = arr.filter { $0 > 0 && $0 < 10 }
       .sorted { $0 > $1 }
       .reversed()
       .map { String($0) }
       .map { $0.replacingOccurrences(of: "1", with: "One") }
       .map { $0.replacingOccurrences(of: "2", with: "Two") }
       .map { $0.replacingOccurrences(of: "3", with: "Three") }
       .map { $0.replacingOccurrences(of: "4", with: "Four") }
       .map { $0.replacingOccurrences(of: "5", with: "Five") }
       .map { $0.replacingOccurrences(of: "6", with: "Six") }
       .map { $0.replacingOccurrences(of: "7", with: "Seven") }
       .map { $0.replacingOccurrences(of: "8", with: "Eight") }
       .map { $0.replacingOccurrences(of: "9", with: "Nine") }
    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 result = arr.filter { $0 > 0 && $0 < 10 }
       .sorted { $0 > $1 }
       .reversed()
       .map { String($0) }
       .map { $0.replacingOccurrences(of: "1", with: "One") }
       .map { $0.replacingOccurrences(of: "2", with: "Two") }
       .map { $0.replacingOccurrences(of: "3", with: "Three") }
       .map { $0.replacingOccurrences(of: "4", with: "Four") }
       .map { $0.replacingOccurrences(of: "5", with: "Five") }
       .map { $0.replacingOccurrences(of: "6", with: "Six") }
       .map { $0.replacingOccurrences(of: "7", with: "Seven") }
       .map { $0.replacingOccurrences(of: "8", with: "Eight") }
       .map { $0.replacingOccurrences(of: "9", with: "Nine") }
    return result
}
```
 // XCTAssertTrue failed

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

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

func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var arr = arr.filter { $0 > 0 && $0 < 10 }
    arr.sort()
    arr.reverse()
    for i in arr {
        switch i {
        case 1:
            result.append("One")
        case 2:
            result.append("Two")
        case 3:
            result.append("Three")
        case 4:
            result.append("Four")
        case 5:
            result.append("Five")
        case 6:
            result.append("Six")
        case 7:
            result.append("Seven")
        case 8:
            result.append("Eight")
        case 9:
            result.append("Nine")
        default:
            break
        }
    }
    return result
}
```swift
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace each digit by its corresponding name from
// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
// For example:
// If the array is empty, return an empty array:
// If the array has any strange number ignore it:
// byLength(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
// byLength(arr: [] as [Int]) == [] as [String]
// byLength(arr: [1, -1, 55]) == ["One"]
func byLength(arr: [Int]) -> [String] {
    var result = [String]()
    var arr = arr.filter { $0 > 0 && $0 < 10 }
    arr.sort()
    arr.reverse()
    for i in arr {
        switch i {
        case 1:
            result.append("One")
        case 2:
            result.append("Two")
        case 3:
            result.append("Three")
        case 4:
            result.append("Four")
        case 5:
            result.append("Five")
        case 6:
            result.append("Six")
        case 7:
            result.append("Seven")
        case 8:
            result.append("Eight")
        case 9:
            result.append("Nine")
        default:
            break
        }
    }
    return result
}
```

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

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

func f(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        if i % 2 == 0 {
            result.append(factorial(i))
        } else {
            result.append(sum(i))
        }
    }
    return result
}

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

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

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

func sum(_ n: Int) -> Int {
    var result = 0
    for i in 1...n {
        result += i
    }
    return result
}
```

func f(n: Int) -> [Int] {
    var result = [Int]()
    for i in 1...n {
        result.append(i % 2 == 0? factorial(i) : sum(i))
    }
    return result
}

func factorial(_ n: Int) -> Int {
    return (1...n).reduce(1, *)
}

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

func factorial(_ n: Int) -> Int {
    return (1...n).reduce(1, *)
}

func sum(_ n: Int) -> Int {
    return (1...n).reduce(0, +)
}
```
result.append(i % 2 == 0? factorial(i) : sum(i)) // cannot use optional chaining on non-optional value of type 'Int'
result.append(i % 2 == 0? factorial(i) : sum(i)) // cannot convert value of type 'Bool' to expected argument type 'Int'
result.append(i % 2 == 0? factorial(i) : sum(i)) // extra argument in call
result.append(i % 2 == 0? factorial(i) : sum(i)) // expected ',' separator

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

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

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

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(i))
        }
    }
    return result
}

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

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

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

func sum(_ n: Int) -> Int {
    var result = 0
    for i in 1...n {
        result += i
    }
    return result
}
```

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

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(i))
        }
    }
    return result
}

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

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

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

func sum(_ n: Int) -> Int {
    var result = 0
    for i in 1...n {
        result += i
    }
    return result
}
```

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

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if isEven(i) {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(_ n: Int) -> Bool {
    var num = n
    var reverse = 0
    while num > 0 {
        reverse = reverse * 10 + num % 10
        num = num / 10
    }
    return reverse == n
}

func isEven(_ n: Int) -> Bool {
    return n % 2 == 0
}
```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 isEven(i) {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(_ n: Int) -> Bool {
    var num = n
    var reverse = 0
    while num > 0 {
        reverse = reverse * 10 + num % 10
        num = num / 10
    }
    return reverse == n
}

func isEven(_ n: Int) -> Bool {
    return n % 2 == 0
}
```

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 num = n
    var reverse = 0
    while num > 0 {
        reverse = reverse * 10 + num % 10
        num /= 10
    }
    return reverse == n
}
```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 num = n
    var reverse = 0
    while num > 0 {
        reverse = reverse * 10 + num % 10
        num /= 10
    }
    return reverse == n
}
```

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if isEven(i) {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(_ n: Int) -> Bool {
    let str = String(n)
    return str == String(str.reversed())
}

func isEven(_ n: Int) -> Bool {
    return n % 2 == 0
}
```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 isEven(i) {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(_ n: Int) -> Bool {
    let str = String(n)
    return str == String(str.reversed())
}

func isEven(_ n: Int) -> Bool {
    return n % 2 == 0
}
```

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

func isPalindrome(_ n: Int) -> Bool {
    let string = String(n)
    let reversed = String(string.reversed())
    return string == reversed
}
```

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if isEven(i) {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(_ n: Int) -> Bool {
    let str = String(n)
    let reversed = String(str.reversed())
    return str == reversed
}

func isEven(_ n: Int) -> Bool {
    return n % 2 == 0
}
```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 isEven(i) {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(_ n: Int) -> Bool {
    let str = String(n)
    let reversed = String(str.reversed())
    return str == reversed
}

func isEven(_ n: Int) -> Bool {
    return n % 2 == 0
}
```

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

func isPalindrome(_ n: Int) -> Bool {
    let string = String(n)
    let reversed = String(string.reversed())
    return string == reversed
}
```

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

func isPalindrome(_ n: Int) -> Bool {
    let str = String(n)
    let reversed = String(str.reversed())
    return str == reversed
}
```

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if isEven(i) {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(_ n: Int) -> Bool {
    var num = n
    var reversed = 0
    while num > 0 {
        reversed = reversed * 10 + num % 10
        num /= 10
    }
    return reversed == n
}

func isEven(_ n: Int) -> Bool {
    return n % 2 == 0
}
```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 isEven(i) {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

func isPalindrome(_ n: Int) -> Bool {
    var num = n
    var reversed = 0
    while num > 0 {
        reversed = reversed * 10 + num % 10
        num /= 10
    }
    return reversed == n
}

func isEven(_ n: Int) -> Bool {
    return n % 2 == 0
}
```

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 num = n
    var reverse = 0
    while num > 0 {
        reverse = reverse * 10 + num % 10
        num /= 10
    }
    return n == reverse
}
```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 num = n
    var reverse = 0
    while num > 0 {
        reverse = reverse * 10 + num % 10
        num /= 10
    }
    return n == reverse
}
```

func evenOddPalindrome(n: Int) -> (Int, Int) {
    var even = 0
    var odd = 0
    for i in 1...n {
        if isPalindrome(i) {
            if i % 2 == 0 {
                even += 1
            } else {
                odd += 1
            }
        }
    }
    return (even, odd)
}

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

func isPalindrome(_ n: Int) -> Bool {
    let str = String(n)
    let reversed = String(str.reversed())
    return str == reversed
}
```

func countNums(arr: [Int]) -> Int {
    // Write your code here
}
```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 {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        if num < 0 {
            var temp = num
            while temp!= 0 {
                if temp < 0 {
                    count += 1
                }
                temp /= 10
            }
        } else {
            while num!= 0 {
                if num % 10 > 0 {
                    count += 1
                }
                num /= 10
            }
        }
    }
    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 {
            var temp = num
            while temp!= 0 {
                if temp < 0 {
                    count += 1
                }
                temp /= 10
            }
        } else {
            while num!= 0 {
                if num % 10 > 0 {
                    count += 1
                }
                num /= 10
            }
        }
    }
    return count
}
```
while temp!= 0 { // use of '=' in a boolean context, did you mean '=='?
while temp!= 0 { // cannot force unwrap value of non-optional type 'Int'
while temp!= 0 { // '=' must have consistent whitespace on both sides
while num!= 0 { // use of '=' in a boolean context, did you mean '=='?
while num!= 0 { // cannot force unwrap value of non-optional type 'Int'
while num!= 0 { // '=' must have consistent whitespace on both sides
num /= 10 // left side of mutating operator isn't mutable: 'num' is a 'let' constant

func countNums(arr: [Int]) -> Int {
    // Write your code here.
    var count = 0
    for num in arr {
        if num < 0 {
            let absNum = abs(num)
            if absNum > 0 {
                count += 1
            }
        } else {
            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 {
    // Write your code here.
    var count = 0
    for num in arr {
        if num < 0 {
            let absNum = abs(num)
            if absNum > 0 {
                count += 1
            }
        } else {
            if num > 0 {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        if num > 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
// If a number is negative, then its first signed digit will be negative:
// e.g. -123 has signed digits -1, 2, and 3.
// countNums(arr: [] as [Int]) == 0
// countNums(arr: [-1, 11, -11]) == 1
// countNums(arr: [1, 1, 2]) == 3
func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        if num > 0 {
            count += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        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 {
    return arr.filter { $0 > 0 }.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 {
    return arr.filter { $0 > 0 }.count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    // Write your code here
}
```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 {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        if num < 0 {
            let absNum = abs(num)
            if absNum > 0 {
                count += 1
            }
        } else {
            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 {
            let absNum = abs(num)
            if absNum > 0 {
                count += 1
            }
        } else {
            if num > 0 {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    return arr.filter { $0 > 0 }.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 {
    return arr.filter { $0 > 0 }.count
}
```
 // XCTAssertTrue failed

func countNums(arr: [Int]) -> Int {
    var count = 0
    for num in arr {
        if num < 0 {
            let absNum = abs(num)
            let digits = String(absNum).map { Int(String($0))! }
            if digits.reduce(0, +) > 0 {
                count += 1
            }
        } else {
            let digits = String(num).map { Int(String($0))! }
            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 {
        if num < 0 {
            let absNum = abs(num)
            let digits = String(absNum).map { Int(String($0))! }
            if digits.reduce(0, +) > 0 {
                count += 1
            }
        } else {
            let digits = String(num).map { Int(String($0))! }
            if digits.reduce(0, +) > 0 {
                count += 1
            }
        }
    }
    return count
}
```
 // XCTAssertTrue failed

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

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

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

func moveOneBall(arr: [Int]) -> Bool {
    var arr = arr
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] > arr[j] {
            return false
        }
        if arr[i] == arr[j] {
            i += 1
            j -= 1
        } else if arr[i] < arr[j] {
            if arr[i] == arr[i + 1] {
                i += 1
            } else if arr[j] == arr[j - 1] {
                j -= 1
            } else {
                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 {
    var arr = arr
    var i = 0
    var j = arr.count - 1
    while i < j {
        if arr[i] > arr[j] {
            return false
        }
        if arr[i] == arr[j] {
            i += 1
            j -= 1
        } else if arr[i] < arr[j] {
            if arr[i] == arr[i + 1] {
                i += 1
            } else if arr[j] == arr[j - 1] {
                j -= 1
            } else {
                return false
            }
        }
    }
    return true
}
```
var arr = arr // variable 'arr' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

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

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

func moveOneBall(arr: [Int]) -> Bool {
    var arr = arr
    var count = 0
    while arr.count > 1 {
        let last = arr.removeLast()
        let first = arr.removeFirst()
        if last < first {
            count += 1
            arr.append(last)
        } else {
            arr.insert(last, at: 0)
        }
    }
    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 {
    var arr = arr
    var count = 0
    while arr.count > 1 {
        let last = arr.removeLast()
        let first = arr.removeFirst()
        if last < first {
            count += 1
            arr.append(last)
        } else {
            arr.insert(last, at: 0)
        }
    }
    return count <= 1
}
```
 // XCTAssertTrue failed

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

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

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

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var result = "YES"
    for i in 0..<lst1.count {
        if lst1[i] % 2!= 0 {
            for j in 0..<lst2.count {
                if lst2[j] % 2 == 0 {
                    lst1[i] = lst2[j]
                    lst2[j] = lst1[i]
                    result = "YES"
                    break
                }
            }
        }
    }
    return result
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var result = "YES"
    for i in 0..<lst1.count {
        if lst1[i] % 2!= 0 {
            for j in 0..<lst2.count {
                if lst2[j] % 2 == 0 {
                    lst1[i] = lst2[j]
                    lst2[j] = lst1[i]
                    result = "YES"
                    break
                }
            }
        }
    }
    return result
}
```
if lst1[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if lst1[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if lst1[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if lst1[i] % 2!= 0 { // expression is not assignable: binary operator returns immutable value

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

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var result = "YES"
    for i in 0..<lst1.count {
        if lst1[i] % 2!= 0 {
            for j in 0..<lst2.count {
                if lst2[j] % 2 == 0 {
                    lst1[i] = lst2[j]
                    lst2[j] = lst1[i]
                    result = "YES"
                    break
                }
            }
        }
    }
    return result
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var result = "YES"
    for i in 0..<lst1.count {
        if lst1[i] % 2!= 0 {
            for j in 0..<lst2.count {
                if lst2[j] % 2 == 0 {
                    lst1[i] = lst2[j]
                    lst2[j] = lst1[i]
                    result = "YES"
                    break
                }
            }
        }
    }
    return result
}
```
if lst1[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if lst1[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if lst1[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if lst1[i] % 2!= 0 { // expression is not assignable: binary operator returns immutable value

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var result = "YES"
    for i in 0..<lst1.count {
        for j in 0..<lst2.count {
            if lst1[i] % 2 == 0 {
                continue
            }
            if lst2[j] % 2 == 0 {
                continue
            }
            if lst1[i] == lst2[j] {
                lst1[i] = 0
                lst2[j] = 0
                break
            }
        }
    }
    for i in 0..<lst1.count {
        if lst1[i] % 2!= 0 {
            result = "NO"
            break
        }
    }
    return result
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var result = "YES"
    for i in 0..<lst1.count {
        for j in 0..<lst2.count {
            if lst1[i] % 2 == 0 {
                continue
            }
            if lst2[j] % 2 == 0 {
                continue
            }
            if lst1[i] == lst2[j] {
                lst1[i] = 0
                lst2[j] = 0
                break
            }
        }
    }
    for i in 0..<lst1.count {
        if lst1[i] % 2!= 0 {
            result = "NO"
            break
        }
    }
    return result
}
```
if lst1[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if lst1[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if lst1[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if lst1[i] % 2!= 0 { // expression is not assignable: binary operator returns immutable value

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var even = 0
    var odd = 0
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
    }
    for i in 0..<lst2.count {
        if lst2[i] % 2 == 0 {
            even -= 1
        } else {
            odd -= 1
        }
    }
    if even == 0 && odd == 0 {
        return "YES"
    } else {
        return "NO"
    }
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var even = 0
    var odd = 0
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
    }
    for i in 0..<lst2.count {
        if lst2[i] % 2 == 0 {
            even -= 1
        } else {
            odd -= 1
        }
    }
    if even == 0 && odd == 0 {
        return "YES"
    } else {
        return "NO"
    }
}
```
var lst1 = lst1 // variable 'lst1' was never mutated; consider changing to 'let' constant
var lst2 = lst2 // variable 'lst2' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var even = 0
    var odd = 0
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
    }
    for i in 0..<lst2.count {
        if lst2[i] % 2 == 0 {
            even -= 1
        } else {
            odd -= 1
        }
    }
    if even == 0 && odd == 0 {
        return "YES"
    } else if even == 0 && odd == 1 {
        return "YES"
    } else if even == 1 && odd == 0 {
        return "YES"
    } else {
        return "NO"
    }
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var even = 0
    var odd = 0
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
    }
    for i in 0..<lst2.count {
        if lst2[i] % 2 == 0 {
            even -= 1
        } else {
            odd -= 1
        }
    }
    if even == 0 && odd == 0 {
        return "YES"
    } else if even == 0 && odd == 1 {
        return "YES"
    } else if even == 1 && odd == 0 {
        return "YES"
    } else {
        return "NO"
    }
}
```
var lst1 = lst1 // variable 'lst1' was never mutated; consider changing to 'let' constant
var lst2 = lst2 // variable 'lst2' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var even = 0
    var odd = 0
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
    }
    for i in 0..<lst2.count {
        if lst2[i] % 2 == 0 {
            even -= 1
        } else {
            odd -= 1
        }
    }
    if even == 0 && odd == 0 {
        return "YES"
    } else if even == 0 && odd == 1 {
        return "YES"
    } else if even == 1 && odd == 0 {
        return "YES"
    } else if even == 1 && odd == 1 {
        return "YES"
    } else {
        return "NO"
    }
}
```swift
// In this problem, you will implement a function that takes two arrays of numbers,
// and determines whether it is possible to perform an exchange of elements
// between them to make lst1 an array of only even numbers.
// There is no limit on the number of exchanged elements between lst1 and lst2.
// If it is possible to exchange elements between the lst1 and lst2 to make
// all the elements of lst1 to be even, return "YES".
// Otherwise, return "NO".
// For example:
// It is assumed that the input arrays will be non-empty.
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES"
// exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO"
func exchange(lst1: [Int], lst2: [Int]) -> String {
    var lst1 = lst1
    var lst2 = lst2
    var even = 0
    var odd = 0
    for i in 0..<lst1.count {
        if lst1[i] % 2 == 0 {
            even += 1
        } else {
            odd += 1
        }
    }
    for i in 0..<lst2.count {
        if lst2[i] % 2 == 0 {
            even -= 1
        } else {
            odd -= 1
        }
    }
    if even == 0 && odd == 0 {
        return "YES"
    } else if even == 0 && odd == 1 {
        return "YES"
    } else if even == 1 && odd == 0 {
        return "YES"
    } else if even == 1 && odd == 1 {
        return "YES"
    } else {
        return "NO"
    }
}
```
var lst1 = lst1 // variable 'lst1' was never mutated; consider changing to 'let' constant
var lst2 = lst2 // variable 'lst2' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

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

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

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

func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    return [:]
}
```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] {
    return [:]
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var dict = [String : Int]()
    let arr = test.components(separatedBy: " ")
    for item in arr {
        if let count = dict[item] {
            dict[item] = count + 1
        } else {
            dict[item] = 1
        }
    }
    return dict
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var dict = [String : Int]()
    let arr = test.components(separatedBy: " ")
    for item in arr {
        if let count = dict[item] {
            dict[item] = count + 1
        } else {
            dict[item] = 1
        }
    }
    return dict
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var result = [String: Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if result[word] == nil {
            result[word] = 1
        } else {
            result[word]! += 1
        }
    }
    return result
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var result = [String: Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if result[word] == nil {
            result[word] = 1
        } else {
            result[word]! += 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var dict = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if dict[word] == nil {
            dict[word] = 1
        } else {
            dict[word]! += 1
        }
    }
    return dict
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var dict = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if dict[word] == nil {
            dict[word] = 1
        } else {
            dict[word]! += 1
        }
    }
    return dict
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```swift
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and containing the corresponding count.
// If several letters have the same occurrence, return all of them.
// Example:
// histogram(test: "a b c") == ["a" : 1, "b" : 1, "c" : 1]
// histogram(test: "a b b a") == ["a" : 2, "b" : 2]
// histogram(test: "a b c a b") == ["a" : 2, "b" : 2]
// histogram(test: "b b b b a") == ["b" : 4]
// histogram(test: "") == [:] as [String : Int]
func histogram(test: String) -> [String : Int] {
    var result = [String : Int]()
    let words = test.components(separatedBy: " ")
    for word in words {
        if let count = result[word] {
            result[word] = count + 1
        } else {
            result[word] = 1
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    var check = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    for char in result {
        check.append(char)
    }
    return (check, check == String(check.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 = ""
    var check = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    for char in result {
        check.append(char)
    }
    return (check, check == String(check.reversed()))
}
```
if!c.contains(char) { // expected expression, var, or let in 'if' condition

func reverseDelete(s: String, c: String) -> (String, Bool) {
    let s = s.lowercased()
    let c = c.lowercased()
    var result = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    return (result, result == String(result.reversed()))
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    let s = s.lowercased()
    let c = c.lowercased()
    var result = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    return (result, result == String(result.reversed()))
}
```
if!c.contains(char) { // expected expression, var, or let in 'if' condition

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    var check = ""
    for char in s {
        if!c.contains(char) {
            result += String(char)
        } else {
            check += String(char)
        }
    }
    return (result, result == String(result.reversed()))
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    var check = ""
    for char in s {
        if!c.contains(char) {
            result += String(char)
        } else {
            check += String(char)
        }
    }
    return (result, result == String(result.reversed()))
}

reverseDelete(s: "abcde", c: "ae")
reverseDelete(s: "abcdef", c: "b")
reverseDelete(s: "abcdedcba", c: "ab")
```
if!c.contains(char) { // expected expression, var, or let in 'if' condition

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    return (result, result == String(result.reversed()))
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    return (result, result == String(result.reversed()))
}
```
if!c.contains(char) { // expected expression, var, or let in 'if' condition

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    return (result, result == String(result.reversed()))
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    return (result, result == String(result.reversed()))
}
```
if!c.contains(char) { // expected expression, var, or let in 'if' condition

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    var check = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    for char in result {
        check.append(char)
    }
    return (check, check == String(check.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 = ""
    var check = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    for char in result {
        check.append(char)
    }
    return (check, check == String(check.reversed()))
}
```
if!c.contains(char) { // expected expression, var, or let in 'if' condition

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    var check = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    for char in result {
        check.append(char)
    }
    return (check, check == String(check.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 = ""
    var check = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    for char in result {
        check.append(char)
    }
    return (check, check == String(check.reversed()))
}

reverseDelete(s: "abcde", c: "ae")
reverseDelete(s: "abcdef", c: "b")
reverseDelete(s: "abcdedcba", c: "ab")
```
if!c.contains(char) { // expected expression, var, or let in 'if' condition

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    var check = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    for char in result {
        check.append(char)
    }
    return (check, check == String(check.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 = ""
    var check = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    for char in result {
        check.append(char)
    }
    return (check, check == String(check.reversed()))
}
```
if!c.contains(char) { // expected expression, var, or let in 'if' condition

func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    return (result, result == String(result.reversed()))
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    var result = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    return (result, result == String(result.reversed()))
}
```
if!c.contains(char) { // expected expression, var, or let in 'if' condition

func reverseDelete(s: String, c: String) -> (String, Bool) {
    // Write your code here
    var result = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    return (result, result == String(result.reversed()))
}
```swift
// Task
// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
// then check if the result string is palindrome.
// A string is called palindrome if it reads the same backward as forward.
// You should return a tuple containing the result string and true/false for the check.
// Example
// reverseDelete(s: "abcde", c: "ae") == ("bcd", false)
// reverseDelete(s: "abcdef", c: "b") == ("acdef", false)
// reverseDelete(s: "abcdedcba", c: "ab") == ("cdedc", true)
func reverseDelete(s: String, c: String) -> (String, Bool) {
    // Write your code here
    var result = ""
    for char in s {
        if!c.contains(char) {
            result.append(char)
        }
    }
    return (result, result == String(result.reversed()))
}
```
if!c.contains(char) { // expected expression, var, or let in 'if' condition

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.filter { $0.isDigit }.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.filter { $0.isDigit }.count
        return "the number of odd elements \(oddCount)n the str\(oddCount)ng \(oddCount) of the \(oddCount)nput."
    }
}
```
let oddCount = $0.filter { $0.isDigit }.count // value of type 'String.Element' (aka 'Character') has no member 'isDigit'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let count = $0.filter { $0.isDigit }.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.isDigit }.count
        return "the number of odd elements \(count)n the str\(count)ng \(count) of the \(count)nput."
    }
}
```
let count = $0.filter { $0.isDigit }.count // value of type 'String.Element' (aka 'Character') has no member 'isDigit'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.filter { $0.isNumber }.filter { $0.isOdd }.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.filter { $0.isNumber }.filter { $0.isOdd }.count
        return "the number of odd elements \(oddCount)n the str\(oddCount)ng \(oddCount) of the \(oddCount)nput."
    }
}
```
let oddCount = $0.filter { $0.isNumber }.filter { $0.isOdd }.count // value of type 'String.Element' (aka 'Character') has no member 'isOdd'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let count = $0.filter { $0.isDigit }.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.isDigit }.count
        return "the number of odd elements \(count)n the str\(count)ng \(count) of the \(count)nput."
    }
}
```
let count = $0.filter { $0.isDigit }.count // value of type 'String.Element' (aka 'Character') has no member 'isDigit'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let odds = $0.filter { $0.isDigit }.count
        return "the number of odd elements \(odds)n the str\(odds)ng \(odds) of the \(odds)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 odds = $0.filter { $0.isDigit }.count
        return "the number of odd elements \(odds)n the str\(odds)ng \(odds) of the \(odds)nput."
    }
}
```
let odds = $0.filter { $0.isDigit }.count // value of type 'String.Element' (aka 'Character') has no member 'isDigit'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let odds = $0.filter { $0.isDigit }.count
        return "the number of odd elements \(odds)n the str\(odds)ng \(odds) of the \(odds)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 odds = $0.filter { $0.isDigit }.count
        return "the number of odd elements \(odds)n the str\(odds)ng \(odds) of the \(odds)nput."
    }
}
```
let odds = $0.filter { $0.isDigit }.count // value of type 'String.Element' (aka 'Character') has no member 'isDigit'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let odd = $0.filter { $0.isDigit }.count
        return "the number of odd elements \(odd)n the str\(odd)ng \(odd) of the \(odd)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 odd = $0.filter { $0.isDigit }.count
        return "the number of odd elements \(odd)n the str\(odd)ng \(odd) of the \(odd)nput."
    }
}
```
let odd = $0.filter { $0.isDigit }.count // value of type 'String.Element' (aka 'Character') has no member 'isDigit'

func oddCount(lst: [String]) -> [String] {
  return lst.map {
    let count = $0.filter { $0.isDigit }.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.isDigit }.count
    return "the number of odd elements \(count)n the str\(count)ng \(count) of the \(count)nput."
  }
}
```
let count = $0.filter { $0.isDigit }.count // value of type 'String.Element' (aka 'Character') has no member 'isDigit'

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let oddCount = $0.filter { $0.isNumber }.count % 2
        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.filter { $0.isNumber }.count % 2
        return "the number of odd elements \(oddCount)n the str\(oddCount)ng \(oddCount) of the \(oddCount)nput."
    }
}
```
 // XCTAssertTrue failed

func oddCount(lst: [String]) -> [String] {
    return lst.map {
        let count = $0.reduce(0) { $0 + ($1.isOdd? 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) { $0 + ($1.isOdd? 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
let count = $0.reduce(0) { $0 + ($1.isOdd? 1 : 0) } // expected ',' separator

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

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for num in nums {
        sum += num
        if sum < minSum {
            minSum = sum
        }
        if sum > 0 {
            sum = 0
        }
    }
    return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for num in nums {
        sum += num
        if sum < minSum {
            minSum = sum
        }
        if sum > 0 {
            sum = 0
        }
    }
    return minSum
}
```

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

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

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for num in nums {
        sum += num
        if sum < minSum {
            minSum = sum
        }
        if sum > 0 {
            sum = 0
        }
    }
    return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for num in nums {
        sum += num
        if sum < minSum {
            minSum = sum
        }
        if sum > 0 {
            sum = 0
        }
    }
    return minSum
}
```

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

func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for num in nums {
        sum += num
        if sum < minSum {
            minSum = sum
        }
        if sum > 0 {
            sum = 0
        }
    }
    return minSum
}
```swift
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum(nums: [2, 3, 4, 1, 2, 4]) == 1
// minSubArraySum(nums: [-1, -2, -3]) == -6
func minSubArraySum(nums: [Int]) -> Int {
    var minSum = Int.max
    var sum = 0
    for num in nums {
        sum += num
        if sum < minSum {
            minSum = sum
        }
        if sum > 0 {
            sum = 0
        }
    }
    return minSum
}
```

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

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

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

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var count = 0
    var grid = grid
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            if grid[i][j] == 1 {
                count += 1
                grid[i][j] = 0
                let left = j - 1
                let right = j + 1
                while left >= 0 && grid[i][left] == 1 {
                    grid[i][left] = 0
                    left -= 1
                }
                while right < grid[i].count && grid[i][right] == 1 {
                    grid[i][right] = 0
                    right += 1
                }
            }
        }
    }
    return count
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var count = 0
    var grid = grid
    for i in 0..<grid.count {
        for j in 0..<grid[i].count {
            if grid[i][j] == 1 {
                count += 1
                grid[i][j] = 0
                let left = j - 1
                let right = j + 1
                while left >= 0 && grid[i][left] == 1 {
                    grid[i][left] = 0
                    left -= 1
                }
                while right < grid[i].count && grid[i][right] == 1 {
                    grid[i][right] = 0
                    right += 1
                }
            }
        }
    }
    return count
}
```
left -= 1 // left side of mutating operator isn't mutable: 'left' is a 'let' constant
right += 1 // left side of mutating operator isn't mutable: 'right' is a 'let' constant

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

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var count = 0
    while true {
        var changed = false
        for i in 0..<grid.count {
            for j in 0..<grid[i].count {
                if grid[i][j] == 1 {
                    let left = j > 0? grid[i][j - 1] : 0
                    let right = j < grid[i].count - 1? grid[i][j + 1] : 0
                    let up = i > 0? grid[i - 1][j] : 0
                    let down = i < grid.count - 1? grid[i + 1][j] : 0
                    let min = min(left, right, up, down)
                    if min > 0 {
                        grid[i][j] = min
                        changed = true
                    }
                }
            }
        }
        if!changed {
            break
        }
        count += 1
    }
    return count
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var count = 0
    while true {
        var changed = false
        for i in 0..<grid.count {
            for j in 0..<grid[i].count {
                if grid[i][j] == 1 {
                    let left = j > 0? grid[i][j - 1] : 0
                    let right = j < grid[i].count - 1? grid[i][j + 1] : 0
                    let up = i > 0? grid[i - 1][j] : 0
                    let down = i < grid.count - 1? grid[i + 1][j] : 0
                    let min = min(left, right, up, down)
                    if min > 0 {
                        grid[i][j] = min
                        changed = true
                    }
                }
            }
        }
        if!changed {
            break
        }
        count += 1
    }
    return count
}
```
let left = j > 0? grid[i][j - 1] : 0 // cannot use optional chaining on non-optional value of type 'Int'
let left = j > 0? grid[i][j - 1] : 0 // expected expression
let left = j > 0? grid[i][j - 1] : 0 // consecutive statements on a line must be separated by ';'
let left = j > 0? grid[i][j - 1] : 0 // consecutive statements on a line must be separated by ';'
let left = j > 0? grid[i][j - 1] : 0 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
let left = j > 0? grid[i][j - 1] : 0 // subscript is accessed but result is unused
let right = j < grid[i].count - 1? grid[i][j + 1] : 0 // expected expression
let right = j < grid[i].count - 1? grid[i][j + 1] : 0 // subscript is accessed but result is unused
let right = j < grid[i].count - 1? grid[i][j + 1] : 0 // consecutive statements on a line must be separated by ';'
let right = j < grid[i].count - 1? grid[i][j + 1] : 0 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
let right = j < grid[i].count - 1? grid[i][j + 1] : 0 // consecutive statements on a line must be separated by ';'
let right = j < grid[i].count - 1? grid[i][j + 1] : 0 // cannot use optional chaining on non-optional value of type 'Int'
let up = i > 0? grid[i - 1][j] : 0 // consecutive statements on a line must be separated by ';'
let up = i > 0? grid[i - 1][j] : 0 // subscript is accessed but result is unused
let up = i > 0? grid[i - 1][j] : 0 // cannot use optional chaining on non-optional value of type 'Int'
let up = i > 0? grid[i - 1][j] : 0 // expected expression
let up = i > 0? grid[i - 1][j] : 0 // consecutive statements on a line must be separated by ';'
let up = i > 0? grid[i - 1][j] : 0 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
let down = i < grid.count - 1? grid[i + 1][j] : 0 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
let down = i < grid.count - 1? grid[i + 1][j] : 0 // consecutive statements on a line must be separated by ';'
let down = i < grid.count - 1? grid[i + 1][j] : 0 // expected expression
let down = i < grid.count - 1? grid[i + 1][j] : 0 // subscript is accessed but result is unused
let down = i < grid.count - 1? grid[i + 1][j] : 0 // cannot use optional chaining on non-optional value of type 'Int'
let down = i < grid.count - 1? grid[i + 1][j] : 0 // consecutive statements on a line must be separated by ';'
if!changed { // expected expression, var, or let in 'if' condition

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var count = 0
    var i = 0
    while i < grid.count {
        var j = 0
        while j < grid[i].count {
            if grid[i][j] == 1 {
                if j > 0 && grid[i][j - 1] == 0 {
                    grid[i][j - 1] = 1
                    count += 1
                }
                if j < grid[i].count - 1 && grid[i][j + 1] == 0 {
                    grid[i][j + 1] = 1
                    count += 1
                }
                if i > 0 && grid[i - 1][j] == 0 {
                    grid[i - 1][j] = 1
                    count += 1
                }
                if i < grid.count - 1 && grid[i + 1][j] == 0 {
                    grid[i + 1][j] = 1
                    count += 1
                }
            }
            j += 1
        }
        i += 1
    }
    return count
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var count = 0
    var i = 0
    while i < grid.count {
        var j = 0
        while j < grid[i].count {
            if grid[i][j] == 1 {
                if j > 0 && grid[i][j - 1] == 0 {
                    grid[i][j - 1] = 1
                    count += 1
                }
                if j < grid[i].count - 1 && grid[i][j + 1] == 0 {
                    grid[i][j + 1] = 1
                    count += 1
                }
                if i > 0 && grid[i - 1][j] == 0 {
                    grid[i - 1][j] = 1
                    count += 1
                }
                if i < grid.count - 1 && grid[i + 1][j] == 0 {
                    grid[i + 1][j] = 1
                    count += 1
                }
            }
            j += 1
        }
        i += 1
    }
    return count
}
```
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var count = 0
    var i = 0
    while i < grid.count {
        var j = 0
        while j < grid[i].count {
            if grid[i][j] == 1 {
                var k = j + 1
                while k < grid[i].count && grid[i][k] == 1 {
                    k += 1
                }
                if k - j > capacity {
                    count += k - j - capacity
                    grid[i][j] = 0
                    grid[i][k - 1] = 1
                }
                j = k
            } else {
                j += 1
            }
        }
        i += 1
    }
    return count
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var count = 0
    var i = 0
    while i < grid.count {
        var j = 0
        while j < grid[i].count {
            if grid[i][j] == 1 {
                var k = j + 1
                while k < grid[i].count && grid[i][k] == 1 {
                    k += 1
                }
                if k - j > capacity {
                    count += k - j - capacity
                    grid[i][j] = 0
                    grid[i][k - 1] = 1
                }
                j = k
            } else {
                j += 1
            }
        }
        i += 1
    }
    return count
}
```
 // XCTAssertTrue failed

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var count = 0
    var i = 0
    while i < grid.count {
        var j = 0
        while j < grid[i].count {
            if grid[i][j] == 1 {
                let left = j - 1 >= 0? grid[i][j - 1] : 0
                let right = j + 1 < grid[i].count? grid[i][j + 1] : 0
                let up = i - 1 >= 0? grid[i - 1][j] : 0
                let down = i + 1 < grid.count? grid[i + 1][j] : 0
                let max = max(left, right, up, down)
                if max > 0 {
                    let diff = min(capacity, max - grid[i][j])
                    grid[i][j] += diff
                    count += diff
                }
            }
            j += 1
        }
        i += 1
    }
    return count
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var count = 0
    var i = 0
    while i < grid.count {
        var j = 0
        while j < grid[i].count {
            if grid[i][j] == 1 {
                let left = j - 1 >= 0? grid[i][j - 1] : 0
                let right = j + 1 < grid[i].count? grid[i][j + 1] : 0
                let up = i - 1 >= 0? grid[i - 1][j] : 0
                let down = i + 1 < grid.count? grid[i + 1][j] : 0
                let max = max(left, right, up, down)
                if max > 0 {
                    let diff = min(capacity, max - grid[i][j])
                    grid[i][j] += diff
                    count += diff
                }
            }
            j += 1
        }
        i += 1
    }
    return count
}
```
let left = j - 1 >= 0? grid[i][j - 1] : 0 // cannot use optional chaining on non-optional value of type 'Int'
let left = j - 1 >= 0? grid[i][j - 1] : 0 // subscript is accessed but result is unused
let left = j - 1 >= 0? grid[i][j - 1] : 0 // expected expression
let left = j - 1 >= 0? grid[i][j - 1] : 0 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
let left = j - 1 >= 0? grid[i][j - 1] : 0 // consecutive statements on a line must be separated by ';'
let left = j - 1 >= 0? grid[i][j - 1] : 0 // consecutive statements on a line must be separated by ';'
let right = j + 1 < grid[i].count? grid[i][j + 1] : 0 // cannot use optional chaining on non-optional value of type 'Int'
let right = j + 1 < grid[i].count? grid[i][j + 1] : 0 // subscript is accessed but result is unused
let right = j + 1 < grid[i].count? grid[i][j + 1] : 0 // expected expression
let right = j + 1 < grid[i].count? grid[i][j + 1] : 0 // consecutive statements on a line must be separated by ';'
let right = j + 1 < grid[i].count? grid[i][j + 1] : 0 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
let right = j + 1 < grid[i].count? grid[i][j + 1] : 0 // consecutive statements on a line must be separated by ';'
let up = i - 1 >= 0? grid[i - 1][j] : 0 // cannot use optional chaining on non-optional value of type 'Int'
let up = i - 1 >= 0? grid[i - 1][j] : 0 // consecutive statements on a line must be separated by ';'
let up = i - 1 >= 0? grid[i - 1][j] : 0 // consecutive statements on a line must be separated by ';'
let up = i - 1 >= 0? grid[i - 1][j] : 0 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
let up = i - 1 >= 0? grid[i - 1][j] : 0 // expected expression
let up = i - 1 >= 0? grid[i - 1][j] : 0 // subscript is accessed but result is unused
let down = i + 1 < grid.count? grid[i + 1][j] : 0 // subscript is accessed but result is unused
let down = i + 1 < grid.count? grid[i + 1][j] : 0 // expected expression
let down = i + 1 < grid.count? grid[i + 1][j] : 0 // cannot use optional chaining on non-optional value of type 'Int'
let down = i + 1 < grid.count? grid[i + 1][j] : 0 // consecutive statements on a line must be separated by ';'
let down = i + 1 < grid.count? grid[i + 1][j] : 0 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
let down = i + 1 < grid.count? grid[i + 1][j] : 0 // consecutive statements on a line must be separated by ';'

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var count = 0
    var row = 0
    var col = 0
    while row < grid.count && col < grid[row].count {
        if grid[row][col] == 0 {
            count += 1
            grid[row][col] = 1
            if col + 1 < grid[row].count {
                col += 1
            } else {
                row += 1
                col = 0
            }
        } else {
            col += 1
        }
    }
    return count
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var count = 0
    var row = 0
    var col = 0
    while row < grid.count && col < grid[row].count {
        if grid[row][col] == 0 {
            count += 1
            grid[row][col] = 1
            if col + 1 < grid[row].count {
                col += 1
            } else {
                row += 1
                col = 0
            }
        } else {
            col += 1
        }
    }
    return count
}
```
 // XCTAssertTrue failed

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

func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var result = 0
    var grid = grid
    var i = 0
    while i < grid.count {
        var j = 0
        while j < grid[i].count {
            if grid[i][j] == 1 {
                var count = 0
                var left = j - 1
                var right = j + 1
                while left >= 0 && grid[i][left] == 1 {
                    count += 1
                    left -= 1
                }
                while right < grid[i].count && grid[i][right] == 1 {
                    count += 1
                    right += 1
                }
                if count > 0 {
                    result += count
                    grid[i][j] = 0
                    grid[i][left + 1] = 0
                    grid[i][right - 1] = 0
                }
            }
            j += 1
        }
        i += 1
    }
    return result
}
```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var result = 0
    var grid = grid
    var i = 0
    while i < grid.count {
        var j = 0
        while j < grid[i].count {
            if grid[i][j] == 1 {
                var count = 0
                var left = j - 1
                var right = j + 1
                while left >= 0 && grid[i][left] == 1 {
                    count += 1
                    left -= 1
                }
                while right < grid[i].count && grid[i][right] == 1 {
                    count += 1
                    right += 1
                }
                if count > 0 {
                    result += count
                    grid[i][j] = 0
                    grid[i][left + 1] = 0
                    grid[i][right - 1] = 0
                }
            }
            j += 1
        }
        i += 1
    }
    return result
}
```
 // XCTAssertTrue failed

```swift
// You are given a rectangular grid of wells. Each row represents a single well,
// and each 1 in a row represents a single unit of water.
// Each well has a corresponding bucket that can be used to extract water from it, 
// and all buckets have the same capacity.
// Your task is to use the buckets to empty the wells.
// Output the number of times you need to lower the buckets.
// Example 1:
// Example 2:
// Example 3:
// Constraints:
// * all wells have the same length
// * 1 <= grid.length <= 10^2
// * 1 <= grid[:,1].length <= 10^2
// * grid[i][j] -> 0 | 1
// * 1 <= capacity <= 10
// maxFill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1) == 6
// maxFill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2) == 5
// maxFill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5) == 0
func maxFill(grid: [[Int]], capacity: Int) -> Int {
    var grid = grid
    var count = 0
    while true {
        let (i, j) = findFirst(grid: grid, capacity: capacity)
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity: capacity, from: (i, j))
        if i == -1 {
            break
        }
        let (i, j) = findFirst(grid: grid, capacity:
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] {
    return arr.sorted {
        let binary1 = String(String($0, radix: 2).filter { $0 == "1" }, radix: 2)
        let binary2 = String(String($1, radix: 2).filter { $0 == "1" }, radix: 2)
        return (binary1.count, $0) < (binary2.count, $1)
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let binary1 = String(String($0, radix: 2).filter { $0 == "1" }, radix: 2)
        let binary2 = String(String($1, radix: 2).filter { $0 == "1" }, radix: 2)
        return (binary1.count, $0) < (binary2.count, $1)
    }
}
```
let binary1 = String(String($0, radix: 2).filter { $0 == "1" }, radix: 2) // initializer 'init(_:radix:uppercase:)' requires that 'String' conform to 'BinaryInteger'

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = $0.binaryString
        let b = $1.binaryString
        return (a.count, a) < (b.count, b)
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = $0.binaryString
        let b = $1.binaryString
        return (a.count, a) < (b.count, b)
    }
}
```
let a = $0.binaryString // value of type 'Int' has no member 'binaryString'

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted(by: {
        let a = String($0, radix: 2).filter { $0 == "1" }.count
        let b = String($1, radix: 2).filter { $0 == "1" }.count
        return a == b? $0 < $1 : a < b
    })
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted(by: {
        let a = String($0, radix: 2).filter { $0 == "1" }.count
        let b = String($1, radix: 2).filter { $0 == "1" }.count
        return a == b? $0 < $1 : a < b
    })
}
```
return a == b? $0 < $1 : a < b // consecutive statements on a line must be separated by ';'
return a == b? $0 < $1 : a < b // expected expression
return a == b? $0 < $1 : a < b // consecutive statements on a line must be separated by ';'
return a == b? $0 < $1 : a < b // cannot use optional chaining on non-optional value of type 'Int'

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String(format: "%d", $0)
        let b = String(format: "%d", $1)
        return (a.filter { $0 == "1" }).count == (b.filter { $0 == "1" }).count? $0 < $1 : (a.filter { $0 == "1" }).count < (b.filter { $0 == "1" }).count
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String(format: "%d", $0)
        let b = String(format: "%d", $1)
        return (a.filter { $0 == "1" }).count == (b.filter { $0 == "1" }).count? $0 < $1 : (a.filter { $0 == "1" }).count < (b.filter { $0 == "1" }).count
    }
}
```
return (a.filter { $0 == "1" }).count == (b.filter { $0 == "1" }).count? $0 < $1 : (a.filter { $0 == "1" }).count < (b.filter { $0 == "1" }).count // cannot use optional chaining on non-optional value of type 'Int'
return (a.filter { $0 == "1" }).count == (b.filter { $0 == "1" }).count? $0 < $1 : (a.filter { $0 == "1" }).count < (b.filter { $0 == "1" }).count // consecutive statements on a line must be separated by ';'
return (a.filter { $0 == "1" }).count == (b.filter { $0 == "1" }).count? $0 < $1 : (a.filter { $0 == "1" }).count < (b.filter { $0 == "1" }).count // expected expression
return (a.filter { $0 == "1" }).count == (b.filter { $0 == "1" }).count? $0 < $1 : (a.filter { $0 == "1" }).count < (b.filter { $0 == "1" }).count // consecutive statements on a line must be separated by ';'

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let ones1 = $0.nonzeroBitCount
        let ones2 = $1.nonzeroBitCount
        if ones1 == ones2 {
            return $0 < $1
        }
        return ones1 < ones2
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let ones1 = $0.nonzeroBitCount
        let ones2 = $1.nonzeroBitCount
        if ones1 == ones2 {
            return $0 < $1
        }
        return ones1 < ones2
    }
}
```
 // XCTAssertTrue failed

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted(by: {
        let a = String($0, radix: 2).filter { $0 == "1" }.count
        let b = String($1, radix: 2).filter { $0 == "1" }.count
        return (a, $0) < (b, $1)
    })
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted(by: {
        let a = String($0, radix: 2).filter { $0 == "1" }.count
        let b = String($1, radix: 2).filter { $0 == "1" }.count
        return (a, $0) < (b, $1)
    })
}
```

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted(by: {
        let binary1 = String(String($0, radix: 2).dropFirst())
        let binary2 = String(String($1, radix: 2).dropFirst())
        return (binary1.filter { $0 == "1" }.count, $0) < (binary2.filter { $0 == "1" }.count, $1)
    })
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted(by: {
        let binary1 = String(String($0, radix: 2).dropFirst())
        let binary2 = String(String($1, radix: 2).dropFirst())
        return (binary1.filter { $0 == "1" }.count, $0) < (binary2.filter { $0 == "1" }.count, $1)
    })
}
```

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String($0, radix: 2)
        let b = String($1, radix: 2)
        if a.count == b.count {
            return $0 < $1
        } else {
            return a.count < b.count
        }
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String($0, radix: 2)
        let b = String($1, radix: 2)
        if a.count == b.count {
            return $0 < $1
        } else {
            return a.count < b.count
        }
    }
}
```
 // XCTAssertTrue failed

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String($0, radix: 2)
        let b = String($1, radix: 2)
        return (a.filter { $0 == "1" }).count == (b.filter { $0 == "1" }).count? $0 < $1 : (a.filter { $0 == "1" }).count < (b.filter { $0 == "1" }).count
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = String($0, radix: 2)
        let b = String($1, radix: 2)
        return (a.filter { $0 == "1" }).count == (b.filter { $0 == "1" }).count? $0 < $1 : (a.filter { $0 == "1" }).count < (b.filter { $0 == "1" }).count
    }
}
```
return (a.filter { $0 == "1" }).count == (b.filter { $0 == "1" }).count? $0 < $1 : (a.filter { $0 == "1" }).count < (b.filter { $0 == "1" }).count // cannot use optional chaining on non-optional value of type 'Int'
return (a.filter { $0 == "1" }).count == (b.filter { $0 == "1" }).count? $0 < $1 : (a.filter { $0 == "1" }).count < (b.filter { $0 == "1" }).count // consecutive statements on a line must be separated by ';'
return (a.filter { $0 == "1" }).count == (b.filter { $0 == "1" }).count? $0 < $1 : (a.filter { $0 == "1" }).count < (b.filter { $0 == "1" }).count // expected expression
return (a.filter { $0 == "1" }).count == (b.filter { $0 == "1" }).count? $0 < $1 : (a.filter { $0 == "1" }).count < (b.filter { $0 == "1" }).count // consecutive statements on a line must be separated by ';'

func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = $0.toBinary()
        let b = $1.toBinary()
        if a.count == b.count {
            return $0 < $1
        }
        return a.count < b.count
    }
}

extension Int {
    func toBinary() -> [Int] {
        var result = [Int]()
        var n = self
        while n > 0 {
            result.append(n % 2)
            n /= 2
        }
        return result
    }
}
```swift
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in ascending order.
// For similar number of ones, sort based on decimal value.
// It must be implemented like this:
// sortArray(arr: [1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]
// sortArray(arr: [-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]
// sortArray(arr: [1, 0, 2, 3, 4]) == [0, 1, 2, 3, 4]
func sortArray(arr: [Int]) -> [Int] {
    return arr.sorted {
        let a = $0.toBinary()
        let b = $1.toBinary()
        if a.count == b.count {
            return $0 < $1
        }
        return a.count < b.count
    }
}

extension Int {
    func toBinary() -> [Int] {
        var result = [Int]()
        var n = self
        while n > 0 {
            result.append(n % 2)
            n /= 2
        }
        return result
    }
}
```
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    // TODO: Implement this function
    return []
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    // TODO: Implement this function
    return []
}
```
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    // TODO: Implement this function
    return []
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    // TODO: Implement this function
    return []
}
```
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    var words = [String]()
    let vowels = Set("aeiou")
    let consonants = Set("bcdfghjklmnpqrstvwxyz")
    var word = ""
    for char in s {
        if consonants.contains(char) {
            word.append(char)
        } else if vowels.contains(char) {
            if word.count == n {
                words.append(word)
            }
            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 vowels = Set("aeiou")
    let consonants = Set("bcdfghjklmnpqrstvwxyz")
    var word = ""
    for char in s {
        if consonants.contains(char) {
            word.append(char)
        } else if vowels.contains(char) {
            if word.count == n {
                words.append(word)
            }
            word = ""
        }
    }
    return words
}
```
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    var words = [String]()
    var word = ""
    var consonants = 0
    for char in s {
        if char.isLetter {
            word += String(char)
            if char.isVowel {
                consonants = 0
            } else {
                consonants += 1
            }
        } else {
            if consonants == n {
                words.append(word)
            }
            word = ""
            consonants = 0
        }
    }
    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 char in s {
        if char.isLetter {
            word += String(char)
            if char.isVowel {
                consonants = 0
            } else {
                consonants += 1
            }
        } else {
            if consonants == n {
                words.append(word)
            }
            word = ""
            consonants = 0
        }
    }
    return words
}
```
if char.isVowel { // value of type 'Character' has no member 'isVowel'

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

func selectWords(s: String, n: Int) -> [String] {
    var words = [String]()
    let vowels = ["a", "e", "i", "o", "u"]
    let consonants = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z"]
    var word = ""
    var count = 0
    for char in s {
        if char == " " {
            if count == n {
                words.append(word)
            }
            word = ""
            count = 0
        } else if vowels.contains(String(char)) {
            count = 0
        } else if consonants.contains(String(char)) {
            count += 1
        } else {
            count = 0
        }
        word.append(char)
    }
    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 vowels = ["a", "e", "i", "o", "u"]
    let consonants = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z"]
    var word = ""
    var count = 0
    for char in s {
        if char == " " {
            if count == n {
                words.append(word)
            }
            word = ""
            count = 0
        } else if vowels.contains(String(char)) {
            count = 0
        } else if consonants.contains(String(char)) {
            count += 1
        } else {
            count = 0
        }
        word.append(char)
    }
    if count == n {
        words.append(word)
    }
    return words
}
```
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    // TODO: implement this function
    return []
}
```swift
// Given a string s and a natural number n, you have been tasked to implement 
// a function that returns an array of all words from string s that contain exactly 
// n consonants, in order these words appear in the string s.
// If the string s is empty then the function should return an empty array.
// Note: you may assume the input string contains only letters and spaces.
// Examples:
// selectWords(s: "Mary had a little lamb", n: 4) == ["little"]
// selectWords(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"]
// selectWords(s: "simple white space", n: 2) == [] as [String]
// selectWords(s: "Hello world", n: 4) == ["world"]
// selectWords(s: "Uncle sam", n: 3) == ["Uncle"]
func selectWords(s: String, n: Int) -> [String] {
    // TODO: implement this function
    return []
}
```
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    return []
}
```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] {
    return []
}
```
 // XCTAssertTrue failed

func selectWords(s: String, n: Int) -> [String] {
    var words = [String]()
    var word = ""
    var consonants = 0
    for char in s {
        if char.isLetter {
            word += String(char)
            consonants += 1
        } else if char == " " {
            if consonants == n {
                words.append(word)
            }
            word = ""
            consonants = 0
        }
    }
    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 char in s {
        if char.isLetter {
            word += String(char)
            consonants += 1
        } else if char == " " {
            if consonants == n {
                words.append(word)
            }
            word = ""
            consonants = 0
        }
    }
    if consonants == n {
        words.append(word)
    }
    return words
}
```
 // XCTAssertTrue failed

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

func getClosestVowel(word: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    var result = ""
    var index = word.count - 1
    while index >= 0 {
        if vowels.contains(word[index]) {
            result = word[index]
            break
        }
        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 {
    let vowels = ["a", "e", "i", "o", "u"]
    var result = ""
    var index = word.count - 1
    while index >= 0 {
        if vowels.contains(word[index]) {
            result = word[index]
            break
        }
        index -= 1
    }
    return result
}
```
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 = Set<Character>()
    vowels.insert("a")
    vowels.insert("e")
    vowels.insert("i")
    vowels.insert("o")
    vowels.insert("u")
    
    var result = ""
    var index = word.count - 1
    while index >= 0 {
        let char = word[index]
        if vowels.contains(char) {
            result = String(char)
            break
        }
        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 = Set<Character>()
    vowels.insert("a")
    vowels.insert("e")
    vowels.insert("i")
    vowels.insert("o")
    vowels.insert("u")
    
    var result = ""
    var index = word.count - 1
    while index >= 0 {
        let char = word[index]
        if vowels.contains(char) {
            result = String(char)
            break
        }
        index -= 1
    }
    return result
}
```
let char = word[index] // 'subscript(_:)' is unavailable: cannot subscript String with an Int, use a String.Index instead.

func getClosestVowel(word: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    var result = ""
    for (index, letter) in word.enumerated() {
        if vowels.contains(String(letter)) {
            if index!= 0 && index!= word.count - 1 {
                if let right = word.index(word.startIndex, offsetBy: index + 1),
                    let left = word.index(word.startIndex, offsetBy: index - 1) {
                    let rightLetter = word[right]
                    let leftLetter = word[left]
                    if vowels.contains(String(rightLetter)) && vowels.contains(String(leftLetter)) {
                        result = String(rightLetter)
                    } else if vowels.contains(String(rightLetter)) {
                        result = String(rightLetter)
                    } else if vowels.contains(String(leftLetter)) {
                        result = String(leftLetter)
                    }
                }
            } else if index == 0 {
                if let right = word.index(word.startIndex, offsetBy: index + 1) {
                    let rightLetter = word[right]
                    if vowels.contains(String(rightLetter)) {
                        result = String(rightLetter)
                    }
                }
            } else if index == word.count - 1 {
                if let left = word.index(word.startIndex, offsetBy: index - 1) {
                    let leftLetter = word[left]
                    if vowels.contains(String(leftLetter)) {
                        result = String(leftLetter)
                    }
                }
            }
        }
    }
    return result
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    var result = ""
    for (index, letter) in word.enumerated() {
        if vowels.contains(String(letter)) {
            if index!= 0 && index!= word.count - 1 {
                if let right = word.index(word.startIndex, offsetBy: index + 1),
                    let left = word.index(word.startIndex, offsetBy: index - 1) {
                    let rightLetter = word[right]
                    let leftLetter = word[left]
                    if vowels.contains(String(rightLetter)) && vowels.contains(String(leftLetter)) {
                        result = String(rightLetter)
                    } else if vowels.contains(String(rightLetter)) {
                        result = String(rightLetter)
                    } else if vowels.contains(String(leftLetter)) {
                        result = String(leftLetter)
                    }
                }
            } else if index == 0 {
                if let right = word.index(word.startIndex, offsetBy: index + 1) {
                    let rightLetter = word[right]
                    if vowels.contains(String(rightLetter)) {
                        result = String(rightLetter)
                    }
                }
            } else if index == word.count - 1 {
                if let left = word.index(word.startIndex, offsetBy: index - 1) {
                    let leftLetter = word[left]
                    if vowels.contains(String(leftLetter)) {
                        result = String(leftLetter)
                    }
                }
            }
        }
    }
    return result
}
```
if index!= 0 && index!= word.count - 1 { // cannot force unwrap value of non-optional type 'Int'
if index!= 0 && index!= word.count - 1 { // cannot force unwrap value of non-optional type 'Int'
if index!= 0 && index!= word.count - 1 { // '=' must have consistent whitespace on both sides
if index!= 0 && index!= word.count - 1 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if index!= 0 && index!= word.count - 1 { // cannot assign value of type '()' to type 'Int'
if index!= 0 && index!= word.count - 1 { // '=' must have consistent whitespace on both sides
if index!= 0 && index!= word.count - 1 { // integer literal value '0' cannot be used as a boolean; did you mean 'false'?
if index!= 0 && index!= word.count - 1 { // use of '=' in a boolean context, did you mean '=='?
if let right = word.index(word.startIndex, offsetBy: index + 1), // initializer for conditional binding must have Optional type, not 'String.Index'
let left = word.index(word.startIndex, offsetBy: index - 1) { // initializer for conditional binding must have Optional type, not 'String.Index'
if let right = word.index(word.startIndex, offsetBy: index + 1) { // initializer for conditional binding must have Optional type, not 'String.Index'
if let left = word.index(word.startIndex, offsetBy: index - 1) { // initializer for conditional binding must have Optional type, not 'String.Index'

func getClosestVowel(word: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    var closestVowel = ""
    var closestDistance = Int.max
    for (index, letter) in word.enumerated() {
        if vowels.contains(String(letter)) {
            let distance = word.distance(from: word.startIndex, to: word.index(word.startIndex, offsetBy: index))
            if distance < closestDistance {
                closestDistance = distance
                closestVowel = String(letter)
            }
        }
    }
    return closestVowel
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    var closestVowel = ""
    var closestDistance = Int.max
    for (index, letter) in word.enumerated() {
        if vowels.contains(String(letter)) {
            let distance = word.distance(from: word.startIndex, to: word.index(word.startIndex, offsetBy: index))
            if distance < closestDistance {
                closestDistance = distance
                closestVowel = String(letter)
            }
        }
    }
    return closestVowel
}
```
 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    let word = word.lowercased()
    var result = ""
    for i in 0..<word.count {
        if vowels.contains(String(word[word.index(word.startIndex, offsetBy: i)])) {
            result = String(word[word.index(word.startIndex, offsetBy: i)])
            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 {
    let vowels = ["a", "e", "i", "o", "u"]
    let word = word.lowercased()
    var result = ""
    for i in 0..<word.count {
        if vowels.contains(String(word[word.index(word.startIndex, offsetBy: i)])) {
            result = String(word[word.index(word.startIndex, offsetBy: i)])
            break
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    var result = ""
    for i in 0..<word.count {
        if vowels.contains(String(word[word.index(word.startIndex, offsetBy: i)])) {
            result = String(word[word.index(word.startIndex, offsetBy: i)])
            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 {
    let vowels = ["a", "e", "i", "o", "u"]
    var result = ""
    for i in 0..<word.count {
        if vowels.contains(String(word[word.index(word.startIndex, offsetBy: i)])) {
            result = String(word[word.index(word.startIndex, offsetBy: i)])
            break
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    var closestVowel = ""
    var closestVowelDistance = Int.max
    for (index, char) in word.enumerated() {
        if vowels.contains(String(char)) {
            let distance = abs(index - word.count)
            if distance < closestVowelDistance {
                closestVowelDistance = distance
                closestVowel = String(char)
            }
        }
    }
    return closestVowel
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    var closestVowel = ""
    var closestVowelDistance = Int.max
    for (index, char) in word.enumerated() {
        if vowels.contains(String(char)) {
            let distance = abs(index - word.count)
            if distance < closestVowelDistance {
                closestVowelDistance = distance
                closestVowel = String(char)
            }
        }
    }
    return closestVowel
}
```
 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    var vowels = "aeiou"
    var closestVowel = ""
    var closestDistance = Int.max
    for (index, char) in word.enumerated() {
        if vowels.contains(char) {
            let distance = word.distance(from: word.startIndex, to: word.index(word.startIndex, offsetBy: index))
            if distance < closestDistance {
                closestDistance = distance
                closestVowel = String(char)
            }
        }
    }
    return closestVowel
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    var vowels = "aeiou"
    var closestVowel = ""
    var closestDistance = Int.max
    for (index, char) in word.enumerated() {
        if vowels.contains(char) {
            let distance = word.distance(from: word.startIndex, to: word.index(word.startIndex, offsetBy: index))
            if distance < closestDistance {
                closestDistance = distance
                closestVowel = String(char)
            }
        }
    }
    return closestVowel
}
```
var vowels = "aeiou" // variable 'vowels' was never mutated; consider changing to 'let' constant
 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    let vowels = Set("aeiou")
    var result = ""
    var minDistance = Int.max
    for (index, char) in word.enumerated() {
        if vowels.contains(char) {
            let distance = word.count - index
            if distance < minDistance {
                minDistance = distance
                result = String(char)
            }
        }
    }
    return result
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    let vowels = Set("aeiou")
    var result = ""
    var minDistance = Int.max
    for (index, char) in word.enumerated() {
        if vowels.contains(char) {
            let distance = word.count - index
            if distance < minDistance {
                minDistance = distance
                result = String(char)
            }
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func getClosestVowel(word: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    var closestVowel = ""
    var closestDistance = Int.max
    for (index, letter) in word.enumerated() {
        if vowels.contains(String(letter)) {
            let distance = word.distance(from: word.startIndex, to: word.index(word.startIndex, offsetBy: index))
            if distance < closestDistance {
                closestVowel = String(letter)
                closestDistance = distance
            }
        }
    }
    return closestVowel
}
```swift
// You are given a word. Your task is to find the closest vowel that stands between 
// two consonants from the right side of the word (case sensitive).
// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
// find any vowel met the above condition. 
// You may assume that the given string contains English letter only.
// Example:
// getClosestVowel(word: "yogurt") == "u"
// getClosestVowel(word: "FULL") == "U"
// getClosestVowel(word: "quick") == ""
// getClosestVowel(word: "ab") == ""
func getClosestVowel(word: String) -> String {
    let vowels = ["a", "e", "i", "o", "u"]
    var closestVowel = ""
    var closestDistance = Int.max
    for (index, letter) in word.enumerated() {
        if vowels.contains(String(letter)) {
            let distance = word.distance(from: word.startIndex, to: word.index(word.startIndex, offsetBy: index))
            if distance < closestDistance {
                closestVowel = String(letter)
                closestDistance = distance
            }
        }
    }
    return closestVowel
}
```
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for str in lst {
        if str == ")" {
            if stack.isEmpty || stack.last!= "(" {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(str)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for str in lst {
        if str == ")" {
            if stack.isEmpty || stack.last!= "(" {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(str)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```
if stack.isEmpty || stack.last!= "(" { // expression is not assignable: '||' returns immutable value
if stack.isEmpty || stack.last!= "(" { // use of '=' in a boolean context, did you mean '=='?
if stack.isEmpty || stack.last!= "(" { // cannot convert value of type 'String' to expected argument type 'Bool'
if stack.isEmpty || stack.last!= "(" { // '=' must have consistent whitespace on both sides
return stack.isEmpty? "Yes" : "No" // expected expression
return stack.isEmpty? "Yes" : "No" // string literal is unused
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return stack.isEmpty? "Yes" : "No" // cannot use optional chaining on non-optional value of type 'Bool'
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'

func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for s in lst {
        if s == ")" {
            if stack.isEmpty || stack.last!= "(" {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(s)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for s in lst {
        if s == ")" {
            if stack.isEmpty || stack.last!= "(" {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(s)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```
if stack.isEmpty || stack.last!= "(" { // expression is not assignable: '||' returns immutable value
if stack.isEmpty || stack.last!= "(" { // use of '=' in a boolean context, did you mean '=='?
if stack.isEmpty || stack.last!= "(" { // cannot convert value of type 'String' to expected argument type 'Bool'
if stack.isEmpty || stack.last!= "(" { // '=' must have consistent whitespace on both sides
return stack.isEmpty? "Yes" : "No" // expected expression
return stack.isEmpty? "Yes" : "No" // string literal is unused
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return stack.isEmpty? "Yes" : "No" // cannot use optional chaining on non-optional value of type 'Bool'
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'

func matchParens(lst: [String]) -> String {
    var result = ""
    var stack = [String]()
    for s in lst {
        if s == ")" {
            if stack.isEmpty {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(s)
        }
    }
    if stack.isEmpty {
        return "Yes"
    }
    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 result = ""
    var stack = [String]()
    for s in lst {
        if s == ")" {
            if stack.isEmpty {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(s)
        }
    }
    if stack.isEmpty {
        return "Yes"
    }
    return "No"
}
```
var result = "" // initialization of variable 'result' was never used; consider replacing with assignment to '_' or removing it
 // XCTAssertTrue failed

func matchParens(lst: [String]) -> String {
    // Write your code here
    var stack = [Character]()
    for char in lst[0] {
        if char == "(" {
            stack.append(char)
        } else {
            if stack.isEmpty {
                return "No"
            }
            stack.removeLast()
        }
    }
    for char in lst[1] {
        if char == ")" {
            stack.append(char)
        } else {
            if stack.isEmpty {
                return "No"
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    // Write your code here
    var stack = [Character]()
    for char in lst[0] {
        if char == "(" {
            stack.append(char)
        } else {
            if stack.isEmpty {
                return "No"
            }
            stack.removeLast()
        }
    }
    for char in lst[1] {
        if char == ")" {
            stack.append(char)
        } else {
            if stack.isEmpty {
                return "No"
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```
return stack.isEmpty? "Yes" : "No" // expected expression
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return stack.isEmpty? "Yes" : "No" // string literal is unused
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return stack.isEmpty? "Yes" : "No" // cannot use optional chaining on non-optional value of type 'Bool'

func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for item in lst {
        if item == ")" {
            if stack.isEmpty || stack.last!= "(" {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(item)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for item in lst {
        if item == ")" {
            if stack.isEmpty || stack.last!= "(" {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(item)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```
if stack.isEmpty || stack.last!= "(" { // expression is not assignable: '||' returns immutable value
if stack.isEmpty || stack.last!= "(" { // use of '=' in a boolean context, did you mean '=='?
if stack.isEmpty || stack.last!= "(" { // cannot convert value of type 'String' to expected argument type 'Bool'
if stack.isEmpty || stack.last!= "(" { // '=' must have consistent whitespace on both sides
return stack.isEmpty? "Yes" : "No" // expected expression
return stack.isEmpty? "Yes" : "No" // string literal is unused
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return stack.isEmpty? "Yes" : "No" // cannot use optional chaining on non-optional value of type 'Bool'
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'

func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for str in lst {
        if str == ")" {
            if stack.isEmpty || stack.last!= "(" {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(str)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for str in lst {
        if str == ")" {
            if stack.isEmpty || stack.last!= "(" {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(str)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```
if stack.isEmpty || stack.last!= "(" { // expression is not assignable: '||' returns immutable value
if stack.isEmpty || stack.last!= "(" { // use of '=' in a boolean context, did you mean '=='?
if stack.isEmpty || stack.last!= "(" { // cannot convert value of type 'String' to expected argument type 'Bool'
if stack.isEmpty || stack.last!= "(" { // '=' must have consistent whitespace on both sides
return stack.isEmpty? "Yes" : "No" // expected expression
return stack.isEmpty? "Yes" : "No" // string literal is unused
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return stack.isEmpty? "Yes" : "No" // cannot use optional chaining on non-optional value of type 'Bool'
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'

func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for s in lst {
        if s == ")" {
            if stack.isEmpty {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(s)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for s in lst {
        if s == ")" {
            if stack.isEmpty {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(s)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```
return stack.isEmpty? "Yes" : "No" // expected expression
return stack.isEmpty? "Yes" : "No" // string literal is unused
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return stack.isEmpty? "Yes" : "No" // cannot use optional chaining on non-optional value of type 'Bool'

func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for s in lst {
        if s == ")" {
            if stack.isEmpty || stack.last!= "(" {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(s)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for s in lst {
        if s == ")" {
            if stack.isEmpty || stack.last!= "(" {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(s)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```
if stack.isEmpty || stack.last!= "(" { // expression is not assignable: '||' returns immutable value
if stack.isEmpty || stack.last!= "(" { // use of '=' in a boolean context, did you mean '=='?
if stack.isEmpty || stack.last!= "(" { // cannot convert value of type 'String' to expected argument type 'Bool'
if stack.isEmpty || stack.last!= "(" { // '=' must have consistent whitespace on both sides
return stack.isEmpty? "Yes" : "No" // expected expression
return stack.isEmpty? "Yes" : "No" // string literal is unused
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return stack.isEmpty? "Yes" : "No" // cannot use optional chaining on non-optional value of type 'Bool'
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'

func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for item in lst {
        if item == ")" {
            if stack.isEmpty {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(item)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```swift
// You are given an array of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job is to check if it is possible to concatenate the two strings in
// some order, that the resulting string will be good.
// A string S is considered to be good if and only if all parentheses in S
// are balanced. For example: the string '(())()' is good, while the string
// '())' is not.
// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
// Examples:
// matchParens(lst: ["()(", ")"]) == "Yes"
// matchParens(lst: [")", ")"]) == "No"
func matchParens(lst: [String]) -> String {
    var stack = [String]()
    for item in lst {
        if item == ")" {
            if stack.isEmpty {
                return "No"
            }
            stack.removeLast()
        } else {
            stack.append(item)
        }
    }
    return stack.isEmpty? "Yes" : "No"
}
```
return stack.isEmpty? "Yes" : "No" // expected expression
return stack.isEmpty? "Yes" : "No" // string literal is unused
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return stack.isEmpty? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return stack.isEmpty? "Yes" : "No" // cannot use optional chaining on non-optional value of type 'Bool'

func matchParens(lst: [String]) -> String {
    var stack = [Character]()
    for char in lst[0] {
        if char == "(" {
            stack.append(char)
        } else {
            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 char in lst[0] {
        if char == "(" {
            stack.append(char)
        } else {
            if stack.isEmpty {
                return "No"
            }
            stack.removeLast()
        }
    }
    if stack.isEmpty {
        return "Yes"
    } else {
        return "No"
    }
}
```
 // XCTAssertTrue failed

func maximum(arr: [Int], k: Int) -> [Int] {
    var result = [Int]()
    var maxHeap = Heap<Int>(sort: >)
    for i in 0..<k {
        maxHeap.insert(arr[i])
    }
    for i in k..<arr.count {
        if arr[i] > maxHeap.peek() {
            maxHeap.remove()
            maxHeap.insert(arr[i])
        }
    }
    while let num = maxHeap.remove() {
        result.append(num)
    }
    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 maxHeap = Heap<Int>(sort: >)
    for i in 0..<k {
        maxHeap.insert(arr[i])
    }
    for i in k..<arr.count {
        if arr[i] > maxHeap.peek() {
            maxHeap.remove()
            maxHeap.insert(arr[i])
        }
    }
    while let num = maxHeap.remove() {
        result.append(num)
    }
    return result
}
```
var maxHeap = Heap<Int>(sort: >) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    var arr = arr
    var maxHeap = Heap<Int>(sort: >)
    for i in 0..<k {
        maxHeap.insert(arr[i])
    }
    for i in k..<arr.count {
        if arr[i] > maxHeap.peek()! {
            maxHeap.remove()
            maxHeap.insert(arr[i])
        }
    }
    return maxHeap.array
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    var arr = arr
    var maxHeap = Heap<Int>(sort: >)
    for i in 0..<k {
        maxHeap.insert(arr[i])
    }
    for i in k..<arr.count {
        if arr[i] > maxHeap.peek()! {
            maxHeap.remove()
            maxHeap.insert(arr[i])
        }
    }
    return maxHeap.array
}
```
var maxHeap = Heap<Int>(sort: >) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    var maxHeap = Heap<Int>(sort: >)
    var result = [Int]()
    for num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    while maxHeap.count > 0 {
        result.append(maxHeap.remove())
    }
    return result.reversed()
}
```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 maxHeap = Heap<Int>(sort: >)
    var result = [Int]()
    for num in arr {
        maxHeap.insert(num)
        if maxHeap.count > k {
            maxHeap.remove()
        }
    }
    while maxHeap.count > 0 {
        result.append(maxHeap.remove())
    }
    return result.reversed()
}
```
var maxHeap = Heap<Int>(sort: >) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    var maxHeap = Heap<Int>(sort: >)
    for i in 0..<k {
        maxHeap.insert(arr[i])
    }
    for i in k..<arr.count {
        if arr[i] > maxHeap.peek() {
            maxHeap.remove()
            maxHeap.insert(arr[i])
        }
    }
    return maxHeap.array
}
```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 maxHeap = Heap<Int>(sort: >)
    for i in 0..<k {
        maxHeap.insert(arr[i])
    }
    for i in k..<arr.count {
        if arr[i] > maxHeap.peek() {
            maxHeap.remove()
            maxHeap.insert(arr[i])
        }
    }
    return maxHeap.array
}
```
var maxHeap = Heap<Int>(sort: >) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    var arr = arr
    var maxHeap = Heap<Int>(sort: >, elements: arr)
    var result = [Int]()
    for _ in 0..<k {
        result.append(maxHeap.remove())
    }
    return result
}
```swift
// Given an array arr of integers and a positive integer k, return a sorted array 
// of length k with the maximum k numbers in arr.
// Example 1:
// Example 2:
// Example 3:
// Note:
// 1. The length of the array will be in the range of [1, 1000].
// 2. The elements in the array will be in the range of [-1000, 1000].
// 3. 0 <= k <= len(arr)
// maximum(arr: [-3, -4, 5], k: 3) == [-4, -3, 5]
// maximum(arr: [4, -4, 4], k: 2) == [4, 4]
// maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1) == [2]
func maximum(arr: [Int], k: Int) -> [Int] {
    var arr = arr
    var maxHeap = Heap<Int>(sort: >, elements: arr)
    var result = [Int]()
    for _ in 0..<k {
        result.append(maxHeap.remove())
    }
    return result
}
```
var maxHeap = Heap<Int>(sort: >, elements: arr) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    var result = [Int]()
    var maxHeap = Heap<Int>(sort: >)
    for i in 0..<k {
        maxHeap.insert(arr[i])
    }
    for i in k..<arr.count {
        if arr[i] > maxHeap.peek() {
            maxHeap.delete()
            maxHeap.insert(arr[i])
        }
    }
    while!maxHeap.isEmpty {
        result.append(maxHeap.delete()!)
    }
    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 maxHeap = Heap<Int>(sort: >)
    for i in 0..<k {
        maxHeap.insert(arr[i])
    }
    for i in k..<arr.count {
        if arr[i] > maxHeap.peek() {
            maxHeap.delete()
            maxHeap.insert(arr[i])
        }
    }
    while!maxHeap.isEmpty {
        result.append(maxHeap.delete()!)
    }
    return result
}
```
var maxHeap = Heap<Int>(sort: >) // cannot find 'Heap' in scope
while!maxHeap.isEmpty { // expected expression, var, or let in 'while' condition

func maximum(arr: [Int], k: Int) -> [Int] {
    var result = [Int]()
    var maxHeap = Heap(arr: arr, isMax: true)
    for _ in 0..<k {
        result.append(maxHeap.remove())
    }
    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 maxHeap = Heap(arr: arr, isMax: true)
    for _ in 0..<k {
        result.append(maxHeap.remove())
    }
    return result
}
```
var maxHeap = Heap(arr: arr, isMax: true) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    var maxHeap = Heap<Int>(sort: >, initialCapacity: k)
    for num in arr {
        maxHeap.insert(num)
    }
    return maxHeap.array
}
```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 maxHeap = Heap<Int>(sort: >, initialCapacity: k)
    for num in arr {
        maxHeap.insert(num)
    }
    return maxHeap.array
}
```
var maxHeap = Heap<Int>(sort: >, initialCapacity: k) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    var maxHeap = Heap(arr: arr, sort: >)
    var result = [Int]()
    for _ in 0..<k {
        result.append(maxHeap.remove())
    }
    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 maxHeap = Heap(arr: arr, sort: >)
    var result = [Int]()
    for _ in 0..<k {
        result.append(maxHeap.remove())
    }
    return result
}
```
var maxHeap = Heap(arr: arr, sort: >) // cannot find 'Heap' in scope

func maximum(arr: [Int], k: Int) -> [Int] {
    var result = [Int]()
    var max = Int.min
    var maxIndex = 0
    for i in 0..<k {
        max = arr[i]
        maxIndex = i
    }
    for i in 0..<arr.count {
        if arr[i] > max {
            max = arr[i]
            maxIndex = i
        }
    }
    result.append(max)
    for i in 0..<k {
        if i == maxIndex {
            continue
        }
        max = arr[i]
        maxIndex = i
        for j in 0..<arr.count {
            if arr[j] > max {
                max = arr[j]
                maxIndex = j
            }
        }
        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 max = Int.min
    var maxIndex = 0
    for i in 0..<k {
        max = arr[i]
        maxIndex = i
    }
    for i in 0..<arr.count {
        if arr[i] > max {
            max = arr[i]
            maxIndex = i
        }
    }
    result.append(max)
    for i in 0..<k {
        if i == maxIndex {
            continue
        }
        max = arr[i]
        maxIndex = i
        for j in 0..<arr.count {
            if arr[j] > max {
                max = arr[j]
                maxIndex = j
            }
        }
        result.append(max)
    }
    return result
}
```
 // XCTAssertTrue failed

func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2!= 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2!= 0 {
            sum += value
        }
    }
    return sum
}
```
if index % 2 == 0 && value % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if index % 2 == 0 && value % 2!= 0 { // '=' must have consistent whitespace on both sides
if index % 2 == 0 && value % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if index % 2 == 0 && value % 2!= 0 { // expression is not assignable: '&&' returns immutable value
if index % 2 == 0 && value % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?

func solution(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element })
}
```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 {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element })
}
```
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // cannot force unwrap value of non-optional type 'Int'
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // type 'Int' cannot be used as a boolean; test for '!= 0' instead
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // expression is not assignable: '&&' returns immutable value
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // cannot convert value of type '()' to closure result type 'Bool'
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // '=' must have consistent whitespace on both sides

func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2!= 0 {
            sum += value
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for (index, value) in lst.enumerated() {
        if index % 2 == 0 && value % 2!= 0 {
            sum += value
        }
    }
    return sum
}
```
if index % 2 == 0 && value % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if index % 2 == 0 && value % 2!= 0 { // '=' must have consistent whitespace on both sides
if index % 2 == 0 && value % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if index % 2 == 0 && value % 2!= 0 { // expression is not assignable: '&&' returns immutable value
if index % 2 == 0 && value % 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 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if i % 2 == 0 && lst[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2 == 0 && lst[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if i % 2 == 0 && lst[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if i % 2 == 0 && lst[i] % 2!= 0 { // expression is not assignable: '&&' returns immutable value

func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 && lst[i] % 2!= 0 {
            sum += lst[i]
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// solution(lst: [5, 8, 7, 1]) == 12
// solution(lst: [3, 3, 3, 3, 3]) == 9
// solution(lst: [30, 13, 24, 321]) == 0
func solution(lst: [Int]) -> Int {
    var sum = 0
    for i in 0..<lst.count {
        if i % 2 == 0 && lst[i] % 2!= 0 {
            sum += lst[i]
        }
    }
    return sum
}
```
if i % 2 == 0 && lst[i] % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if i % 2 == 0 && lst[i] % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if i % 2 == 0 && lst[i] % 2!= 0 { // '=' must have consistent whitespace on both sides
if i % 2 == 0 && lst[i] % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if i % 2 == 0 && lst[i] % 2!= 0 { // expression is not assignable: '&&' returns immutable value

func solution(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 == 1 }.reduce(0) { $0 + $1.element }
}
```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 {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 == 1 }.reduce(0) { $0 + $1.element }
}
```

func solution(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 == 1 }.map { $0.element }.reduce(0, +)
}
```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 {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2 == 1 }.map { $0.element }.reduce(0, +)
}
```

func solution(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element })
}
```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 {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element })
}
```
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // cannot force unwrap value of non-optional type 'Int'
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // type 'Int' cannot be used as a boolean; test for '!= 0' instead
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // expression is not assignable: '&&' returns immutable value
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // cannot convert value of type '()' to closure result type 'Bool'
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // '=' must have consistent whitespace on both sides

func solution(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0) { $0 + $1.element }
}
```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 {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0) { $0 + $1.element }
}
```
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0) { $0 + $1.element } // cannot force unwrap value of non-optional type 'Int'
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0) { $0 + $1.element } // type 'Int' cannot be used as a boolean; test for '!= 0' instead
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0) { $0 + $1.element } // cannot convert value of type '()' to closure result type 'Bool'
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0) { $0 + $1.element } // '=' must have consistent whitespace on both sides
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0) { $0 + $1.element } // expression is not assignable: '&&' returns immutable value

func solution(lst: [Int]) -> Int {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element })
}
```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 {
    return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element })
}
```
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // cannot force unwrap value of non-optional type 'Int'
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // type 'Int' cannot be used as a boolean; test for '!= 0' instead
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // expression is not assignable: '&&' returns immutable value
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // cannot convert value of type '()' to closure result type 'Bool'
return lst.enumerated().filter { $0.offset % 2 == 0 && $0.element % 2!= 0 }.reduce(0, { $0 + $1.element }) // '=' must have consistent whitespace on both sides

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        if arr[i] < 10 {
            sum += arr[i]
            count += 1
        }
    }
    if count < k {
        for i in k..<arr.count {
            if arr[i] < 10 {
                sum += arr[i]
                count += 1
            }
            if count == k {
                break
            }
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        if arr[i] < 10 {
            sum += arr[i]
            count += 1
        }
    }
    if count < k {
        for i in k..<arr.count {
            if arr[i] < 10 {
                sum += arr[i]
                count += 1
            }
            if count == k {
                break
            }
        }
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        if arr[i] < 100 {
            sum += arr[i]
            count += 1
        }
    }
    return sum + (count == 0? 0 : arr[k] / 10)
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        if arr[i] < 100 {
            sum += arr[i]
            count += 1
        }
    }
    return sum + (count == 0? 0 : arr[k] / 10)
}
```
return sum + (count == 0? 0 : arr[k] / 10) // cannot convert value of type '(Bool, Int)' to expected argument type 'Int'
return sum + (count == 0? 0 : arr[k] / 10) // cannot use optional chaining on non-optional value of type 'Int'
return sum + (count == 0? 0 : arr[k] / 10) // expected ',' separator

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        if arr[i] < 10 {
            sum += arr[i]
            count += 1
        } else if arr[i] < 100 {
            sum += arr[i]
            count += 2
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        if arr[i] < 10 {
            sum += arr[i]
            count += 1
        } else if arr[i] < 100 {
            sum += arr[i]
            count += 2
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        let num = arr[i]
        if num < 10 {
            sum += num
            count += 1
        } else if num < 100 {
            sum += num
            count += 1
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        let num = arr[i]
        if num < 10 {
            sum += num
            count += 1
        } else if num < 100 {
            sum += num
            count += 1
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        if arr[i] < 10 {
            sum += arr[i]
            count += 1
        } else if arr[i] < 100 {
            sum += arr[i]
            count += 2
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        if arr[i] < 10 {
            sum += arr[i]
            count += 1
        } else if arr[i] < 100 {
            sum += arr[i]
            count += 2
        }
    }
    return sum
}
```

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        let num = arr[i]
        if num < 10 {
            sum += num
            count += 1
        } else if num < 100 {
            sum += num % 10
            count += 1
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        let num = arr[i]
        if num < 10 {
            sum += num
            count += 1
        } else if num < 100 {
            sum += num % 10
            count += 1
        }
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<k {
        sum += arr[i]
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<k {
        sum += arr[i]
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        if arr[i] < 10 {
            sum += arr[i]
            count += 1
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        if arr[i] < 10 {
            sum += arr[i]
            count += 1
        }
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<k {
        sum += arr[i]
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    for i in 0..<k {
        sum += arr[i]
    }
    return sum
}
```
 // XCTAssertTrue failed

func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        if arr[i] < 10 {
            sum += arr[i]
            count += 1
        } else if arr[i] < 100 {
            sum += arr[i]
            count += 1
        }
    }
    return sum
}
```swift
// Given a non-empty array of integers arr and an integer k, return
// the sum of the elements with at most two digits from the first k elements of arr.
// Example:
// Constraints:
// 1. 1 <= len(arr) <= 100
// 2. 1 <= k <= len(arr)
// addElements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24
func addElements(arr: [Int], k: Int) -> Int {
    var sum = 0
    var count = 0
    for i in 0..<k {
        if arr[i] < 10 {
            sum += arr[i]
            count += 1
        } else if arr[i] < 100 {
            sum += arr[i]
            count += 1
        }
    }
    return sum
}
```

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var number = n
    while number!= 1 {
        if number % 2 == 0 {
            number /= 2
        } else {
            number = (number * 3) + 1
        }
        if number % 2!= 0 {
            result.append(number)
        }
    }
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var number = n
    while number!= 1 {
        if number % 2 == 0 {
            number /= 2
        } else {
            number = (number * 3) + 1
        }
        if number % 2!= 0 {
            result.append(number)
        }
    }
    return result
}
```
while number!= 1 { // cannot force unwrap value of non-optional type 'Int'
while number!= 1 { // use of '=' in a boolean context, did you mean '=='?
while number!= 1 { // '=' must have consistent whitespace on both sides
if number % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if number % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if number % 2!= 0 { // '=' must have consistent whitespace on both sides
if number % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'

func getOddCollatz(n: Int) -> [Int] {
    var arr = [Int]()
    var num = n
    while num!= 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = 3 * num + 1
        }
        if num % 2!= 0 {
            arr.append(num)
        }
    }
    return arr
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var arr = [Int]()
    var num = n
    while num!= 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = 3 * num + 1
        }
        if num % 2!= 0 {
            arr.append(num)
        }
    }
    return arr
}

// Test
getOddCollatz(n: 5) == [1, 5]
getOddCollatz(n: 10) == [1, 5, 8, 4, 2, 1]
```
while num!= 1 { // cannot force unwrap value of non-optional type 'Int'
while num!= 1 { // '=' must have consistent whitespace on both sides
while num!= 1 { // use of '=' in a boolean context, did you mean '=='?
if num % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if num % 2!= 0 { // '=' must have consistent whitespace on both sides
if num % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if num % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'

func getOddCollatz(n: Int) -> [Int] {
    var arr = [Int]()
    var num = n
    while num!= 1 {
        if num % 2 == 0 {
            num = num / 2
        } else {
            num = 3 * num + 1
        }
        if num % 2!= 0 {
            arr.append(num)
        }
    }
    return arr
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var arr = [Int]()
    var num = n
    while num!= 1 {
        if num % 2 == 0 {
            num = num / 2
        } else {
            num = 3 * num + 1
        }
        if num % 2!= 0 {
            arr.append(num)
        }
    }
    return arr
}
```
while num!= 1 { // cannot force unwrap value of non-optional type 'Int'
while num!= 1 { // '=' must have consistent whitespace on both sides
while num!= 1 { // use of '=' in a boolean context, did you mean '=='?
if num % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if num % 2!= 0 { // '=' must have consistent whitespace on both sides
if num % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if num % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var num = n
    while num!= 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = (num * 3) + 1
        }
        if num % 2!= 0 {
            result.append(num)
        }
    }
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var num = n
    while num!= 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = (num * 3) + 1
        }
        if num % 2!= 0 {
            result.append(num)
        }
    }
    return result
}
```
while num!= 1 { // cannot force unwrap value of non-optional type 'Int'
while num!= 1 { // '=' must have consistent whitespace on both sides
while num!= 1 { // use of '=' in a boolean context, did you mean '=='?
if num % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if num % 2!= 0 { // '=' must have consistent whitespace on both sides
if num % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if num % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'

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

func getOddCollatz(n: Int) -> [Int] {
    var result: [Int] = []
    var num = n
    while num > 1 {
        if num % 2 == 0 {
            num = num / 2
        } else {
            num = (num * 3) + 1
        }
        result.append(num)
    }
    return result.filter({$0 % 2!= 0}).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 result: [Int] = []
    var num = n
    while num > 1 {
        if num % 2 == 0 {
            num = num / 2
        } else {
            num = (num * 3) + 1
        }
        result.append(num)
    }
    return result.filter({$0 % 2!= 0}).sorted()
}

// Test
getOddCollatz(n: 5)
```
return result.filter({$0 % 2!= 0}).sorted() // cannot force unwrap value of non-optional type 'Int'
return result.filter({$0 % 2!= 0}).sorted() // expression is not assignable: binary operator returns immutable value
return result.filter({$0 % 2!= 0}).sorted() // '=' must have consistent whitespace on both sides
return result.filter({$0 % 2!= 0}).sorted() // cannot convert value of type '()' to closure result type 'Bool'

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            result.append(current)
        }
    }
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var current = n
    while current!= 1 {
        if current % 2 == 0 {
            current /= 2
        } else {
            current = 3 * current + 1
        }
        if current % 2!= 0 {
            result.append(current)
        }
    }
    return result
}
```
while current!= 1 { // cannot force unwrap value of non-optional type 'Int'
while current!= 1 { // use of '=' in a boolean context, did you mean '=='?
while current!= 1 { // '=' must have consistent whitespace on both sides
if current % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if current % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if current % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if current % 2!= 0 { // '=' must have consistent whitespace on both sides

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var num = n
    while num!= 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = 3 * num + 1
        }
        if num % 2 == 1 {
            result.append(num)
        }
    }
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var num = n
    while num!= 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = 3 * num + 1
        }
        if num % 2 == 1 {
            result.append(num)
        }
    }
    return result
}
```
while num!= 1 { // cannot force unwrap value of non-optional type 'Int'
while num!= 1 { // use of '=' in a boolean context, did you mean '=='?
while num!= 1 { // '=' must have consistent whitespace on both sides

func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var num = n
    while num > 1 {
        if num % 2 == 0 {
            num = num / 2
        } else {
            num = 3 * num + 1
        }
        if num % 2!= 0 {
            result.append(num)
        }
    }
    return result
}
```swift
// Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
// as follows: start with any positive integer n. Then each term is obtained from the 
// previous term as follows: if the previous term is even, the next term is one half of 
// the previous term. If the previous term is odd, the next term is 3 times the previous
// term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
// Note: 
// 1. Collatz(1) is [1].
// 2. returned array sorted in increasing order.
// For example:
// get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
// getOddCollatz(n: 5) == [1, 5]
func getOddCollatz(n: Int) -> [Int] {
    var result = [Int]()
    var num = n
    while num > 1 {
        if num % 2 == 0 {
            num = num / 2
        } else {
            num = 3 * num + 1
        }
        if num % 2!= 0 {
            result.append(num)
        }
    }
    return result
}
```
if num % 2!= 0 { // expression is not assignable: binary operator returns immutable value
if num % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if num % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if num % 2!= 0 { // '=' must have consistent whitespace on both sides

func getOddCollatz(n: Int) -> [Int] {
    var arr = [Int]()
    var num = n
    while num > 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = num * 3 + 1
        }
        arr.append(num)
    }
    return arr.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 arr = [Int]()
    var num = n
    while num > 1 {
        if num % 2 == 0 {
            num /= 2
        } else {
            num = num * 3 + 1
        }
        arr.append(num)
    }
    return arr.filter { $0 % 2!= 0 }
}
```
return arr.filter { $0 % 2!= 0 } // cannot force unwrap value of non-optional type 'Int'
return arr.filter { $0 % 2!= 0 } // expression is not assignable: binary operator returns immutable value
return arr.filter { $0 % 2!= 0 } // cannot convert value of type '()' to closure result type 'Bool'
return arr.filter { $0 % 2!= 0 } // '=' must have consistent whitespace on both sides

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```
return date!= nil // cannot assign through '!': 'date' is a 'let' constant
return date!= nil // use of '=' in a boolean context, did you mean '=='?
return date!= nil // 'nil' cannot be assigned to type 'Date'
return date!= nil // '=' must have consistent whitespace on both sides

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```
return date!= nil // cannot assign through '!': 'date' is a 'let' constant
return date!= nil // use of '=' in a boolean context, did you mean '=='?
return date!= nil // 'nil' cannot be assigned to type 'Date'
return date!= nil // '=' must have consistent whitespace on both sides

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```
return date!= nil // cannot assign through '!': 'date' is a 'let' constant
return date!= nil // use of '=' in a boolean context, did you mean '=='?
return date!= nil // 'nil' cannot be assigned to type 'Date'
return date!= nil // '=' must have consistent whitespace on both sides

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```
return date!= nil // cannot assign through '!': 'date' is a 'let' constant
return date!= nil // use of '=' in a boolean context, did you mean '=='?
return date!= nil // 'nil' cannot be assigned to type 'Date'
return date!= nil // '=' must have consistent whitespace on both sides

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```
return date!= nil // cannot assign through '!': 'date' is a 'let' constant
return date!= nil // use of '=' in a boolean context, did you mean '=='?
return date!= nil // 'nil' cannot be assigned to type 'Date'
return date!= nil // '=' must have consistent whitespace on both sides

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "dd-MM-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "dd-MM-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```
return date!= nil // cannot assign through '!': 'date' is a 'let' constant
return date!= nil // use of '=' in a boolean context, did you mean '=='?
return date!= nil // 'nil' cannot be assigned to type 'Date'
return date!= nil // '=' must have consistent whitespace on both sides

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```
return date!= nil // cannot assign through '!': 'date' is a 'let' constant
return date!= nil // use of '=' in a boolean context, did you mean '=='?
return date!= nil // 'nil' cannot be assigned to type 'Date'
return date!= nil // '=' must have consistent whitespace on both sides

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    if let _ = dateFormatter.date(from: date) {
        return true
    }
    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 dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    if let _ = dateFormatter.date(from: date) {
        return true
    }
    return false
}
```

func validDate(date: String) -> Bool {
    // Write your code here
    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 {
    // Write your code here
    return true
}
```
 // XCTAssertTrue failed

func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```swift
// You have to write a function which validates a given date string and
// returns true if the date is valid otherwise false.
// The date is valid if all of the following rules are satisfied:
// 1. The date string is not empty.
// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
// 3. The months should not be less than 1 or higher than 12.
// 4. The date should be in the format: mm-dd-yyyy
// validDate(date: "03-11-2000") == true
// validDate(date: "15-01-2012") == false
// validDate(date: "04-0-2040") == false
// validDate(date: "06-04-2020") == true
// validDate(date: "06/04/2020") == false
func validDate(date: String) -> Bool {
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM-dd-yyyy"
    let date = dateFormatter.date(from: date)
    return date!= nil
}
```
return date!= nil // cannot assign through '!': 'date' is a 'let' constant
return date!= nil // use of '=' in a boolean context, did you mean '=='?
return date!= nil // 'nil' cannot be assigned to type 'Date'
return date!= nil // '=' must have consistent whitespace on both sides

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.components(separatedBy: ",")
    if words.contains(where: { $0.contains(" ") }) {
        return.success(words)
    } else {
        return.failure(txt.filter { $0.isLowercase }.count)
    }
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.components(separatedBy: ",")
    if words.contains(where: { $0.contains(" ") }) {
        return.success(words)
    } else {
        return.failure(txt.filter { $0.isLowercase }.count)
    }
}
```
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> {
    let words = txt.split(separator: " ")
    if words.count > 1 {
        return.success(words.map(String.init))
    } else {
        let chars = txt.split(separator: ",")
        if chars.count > 1 {
            return.success(chars.map(String.init))
        } else {
            let odd = txt.filter { $0.isLowercase }.count
            return.failure(odd)
        }
    }
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    if words.count > 1 {
        return.success(words.map(String.init))
    } else {
        let chars = txt.split(separator: ",")
        if chars.count > 1 {
            return.success(chars.map(String.init))
        } else {
            let odd = txt.filter { $0.isLowercase }.count
            return.failure(odd)
        }
    }
}
```
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> {
    let words = txt.split(separator: " ").map { String($0) }
    let commaWords = txt.split(separator: ",").map { String($0) }
    let lowerCaseLetters = txt.filter { $0.isLowercase }.count
    let oddLetters = txt.filter { $0.isLowercase && $0.isOdd }.count

    if words.count > 0 {
        return.success(words)
    } else if commaWords.count > 0 {
        return.success(commaWords)
    } else if lowerCaseLetters > 0 {
        return.failure(lowerCaseLetters)
    } else {
        return.failure(oddLetters)
    }
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ").map { String($0) }
    let commaWords = txt.split(separator: ",").map { String($0) }
    let lowerCaseLetters = txt.filter { $0.isLowercase }.count
    let oddLetters = txt.filter { $0.isLowercase && $0.isOdd }.count

    if words.count > 0 {
        return.success(words)
    } else if commaWords.count > 0 {
        return.success(commaWords)
    } else if lowerCaseLetters > 0 {
        return.failure(lowerCaseLetters)
    } else {
        return.failure(oddLetters)
    }
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let oddLetters = txt.filter { $0.isLowercase && $0.isOdd }.count // trailing closure passed to parameter of type 'Predicate<String.Element>' (aka 'Predicate<Character>') that does not accept a closure

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: " ")
    let wordsWithCommas = txt.split(separator: ",")
    let oddLowercaseLetters = txt.filter { $0.isLowercase && $0.isOdd }
    return words.count > 0?.success(words) : wordsWithCommas.count > 0?.success(wordsWithCommas) :.failure(oddLowercaseLetters.count)
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    let wordsWithCommas = txt.split(separator: ",")
    let oddLowercaseLetters = txt.filter { $0.isLowercase && $0.isOdd }
    return words.count > 0?.success(words) : wordsWithCommas.count > 0?.success(wordsWithCommas) :.failure(oddLowercaseLetters.count)
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let oddLowercaseLetters = txt.filter { $0.isLowercase && $0.isOdd } // trailing closure passed to parameter of type 'Predicate<String.Element>' (aka 'Predicate<Character>') that does not accept a closure
return words.count > 0?.success(words) : wordsWithCommas.count > 0?.success(wordsWithCommas) :.failure(oddLowercaseLetters.count) // consecutive statements on a line must be separated by ';'
return words.count > 0?.success(words) : wordsWithCommas.count > 0?.success(wordsWithCommas) :.failure(oddLowercaseLetters.count) // cannot convert return expression of type 'Bool' to return type 'Result<[String], Int>'
return words.count > 0?.success(words) : wordsWithCommas.count > 0?.success(wordsWithCommas) :.failure(oddLowercaseLetters.count) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return words.count > 0?.success(words) : wordsWithCommas.count > 0?.success(wordsWithCommas) :.failure(oddLowercaseLetters.count) // expected expression
return words.count > 0?.success(words) : wordsWithCommas.count > 0?.success(wordsWithCommas) :.failure(oddLowercaseLetters.count) // cannot use optional chaining on non-optional value of type 'Int'
return words.count > 0?.success(words) : wordsWithCommas.count > 0?.success(wordsWithCommas) :.failure(oddLowercaseLetters.count) // value of type 'Int' has no member 'success'

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: " ")
    let commaWords = txt.split(separator: ",")
    if words.count == commaWords.count {
        return.success(words.map { String($0) })
    } else {
        return.failure(txt.filter { $0.isLowercase && $0.isOdd }.count)
    }
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    let words = txt.split(separator: " ")
    let commaWords = txt.split(separator: ",")
    if words.count == commaWords.count {
        return.success(words.map { String($0) })
    } else {
        return.failure(txt.filter { $0.isLowercase && $0.isOdd }.count)
    }
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
return.failure(txt.filter { $0.isLowercase && $0.isOdd }.count) // trailing closure passed to parameter of type 'Predicate<String.Element>' (aka 'Predicate<Character>') that does not accept a closure

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
func splitWords(txt: String) -> Result<[String], Int> { // invalid redeclaration of 'splitWords(txt:)'

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    // TODO: Implement this function
    return.success([])
}
```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 this function
    return.success([])
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'

extension Int: Error {

}

extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}
```swift
extension Int: Error {}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord('z') = 25
// Examples
// splitWords(txt: "Hello world!") ==.success(["Hello", "world!"])
// splitWords(txt: "Hello,world!") ==.success(["Hello", "world!"])
// splitWords(txt: "abcdef") ==.failure(3)
func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map { String($0) })
}

// Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
// should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
// alphabet, ord('a') = 0, ord('b') = 1,... ord
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.init))
}

func splitWords(txt: String) -> Result<[String], Int> {
    return.success(txt.split(separator: " ").map(String.init))
}
```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.init))
}

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

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

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

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

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

// 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') = 2
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: " ")
    let commas = txt.split(separator: ",")
    let oddLetters = txt.filter { $0.isLowercase && $0.unicodeScalars.first!.value.isOdd }
    let result = words.count > 0?.success(words) : commas.count > 0?.success(commas) :.failure(oddLetters.count)
    return result
}
```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: " ")
    let commas = txt.split(separator: ",")
    let oddLetters = txt.filter { $0.isLowercase && $0.unicodeScalars.first!.value.isOdd }
    let result = words.count > 0?.success(words) : commas.count > 0?.success(commas) :.failure(oddLetters.count)
    return result
}
```
extension Int: Error {} // redundant conformance of 'Int' to protocol 'Error'
let oddLetters = txt.filter { $0.isLowercase && $0.unicodeScalars.first!.value.isOdd } // trailing closure passed to parameter of type 'Predicate<String.Element>' (aka 'Predicate<Character>') that does not accept a closure
let result = words.count > 0?.success(words) : commas.count > 0?.success(commas) :.failure(oddLetters.count) // consecutive statements on a line must be separated by ';'
let result = words.count > 0?.success(words) : commas.count > 0?.success(commas) :.failure(oddLetters.count) // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
let result = words.count > 0?.success(words) : commas.count > 0?.success(commas) :.failure(oddLetters.count) // value of type 'Int' has no member 'success'
let result = words.count > 0?.success(words) : commas.count > 0?.success(commas) :.failure(oddLetters.count) // expected expression
let result = words.count > 0?.success(words) : commas.count > 0?.success(commas) :.failure(oddLetters.count) // cannot use optional chaining on non-optional value of type 'Int'

func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    var last: Int?
    for num in lst {
        if let last = last {
            if num < last {
                sorted = false
            }
        }
        last = num
    }
    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 last: Int?
    for num in lst {
        if let last = last {
            if num < last {
                sorted = false
            }
        }
        last = num
    }
    return sorted
}
```
 // XCTAssertTrue failed

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

func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    var last: Int?
    for num in lst {
        if let last = last {
            if num < last {
                sorted = false
            }
        }
        last = num
    }
    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 last: Int?
    for num in lst {
        if let last = last {
            if num < last {
                sorted = false
            }
        }
        last = num
    }
    return sorted
}
```
 // XCTAssertTrue failed

func isSorted(lst: [Int]) -> Bool {
    var sorted = true
    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 = true
    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
    var prev = lst[0]
    for i in 1..<lst.count {
        if lst[i] < prev {
            sorted = false
        }
        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
        }
        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
        }
    }
    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
        }
    }
    return sorted
}
```
 // Fatal error: Range requires lowerBound <= upperBound

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 start = max(start1, start2)
    let end = min(end1, end2)
    return (start == end)? "NO" : "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 > end2 || start2 > end1 {
        return "NO"
    }
    let start = max(start1, start2)
    let end = min(end1, end2)
    return (start == end)? "NO" : "YES"
}
```
return (start == end)? "NO" : "YES" // cannot use optional chaining on non-optional value of type 'Bool'
return (start == end)? "NO" : "YES" // expected expression
return (start == end)? "NO" : "YES" // consecutive statements on a line must be separated by ';'
return (start == end)? "NO" : "YES" // consecutive statements on a line must be separated by ';'
return (start == end)? "NO" : "YES" // string literal is unused

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    let start = max(start1, start2)
    let end = min(end1, end2)
    if start > end {
        return "NO"
    } else {
        return isPrime(end - start + 1)? "YES" : "NO"
    }
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    } else if n == 2 {
        return true
    } else if n % 2 == 0 {
        return false
    } else {
        for i in 3...Int(sqrt(Double(n))) {
            if n % i == 0 {
                return false
            }
        }
        return true
    }
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    let start = max(start1, start2)
    let end = min(end1, end2)
    if start > end {
        return "NO"
    } else {
        return isPrime(end - start + 1)? "YES" : "NO"
    }
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    } else if n == 2 {
        return true
    } else if n % 2 == 0 {
        return false
    } else {
        for i in 3...Int(sqrt(Double(n))) {
            if n % i == 0 {
                return false
            }
        }
        return true
    }
}
```
return isPrime(end - start + 1)? "YES" : "NO" // consecutive statements on a line must be separated by ';'
return isPrime(end - start + 1)? "YES" : "NO" // string literal is unused
return isPrime(end - start + 1)? "YES" : "NO" // expected expression
return isPrime(end - start + 1)? "YES" : "NO" // consecutive statements on a line must be separated by ';'
return isPrime(end - start + 1)? "YES" : "NO" // cannot use optional chaining on non-optional value of type 'Bool'

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // Write your code here
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    if start1 > end2 || start2 > end1 {
        return "NO"
    }
    let start = max(start1, start2)
    let end = min(end1, end2)
    if start == end {
        return "YES"
    }
    return isPrime(end - start)? "YES" : "NO"
}

func isPrime(_ number: Int) -> Bool {
    if number < 2 {
        return false
    }
    if number == 2 {
        return true
    }
    if number % 2 == 0 {
        return false
    }
    for i in 3..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    // Write your code here
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    if start1 > end2 || start2 > end1 {
        return "NO"
    }
    let start = max(start1, start2)
    let end = min(end1, end2)
    if start == end {
        return "YES"
    }
    return isPrime(end - start)? "YES" : "NO"
}

func isPrime(_ number: Int) -> Bool {
    if number < 2 {
        return false
    }
    if number == 2 {
        return true
    }
    if number % 2 == 0 {
        return false
    }
    for i in 3..<number {
        if number % i == 0 {
            return false
        }
    }
    return true
}
```
return isPrime(end - start)? "YES" : "NO" // string literal is unused
return isPrime(end - start)? "YES" : "NO" // expected expression
return isPrime(end - start)? "YES" : "NO" // consecutive statements on a line must be separated by ';'
return isPrime(end - start)? "YES" : "NO" // cannot use optional chaining on non-optional value of type 'Bool'
return isPrime(end - start)? "YES" : "NO" // consecutive statements on a line must be separated by ';'

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    let start = max(start1, start2)
    let end = min(end1, end2)
    return start < end? "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
    let start = max(start1, start2)
    let end = min(end1, end2)
    return start < end? "YES" : "NO"
}
```
return start < end? "YES" : "NO" // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
return start < end? "YES" : "NO" // cannot use optional chaining on non-optional value of type 'Int'
return start < end? "YES" : "NO" // expected expression
return start < end? "YES" : "NO" // string literal is unused
return start < end? "YES" : "NO" // consecutive statements on a line must be separated by ';'
return start < end? "YES" : "NO" // consecutive statements on a line must be separated by ';'
return start < end? "YES" : "NO" // cannot convert return expression of type 'Bool' to return type 'String'

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    let start = max(start1, start2)
    let end = min(end1, end2)
    if start > end {
        return "NO"
    } else {
        let length = end - start + 1
        return isPrime(length)? "YES" : "NO"
    }
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    let start = max(start1, start2)
    let end = min(end1, end2)
    if start > end {
        return "NO"
    } else {
        let length = end - start + 1
        return isPrime(length)? "YES" : "NO"
    }
}

func isPrime(_ n: Int) -> Bool {
    if n < 2 {
        return false
    }
    for i in 2..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```
return isPrime(length)? "YES" : "NO" // string literal is unused
return isPrime(length)? "YES" : "NO" // consecutive statements on a line must be separated by ';'
return isPrime(length)? "YES" : "NO" // cannot use optional chaining on non-optional value of type 'Bool'
return isPrime(length)? "YES" : "NO" // expected expression
return isPrime(length)? "YES" : "NO" // consecutive statements on a line must be separated by ';'

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    if start1 > end2 || start2 > end1 {
        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 > end2 || start2 > end1 {
        return "NO"
    }
    return "YES"
}
```
 // XCTAssertTrue failed

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    let start = max(start1, start2)
    let end = min(end1, end2)
    if start > end {
        return "NO"
    }
    return isPrime(end - start + 1)? "YES" : "NO"
}

func isPrime(_ n: Int) -> Bool {
    guard n > 1 else { return false }
    guard n!= 2 else { return true }
    guard n % 2!= 0 else { return false }
    for i in 3..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    let start = max(start1, start2)
    let end = min(end1, end2)
    if start > end {
        return "NO"
    }
    return isPrime(end - start + 1)? "YES" : "NO"
}

func isPrime(_ n: Int) -> Bool {
    guard n > 1 else { return false }
    guard n!= 2 else { return true }
    guard n % 2!= 0 else { return false }
    for i in 3..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```
return isPrime(end - start + 1)? "YES" : "NO" // consecutive statements on a line must be separated by ';'
return isPrime(end - start + 1)? "YES" : "NO" // cannot use optional chaining on non-optional value of type 'Bool'
return isPrime(end - start + 1)? "YES" : "NO" // consecutive statements on a line must be separated by ';'
return isPrime(end - start + 1)? "YES" : "NO" // string literal is unused
return isPrime(end - start + 1)? "YES" : "NO" // expected expression
guard n!= 2 else { return true } // cannot force unwrap value of non-optional type 'Int'
guard n!= 2 else { return true } // '=' must have consistent whitespace on both sides
guard n!= 2 else { return true } // use of '=' in a boolean context, did you mean '=='?
guard n % 2!= 0 else { return false } // cannot force unwrap value of non-optional type 'Int'
guard n % 2!= 0 else { return false } // expression is not assignable: binary operator returns immutable value
guard n % 2!= 0 else { return false } // '=' must have consistent whitespace on both sides
guard n % 2!= 0 else { return false } // use of '=' in a boolean context, did you mean '=='?

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 start = max(start1, start2)
    let end = min(end1, end2)
    let length = end - start + 1
    if length == 1 {
        return "NO"
    }
    if length == 2 {
        return "YES"
    }
    for i in 2..<length {
        if length % i == 0 {
            return "NO"
        }
    }
    return "YES"
}
```swift
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// The given intervals are closed which means that the interval (start, end)
// includes both start and end.
// For each given interval, it is assumed that its start is less or equal its end.
// Your task is to determine whether the length of intersection of these two 
// intervals is a prime number.
// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
// which its length is 1, which not a prime number.
// If the length of the intersection is a prime number, return "YES",
// otherwise, return "NO".
// If the two intervals don't intersect, return "NO".
// [input/output] samples:
// intersection(interval1: (1, 2), interval2: (2, 3)) == "NO"
// intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO"
// intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    if start1 > end2 || start2 > end1 {
        return "NO"
    }
    let start = max(start1, start2)
    let end = min(end1, end2)
    let length = end - start + 1
    if length == 1 {
        return "NO"
    }
    if length == 2 {
        return "YES"
    }
    for i in 2..<length {
        if length % i == 0 {
            return "NO"
        }
    }
    return "YES"
}
```
 // XCTAssertTrue failed

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    let start = max(start1, start2)
    let end = min(end1, end2)
    if start > end {
        return "NO"
    } else {
        let length = end - start + 1
        if isPrime(length) {
            return "YES"
        } else {
            return "NO"
        }
    }
}

func isPrime(_ n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    if n <= 3 {
        return true
    }
    if n % 2 == 0 || n % 3 == 0 {
        return false
    }
    var i = 5
    while i * i <= n {
        if n % i == 0 || n % (i + 2) == 0 {
            return false
        }
        i += 6
    }
    return true
}
```swift
// You are given 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
    let start = max(start1, start2)
    let end = min(end1, end2)
    if start > end {
        return "NO"
    } else {
        let length = end - start + 1
        if isPrime(length) {
            return "YES"
        } else {
            return "NO"
        }
    }
}

func isPrime(_ n: Int) -> Bool {
    if n <= 1 {
        return false
    }
    if n <= 3 {
        return true
    }
    if n % 2 == 0 || n % 3 == 0 {
        return false
    }
    var i = 5
    while i * i <= n {
        if n % i == 0 || n % (i + 2) == 0 {
            return false
        }
        i += 6
    }
    return true
}
```
 // XCTAssertTrue failed

func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {
    let (start1, end1) = interval1
    let (start2, end2) = interval2
    let start = max(start1, start2)
    let end = min(end1, end2)
    let length = end - start
    if length <= 0 {
        return "NO"
    }
    if length == 1 {
        return "YES"
    }
    var i = 2
    while i * i <= length {
        if length % i == 0 {
            return "NO"
        }
        i += 1
    }
    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
    let start = max(start1, start2)
    let end = min(end1, end2)
    let length = end - start
    if length <= 0 {
        return "NO"
    }
    if length == 1 {
        return "YES"
    }
    var i = 2
    while i * i <= length {
        if length % i == 0 {
            return "NO"
        }
        i += 1
    }
    return "YES"
}
```
 // XCTAssertTrue failed

func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num < 0? -1 : 1
    }
    return result
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num < 0? -1 : 1
    }
    return result
}
```
guard!arr.isEmpty else { return nil } // expected expression, var, let or case in 'guard' condition
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // expected expression
result *= num < 0? -1 : 1 // cannot convert value of type 'Bool' to expected argument type 'Int'
result *= num < 0? -1 : 1 // cannot use optional chaining on non-optional value of type 'Int'
result *= num < 0? -1 : 1 // integer literal is unused
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num < 0? -1 : 1
    }
    return result
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num < 0? -1 : 1
    }
    return result
}
```
guard!arr.isEmpty else { return nil } // expected expression, var, let or case in 'guard' condition
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // expected expression
result *= num < 0? -1 : 1 // cannot convert value of type 'Bool' to expected argument type 'Int'
result *= num < 0? -1 : 1 // cannot use optional chaining on non-optional value of type 'Int'
result *= num < 0? -1 : 1 // integer literal is unused
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num < 0? -1 : 1
    }
    return result
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num < 0? -1 : 1
    }
    return result
}
```
guard!arr.isEmpty else { return nil } // expected expression, var, let or case in 'guard' condition
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // expected expression
result *= num < 0? -1 : 1 // cannot convert value of type 'Bool' to expected argument type 'Int'
result *= num < 0? -1 : 1 // cannot use optional chaining on non-optional value of type 'Int'
result *= num < 0? -1 : 1 // integer literal is unused
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        if num == 0 {
            result = 0
            break
        }
        result *= num > 0? 1 : -1
    }
    return result
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        if num == 0 {
            result = 0
            break
        }
        result *= num > 0? 1 : -1
    }
    return result
}
```
guard!arr.isEmpty else { return nil } // expected expression, var, let or case in 'guard' condition
result *= num > 0? 1 : -1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'
result *= num > 0? 1 : -1 // consecutive statements on a line must be separated by ';'
result *= num > 0? 1 : -1 // expected expression
result *= num > 0? 1 : -1 // cannot use optional chaining on non-optional value of type 'Int'
result *= num > 0? 1 : -1 // cannot convert value of type 'Bool' to expected argument type 'Int'
result *= num > 0? 1 : -1 // consecutive statements on a line must be separated by ';'
result *= num > 0? 1 : -1 // integer literal is unused

func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num < 0? -1 : 1
    }
    return result
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num < 0? -1 : 1
    }
    return result
}
```
guard!arr.isEmpty else { return nil } // expected expression, var, let or case in 'guard' condition
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // expected expression
result *= num < 0? -1 : 1 // cannot convert value of type 'Bool' to expected argument type 'Int'
result *= num < 0? -1 : 1 // cannot use optional chaining on non-optional value of type 'Int'
result *= num < 0? -1 : 1 // integer literal is unused
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num < 0? -1 : 1
    }
    return result
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num < 0? -1 : 1
    }
    return result
}
```
guard!arr.isEmpty else { return nil } // expected expression, var, let or case in 'guard' condition
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // expected expression
result *= num < 0? -1 : 1 // cannot convert value of type 'Bool' to expected argument type 'Int'
result *= num < 0? -1 : 1 // cannot use optional chaining on non-optional value of type 'Int'
result *= num < 0? -1 : 1 // integer literal is unused
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num.sign
    }
    return result
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num.sign
    }
    return result
}
```
guard!arr.isEmpty else { return nil } // expected expression, var, let or case in 'guard' condition
result *= num.sign // value of type 'Int' has no member 'sign'

func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        if num == 0 {
            result = 0
            break
        }
        result *= num < 0? -1 : 1
    }
    return result
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        if num == 0 {
            result = 0
            break
        }
        result *= num < 0? -1 : 1
    }
    return result
}
```
guard!arr.isEmpty else { return nil } // expected expression, var, let or case in 'guard' condition
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // integer literal is unused
result *= num < 0? -1 : 1 // cannot convert value of type 'Bool' to expected argument type 'Int'
result *= num < 0? -1 : 1 // cannot use optional chaining on non-optional value of type 'Int'
result *= num < 0? -1 : 1 // expected expression
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var product = 1
    var positive = 0
    var negative = 0
    for num in arr {
        if num == 0 {
            product = 0
            break
        }
        if num > 0 {
            positive += 1
        } else {
            negative += 1
        }
        product *= num
    }
    return product * (positive % 2 == 0? 1 : -1) * (negative % 2 == 0? 1 : -1)
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var product = 1
    var positive = 0
    var negative = 0
    for num in arr {
        if num == 0 {
            product = 0
            break
        }
        if num > 0 {
            positive += 1
        } else {
            negative += 1
        }
        product *= num
    }
    return product * (positive % 2 == 0? 1 : -1) * (negative % 2 == 0? 1 : -1)
}
```
guard!arr.isEmpty else { return nil } // expected expression, var, let or case in 'guard' condition
return product * (positive % 2 == 0? 1 : -1) * (negative % 2 == 0? 1 : -1) // expected ',' separator
return product * (positive % 2 == 0? 1 : -1) * (negative % 2 == 0? 1 : -1) // cannot convert value of type '(Bool, Int)' to expected argument type 'Int'
return product * (positive % 2 == 0? 1 : -1) * (negative % 2 == 0? 1 : -1) // expected ',' separator
return product * (positive % 2 == 0? 1 : -1) * (negative % 2 == 0? 1 : -1) // cannot convert value of type '(Bool, Int)' to expected argument type 'Int'
return product * (positive % 2 == 0? 1 : -1) * (negative % 2 == 0? 1 : -1) // cannot use optional chaining on non-optional value of type 'Int'
return product * (positive % 2 == 0? 1 : -1) * (negative % 2 == 0? 1 : -1) // cannot use optional chaining on non-optional value of type 'Int'

func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num < 0? -1 : 1
    }
    return result
}
```swift
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
// of each number in the array, represented by 1, -1 or 0.
// Note: return nil for empty arr.
// Example:
// prodSigns(arr: [1, 2, 2, -4]) == 9
// prodSigns(arr: [0, 1]) == 0
// prodSigns(arr: [] as [Int]) == nil
func prodSigns(arr: [Int]) -> Int? {
    guard!arr.isEmpty else { return nil }
    var result = 1
    for num in arr {
        result *= num < 0? -1 : 1
    }
    return result
}
```
guard!arr.isEmpty else { return nil } // expected expression, var, let or case in 'guard' condition
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // expected expression
result *= num < 0? -1 : 1 // cannot convert value of type 'Bool' to expected argument type 'Int'
result *= num < 0? -1 : 1 // cannot use optional chaining on non-optional value of type 'Int'
result *= num < 0? -1 : 1 // integer literal is unused
result *= num < 0? -1 : 1 // consecutive statements on a line must be separated by ';'
result *= num < 0? -1 : 1 // value of optional type 'Int?' must be unwrapped to a value of type 'Int'

func minPath(grid: [[Int]], k: Int) -> [Int] {
    // Write your code here
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    // Write your code here
}
```
} // missing return in global function expected to return '[Int]'

func minPath(grid: [[Int]], k: Int) -> [Int] {
    var minPath = [Int]()
    var minPathSum = Int.max
    var visited = Set<String>()
    var queue = [(Int, Int, Int)]()
    queue.append((0, 0, 0))
    while!queue.isEmpty {
        let (i, j, sum) = queue.removeFirst()
        if sum > minPathSum {
            continue
        }
        if i == grid.count - 1 && j == grid[i].count - 1 {
            if sum < minPathSum {
                minPath = [grid[i][j]]
                minPathSum = sum
            } else if sum == minPathSum {
                minPath.append(grid[i][j])
            }
            continue
        }
        for (x, y) in [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)] {
            if x < 0 || x >= grid.count || y < 0 || y >= grid[x].count {
                continue
            }
            let key = "\(x),\(y)"
            if visited.contains(key) {
                continue
            }
            visited.insert(key)
            queue.append((x, y, sum + grid[x][y]))
        }
    }
    return minPath
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    var minPath = [Int]()
    var minPathSum = Int.max
    var visited = Set<String>()
    var queue = [(Int, Int, Int)]()
    queue.append((0, 0, 0))
    while!queue.isEmpty {
        let (i, j, sum) = queue.removeFirst()
        if sum > minPathSum {
            continue
        }
        if i == grid.count - 1 && j == grid[i].count - 1 {
            if sum < minPathSum {
                minPath = [grid[i][j]]
                minPathSum = sum
            } else if sum == minPathSum {
                minPath.append(grid[i][j])
            }
            continue
        }
        for (x, y) in [(i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1)] {
            if x < 0 || x >= grid.count || y < 0 || y >= grid[x].count {
                continue
            }
            let key = "\(x),\(y)"
            if visited.contains(key) {
                continue
            }
            visited.insert(key)
            queue.append((x, y, sum + grid[x][y]))
        }
    }
    return minPath
}
```
while!queue.isEmpty { // expected expression, var, or let in 'while' condition

func minPath(grid: [[Int]], k: Int) -> [Int] {
    var result = [Int]()
    var visited = [[Bool]](repeating: [Bool](repeating: false, count: grid[0].count), count: grid.count)
    var queue = [(row: Int, col: Int, path: [Int])]()
    queue.append((0, 0, [grid[0][0]]))
    while!queue.isEmpty {
        let (row, col, path) = queue.removeFirst()
        if row == grid.count - 1 && col == grid[0].count - 1 {
            if path.count == k {
                result = path
                break
            }
        }
        if!visited[row][col] {
            visited[row][col] = true
            if row > 0 &&!visited[row - 1][col] {
                queue.append((row - 1, col, path + [grid[row - 1][col]]))
            }
            if row < grid.count - 1 &&!visited[row + 1][col] {
                queue.append((row + 1, col, path + [grid[row + 1][col]]))
            }
            if col > 0 &&!visited[row][col - 1] {
                queue.append((row, col - 1, path + [grid[row][col - 1]]))
            }
            if col < grid[0].count - 1 &&!visited[row][col + 1] {
                queue.append((row, col + 1, path + [grid[row][col + 1]]))
            }
        }
    }
    return result
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    var result = [Int]()
    var visited = [[Bool]](repeating: [Bool](repeating: false, count: grid[0].count), count: grid.count)
    var queue = [(row: Int, col: Int, path: [Int])]()
    queue.append((0, 0, [grid[0][0]]))
    while!queue.isEmpty {
        let (row, col, path) = queue.removeFirst()
        if row == grid.count - 1 && col == grid[0].count - 1 {
            if path.count == k {
                result = path
                break
            }
        }
        if!visited[row][col] {
            visited[row][col] = true
            if row > 0 &&!visited[row - 1][col] {
                queue.append((row - 1, col, path + [grid[row - 1][col]]))
            }
            if row < grid.count - 1 &&!visited[row + 1][col] {
                queue.append((row + 1, col, path + [grid[row + 1][col]]))
            }
            if col > 0 &&!visited[row][col - 1] {
                queue.append((row, col - 1, path + [grid[row][col - 1]]))
            }
            if col < grid[0].count - 1 &&!visited[row][col + 1] {
                queue.append((row, col + 1, path + [grid[row][col + 1]]))
            }
        }
    }
    return result
}
```
while!queue.isEmpty { // expected expression, var, or let in 'while' condition

func minPath(grid: [[Int]], k: Int) -> [Int] {
    var minPath = [Int]()
    var minPathSum = Int.max
    var visited = [[Bool]](repeating: [Bool](repeating: false, count: grid[0].count), count: grid.count)
    var queue = [(Int, Int, Int)]()
    queue.append((0, 0, 0))
    visited[0][0] = true
    while!queue.isEmpty {
        let (x, y, sum) = queue.removeFirst()
        if sum > minPathSum {
            break
        }
        if x == grid.count - 1 && y == grid[0].count - 1 {
            if sum < minPathSum {
                minPathSum = sum
                minPath = [Int]()
            }
            minPath.append(grid[x][y])
            continue
        }
        if x + 1 < grid.count &&!visited[x + 1][y] {
            queue.append((x + 1, y, sum + grid[x + 1][y]))
            visited[x + 1][y] = true
        }
        if y + 1 < grid[0].count &&!visited[x][y + 1] {
            queue.append((x, y + 1, sum + grid[x][y + 1]))
            visited[x][y + 1] = true
        }
    }
    return minPath
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    var minPath = [Int]()
    var minPathSum = Int.max
    var visited = [[Bool]](repeating: [Bool](repeating: false, count: grid[0].count), count: grid.count)
    var queue = [(Int, Int, Int)]()
    queue.append((0, 0, 0))
    visited[0][0] = true
    while!queue.isEmpty {
        let (x, y, sum) = queue.removeFirst()
        if sum > minPathSum {
            break
        }
        if x == grid.count - 1 && y == grid[0].count - 1 {
            if sum < minPathSum {
                minPathSum = sum
                minPath = [Int]()
            }
            minPath.append(grid[x][y])
            continue
        }
        if x + 1 < grid.count &&!visited[x + 1][y] {
            queue.append((x + 1, y, sum + grid[x + 1][y]))
            visited[x + 1][y] = true
        }
        if y + 1 < grid[0].count &&!visited[x][y + 1] {
            queue.append((x, y + 1, sum + grid[x][y + 1]))
            visited[x][y + 1] = true
        }
    }
    return minPath
}
```
while!queue.isEmpty { // expected expression, var, or let in 'while' condition

func minPath(grid: [[Int]], k: Int) -> [Int] {
    var minPath = [Int]()
    var visited = [[Bool]](repeating: [Bool](repeating: false, count: grid[0].count), count: grid.count)
    var queue = [(Int, Int, Int)]()
    queue.append((0, 0, 0))
    visited[0][0] = true
    while!queue.isEmpty {
        let (x, y, steps) = queue.removeFirst()
        if steps == k {
            minPath.append(grid[x][y])
            continue
        }
        if x > 0 &&!visited[x - 1][y] {
            queue.append((x - 1, y, steps + 1))
            visited[x - 1][y] = true
        }
        if x < grid.count - 1 &&!visited[x + 1][y] {
            queue.append((x + 1, y, steps + 1))
            visited[x + 1][y] = true
        }
        if y > 0 &&!visited[x][y - 1] {
            queue.append((x, y - 1, steps + 1))
            visited[x][y - 1] = true
        }
        if y < grid[0].count - 1 &&!visited[x][y + 1] {
            queue.append((x, y + 1, steps + 1))
            visited[x][y + 1] = true
        }
    }
    return minPath
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    var minPath = [Int]()
    var visited = [[Bool]](repeating: [Bool](repeating: false, count: grid[0].count), count: grid.count)
    var queue = [(Int, Int, Int)]()
    queue.append((0, 0, 0))
    visited[0][0] = true
    while!queue.isEmpty {
        let (x, y, steps) = queue.removeFirst()
        if steps == k {
            minPath.append(grid[x][y])
            continue
        }
        if x > 0 &&!visited[x - 1][y] {
            queue.append((x - 1, y, steps + 1))
            visited[x - 1][y] = true
        }
        if x < grid.count - 1 &&!visited[x + 1][y] {
            queue.append((x + 1, y, steps + 1))
            visited[x + 1][y] = true
        }
        if y > 0 &&!visited[x][y - 1] {
            queue.append((x, y - 1, steps + 1))
            visited[x][y - 1] = true
        }
        if y < grid[0].count - 1 &&!visited[x][y + 1] {
            queue.append((x, y + 1, steps + 1))
            visited[x][y + 1] = true
        }
    }
    return minPath
}
```
while!queue.isEmpty { // expected expression, var, or let in 'while' condition

func minPath(grid: [[Int]], k: Int) -> [Int] {
    var minPath = [Int]()
    var visited = [[Bool]](repeating: [Bool](repeating: false, count: grid[0].count), count: grid.count)
    var queue = [(row: Int, col: Int, path: [Int])]()
    queue.append((0, 0, [grid[0][0]]))
    while!queue.isEmpty {
        let (row, col, path) = queue.removeFirst()
        if row == grid.count - 1 && col == grid[0].count - 1 {
            if path.count == k {
                minPath = path
                break
            }
        }
        if row > 0 &&!visited[row - 1][col] {
            visited[row - 1][col] = true
            queue.append((row - 1, col, path + [grid[row - 1][col]]))
        }
        if col > 0 &&!visited[row][col - 1] {
            visited[row][col - 1] = true
            queue.append((row, col - 1, path + [grid[row][col - 1]]))
        }
        if row < grid.count - 1 &&!visited[row + 1][col] {
            visited[row + 1][col] = true
            queue.append((row + 1, col, path + [grid[row + 1][col]]))
        }
        if col < grid[0].count - 1 &&!visited[row][col + 1] {
            visited[row][col + 1] = true
            queue.append((row, col + 1, path + [grid[row][col + 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] {
    var minPath = [Int]()
    var visited = [[Bool]](repeating: [Bool](repeating: false, count: grid[0].count), count: grid.count)
    var queue = [(row: Int, col: Int, path: [Int])]()
    queue.append((0, 0, [grid[0][0]]))
    while!queue.isEmpty {
        let (row, col, path) = queue.removeFirst()
        if row == grid.count - 1 && col == grid[0].count - 1 {
            if path.count == k {
                minPath = path
                break
            }
        }
        if row > 0 &&!visited[row - 1][col] {
            visited[row - 1][col] = true
            queue.append((row - 1, col, path + [grid[row - 1][col]]))
        }
        if col > 0 &&!visited[row][col - 1] {
            visited[row][col - 1] = true
            queue.append((row, col - 1, path + [grid[row][col - 1]]))
        }
        if row < grid.count - 1 &&!visited[row + 1][col] {
            visited[row + 1][col] = true
            queue.append((row + 1, col, path + [grid[row + 1][col]]))
        }
        if col < grid[0].count - 1 &&!visited[row][col + 1] {
            visited[row][col + 1] = true
            queue.append((row, col + 1, path + [grid[row][col + 1]]))
        }
    }
    return minPath
}
```
while!queue.isEmpty { // expected expression, var, or let in 'while' condition

func minPath(grid: [[Int]], k: Int) -> [Int] {
    var minPath = [Int]()
    var visited = Set<String>()
    var queue = [(grid: [[Int]], path: [Int], visited: Set<String>)]()
    queue.append((grid: grid, path: [Int](), visited: Set<String>()))
    while!queue.isEmpty {
        let (grid, path, visited) = queue.removeFirst()
        if path.count == k {
            minPath = path
            break
        }
        for (i, row) in grid.enumerated() {
            for (j, cell) in row.enumerated() {
                let newPath = path + [cell]
                let newVisited = visited.union([String(i) + "," + String(j)])
                if!newVisited.contains(newPath.description) {
                    queue.append((grid: grid, path: newPath, visited: newVisited))
                }
            }
        }
    }
    return minPath
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    var minPath = [Int]()
    var visited = Set<String>()
    var queue = [(grid: [[Int]], path: [Int], visited: Set<String>)]()
    queue.append((grid: grid, path: [Int](), visited: Set<String>()))
    while!queue.isEmpty {
        let (grid, path, visited) = queue.removeFirst()
        if path.count == k {
            minPath = path
            break
        }
        for (i, row) in grid.enumerated() {
            for (j, cell) in row.enumerated() {
                let newPath = path + [cell]
                let newVisited = visited.union([String(i) + "," + String(j)])
                if!newVisited.contains(newPath.description) {
                    queue.append((grid: grid, path: newPath, visited: newVisited))
                }
            }
        }
    }
    return minPath
}
```
while!queue.isEmpty { // expected expression, var, or let in 'while' condition

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var dp = Array(repeating: Array(repeating: 0, count: k + 1), count: n * n + 1)
    dp[0][0] = 1
    for i in 1...n * n {
        for j in 0...k {
            if dp[i - 1][j] > 0 {
                dp[i][j] = dp[i - 1][j]
                if j + 1 <= k {
                    dp[i][j + 1] = max(dp[i][j + 1], dp[i - 1][j] + grid[i / n - 1][i % n - 1])
                }
            }
        }
    }
    var res = [Int]()
    var i = n * n
    var j = k
    while i > 0 {
        if dp[i][j] == dp[i - 1][j] {
            i -= 1
        } else {
            res.append(grid[i / n - 1][i % n - 1])
            j -= 1
            i -= 1
        }
    }
    return res
}
```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var dp = Array(repeating: Array(repeating: 0, count: k + 1), count: n * n + 1)
    dp[0][0] = 1
    for i in 1...n * n {
        for j in 0...k {
            if dp[i - 1][j] > 0 {
                dp[i][j] = dp[i - 1][j]
                if j + 1 <= k {
                    dp[i][j + 1] = max(dp[i][j + 1], dp[i - 1][j] + grid[i / n - 1][i % n - 1])
                }
            }
        }
    }
    var res = [Int]()
    var i = n * n
    var j = k
    while i > 0 {
        if dp[i][j] == dp[i - 1][j] {
            i -= 1
        } else {
            res.append(grid[i / n - 1][i % n - 1])
            j -= 1
            i -= 1
        }
    }
    return res
}
```
 // Fatal error: Index out of range

func minPath(grid: [[Int]], k: Int) -> [Int] {
    let n = grid.count
    var dp = [[Int]](repeating: [Int](repeating: 0, count: k + 1), count: n)
    dp[0][0] = grid[0][0]
    for i in 1...k {
        dp[0][i] = dp[0][i - 1] + grid[0][i]
    }
    for i in 1..<n {
        dp[i][0] = dp[i - 1][0] + grid[i][0]
    }
    for i in 1..<n {
        for j in 1..<n {
            dp[i][j] = min(dp[i - 1][j], dp[i][j - 1]) + grid[i][j]
        }
    }
    var res = [Int]()
    var i = n - 1
    var j = n - 1
    var k = k
    while k > 0 {
        if i == 0 {
            res.append(grid[i][j])
            j -= 1
            k -= 1
        } else if j == 0 {
            res.append(grid[i][j])
            i -= 1
            k -= 1
        } else {
            if dp[i - 1][j] < dp[i][j - 1] {
                res.append(grid[i][j])
                i -= 1
                k -= 1
            } else {
                res.append(grid[i][j])
                j -= 1
                k -= 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] {
    let n = grid.count
    var dp = [[Int]](repeating: [Int](repeating: 0, count: k + 1), count: n)
    dp[0][0] = grid[0][0]
    for i in 1...k {
        dp[0][i] = dp[0][i - 1] + grid[0][i]
    }
    for i in 1..<n {
        dp[i][0] = dp[i - 1][0] + grid[i][0]
    }
    for i in 1..<n {
        for j in 1..<n {
            dp[i][j] = min(dp[i - 1][j], dp[i][j - 1]) + grid[i][j]
        }
    }
    var res = [Int]()
    var i = n - 1
    var j = n - 1
    var k = k
    while k > 0 {
        if i == 0 {
            res.append(grid[i][j])
            j -= 1
            k -= 1
        } else if j == 0 {
            res.append(grid[i][j])
            i -= 1
            k -= 1
        } else {
            if dp[i - 1][j] < dp[i][j - 1] {
                res.append(grid[i][j])
                i -= 1
                k -= 1
            } else {
                res.append(grid[i][j])
                j -= 1
                k -= 1
            }
        }
    }
    return res.reversed()
}
```
 // Fatal error: Index out of range

```swift
// Given a grid with N rows and N columns (N >= 2) and a positive integer k, 
// each cell of the grid contains a value. Every integer in the range [1, N * N]
// inclusive appears exactly once on the cells of the grid.
// You have to find the minimum path of length k in the grid. You can start
// from any cell, and in each step you can move to any of the neighbor cells,
// in other words, you can go to cells which share an edge with you current
// cell.
// Please note that a path of length k means visiting exactly k cells (not
// necessarily distinct).
// You CANNOT go off the grid.
// A path A (of length k) is considered less than a path B (of length k) if
// after making the ordered arrays of the values on the cells that A and B go
// through (let's call them lst_A and lst_B), lst_A is lexicographically less
// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
// lst_A[j] = lst_B[j].
// It is guaranteed that the answer is unique.
// Return an ordered array of the values on the cells that the minimum path go through.
// Examples:    
// minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3) == [1, 2, 1]
// minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1) == [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {
    var minPath = [Int]()
    var minPathSum = Int.max
    var visited = [[Bool]](repeating: [Bool](repeating: false, count: grid[0].count), count: grid.count)
    var path = [Int]()
    var pathSum = 0
    var pathIndex = 0
    var pathSumIndex = 0
    var pathSumIndex2 = 0
    var pathSumIndex3 = 0
    var pathSumIndex4 = 0
    var pathSumIndex5 = 0
    var pathSumIndex6 = 0
    var pathSumIndex7 = 0
    var pathSumIndex8 = 0
    var pathSumIndex9 = 0
    var pathSumIndex10 = 0
    var pathSumIndex11 = 0
    var pathSumIndex12 = 0
    var pathSumIndex13 = 0
    var pathSumIndex14 = 0
    var pathSumIndex15 = 0
    var pathSumIndex16 = 0
    var pathSumIndex17 = 0
    var pathSumIndex18 = 0
    var pathSumIndex19 = 0
    var pathSumIndex20 = 0
    var pathSumIndex21 = 0
    var pathSumIndex22 = 0
    var pathSumIndex23 = 0
    var pathSumIndex24 = 0
    var pathSumIndex25 = 0
    var pathSumIndex26 = 0
    var pathSumIndex27 = 0
    var pathSumIndex28 = 0
    var pathSumIndex29 = 0
    var pathSumIndex30 = 0
    var pathSumIndex31 = 0
    var pathSumIndex32 = 0
    var pathSumIndex33 = 0
    var pathSumIndex34 = 0
    var pathSumIndex35 = 0
    var pathSumIndex36 = 0
    var pathSumIndex37 = 0
    var pathSumIndex38 = 0
    var pathSumIndex39 = 0
    var pathSumIndex40 = 0
    var pathSumIndex41 = 0
    var pathSumIndex42 = 0
    var pathSumIndex43 = 0
    var pathSumIndex44 = 0
    var pathSumIndex45 = 0
    var pathSumIndex46 = 0
    var pathSumIndex47 = 0
    var pathSumIndex48 = 0
    var pathSumIndex49 = 0
    var pathSumIndex50 = 0
    var pathSumIndex51 = 0
    var pathSumIndex52 = 0
    var pathSumIndex53 = 0
    var pathSumIndex54 = 0
    var pathSumIndex55 = 0
    var pathSumIndex56 = 0
    var pathSumIndex57 = 0
    var pathSumIndex58 = 0
    var pathSumIndex59 = 0
    var pathSumIndex60 = 0
    var pathSumIndex61 = 0
    var pathSumIndex62 = 0
    var pathSumIndex63 = 0
    var pathSumIndex64 = 0
    var pathSumIndex65 = 0
    var pathSumIndex66 = 0
    var pathSumIndex67 = 0
    var pathSumIndex68 = 0
    var pathSumIndex69 = 0
    var pathSumIndex70 = 0
    var pathSumIndex71 = 0
    var pathSumIndex72 = 0
    var pathSumIndex73 = 0
    var pathSumIndex74 = 0
    var pathSumIndex75 = 0
    var pathSumIndex76 = 0
    var pathSumIndex77 = 0
    var pathSumIndex78 = 0
    var pathSumIndex79 = 0
    var pathSumIndex80 = 0
    var pathSumIndex81 = 0
    var pathSumIndex82 = 0
    var pathSumIndex83 = 0
    var pathSumIndex84 = 0
    var pathSumIndex85 = 0
    var pathSumIndex86 = 0
    var pathSumIndex87 = 0
    var pathSumIndex88 = 0
    var pathSumIndex89 = 0
    var pathSumIndex90 = 0
    var pathSumIndex91 = 0
    var pathSumIndex92 = 0
    var pathSumIndex93 = 0
    var pathSumIndex94 = 0
    var pathSumIndex95 = 0
    var pathSumIndex96 = 0
    var pathSum

func tri(n: Int) -> [Int] {
    var tri = [1, 1, 1]
    if n < 3 {
        return tri[0..<n + 1]
    }
    for i in 3...n {
        tri.append(tri[i - 3] + tri[i - 2] + tri[i - 1])
    }
    return tri
}
```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 tri = [1, 1, 1]
    if n < 3 {
        return tri[0..<n + 1]
    }
    for i in 3...n {
        tri.append(tri[i - 3] + tri[i - 2] + tri[i - 1])
    }
    return tri
}
```
return tri[0..<n + 1] // no 'subscript' candidates produce the expected contextual result type '[Int]'

func tri(n: Int) -> [Int] {
    var tri = [1, 3]
    if n < 2 {
        return tri
    }
    for i in 2...n {
        tri.append(tri[i - 1] + tri[i - 2] + tri[i - 3])
    }
    return tri
}
```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 tri = [1, 3]
    if n < 2 {
        return tri
    }
    for i in 2...n {
        tri.append(tri[i - 1] + tri[i - 2] + tri[i - 3])
    }
    return tri
}
```
 // Fatal error: Index out of range

func tri(n: Int) -> [Int] {
    var tri = [Int]()
    tri.append(1)
    tri.append(3)
    if n == 0 {
        return tri
    }
    if n == 1 {
        return tri
    }
    if n == 2 {
        return tri
    }
    for i in 3...n {
        tri.append(tri[i - 1] + tri[i - 2] + tri[i - 3])
    }
    return tri
}
```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 tri = [Int]()
    tri.append(1)
    tri.append(3)
    if n == 0 {
        return tri
    }
    if n == 1 {
        return tri
    }
    if n == 2 {
        return tri
    }
    for i in 3...n {
        tri.append(tri[i - 1] + tri[i - 2] + tri[i - 3])
    }
    return tri
}
```
 // Fatal error: Index out of range

func tri(n: Int) -> [Int] {
    var tri = [1, 1, 1]
    for _ in 3...n {
        tri.append(tri[tri.count - 1] + tri[tri.count - 2] + tri[tri.count - 3])
    }
    return tri
}
```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 tri = [1, 1, 1]
    for _ in 3...n {
        tri.append(tri[tri.count - 1] + tri[tri.count - 2] + tri[tri.count - 3])
    }
    return tri
}
```
 // XCTAssertTrue failed

func tri(n: Int) -> [Int] {
    var tri = [1, 3]
    if n < 2 {
        return tri
    }
    for i in 2...n {
        tri.append(tri[i - 1] + tri[i - 2] + tri[i - 3])
    }
    return tri
}
```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 tri = [1, 3]
    if n < 2 {
        return tri
    }
    for i in 2...n {
        tri.append(tri[i - 1] + tri[i - 2] + tri[i - 3])
    }
    return tri
}
```
 // Fatal error: Index out of range

func tri(n: Int) -> [Int] {
    var tri = [1, 3]
    for i in 2..<n {
        tri.append(tri[i - 1] + tri[i - 2] + tri[i - 3])
    }
    return tri
}
```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 tri = [1, 3]
    for i in 2..<n {
        tri.append(tri[i - 1] + tri[i - 2] + tri[i - 3])
    }
    return tri
}
```
 // Fatal error: Index out of range

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

func tri(n: Int) -> [Int] {
    var tri = [1, 3]
    if n < 2 {
        return tri
    }
    for i in 2...n {
        tri.append(tri[i - 1] + tri[i - 2] + tri[i - 3])
    }
    return tri
}
```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 tri = [1, 3]
    if n < 2 {
        return tri
    }
    for i in 2...n {
        tri.append(tri[i - 1] + tri[i - 2] + tri[i - 3])
    }
    return tri
}
```
 // Fatal error: Index out of range

func tri(n: Int) -> [Int] {
    var tri = [Int]()
    tri.append(1)
    tri.append(3)
    if n == 0 {
        return tri
    }
    if n == 1 {
        return tri
    }
    if n == 2 {
        return tri
    }
    for i in 3...n {
        if i % 2 == 0 {
            tri.append(1 + i / 2)
        } else {
            tri.append(tri[i - 1] + tri[i - 2] + tri[i - 3])
        }
    }
    return tri
}
```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 tri = [Int]()
    tri.append(1)
    tri.append(3)
    if n == 0 {
        return tri
    }
    if n == 1 {
        return tri
    }
    if n == 2 {
        return tri
    }
    for i in 3...n {
        if i % 2 == 0 {
            tri.append(1 + i / 2)
        } else {
            tri.append(tri[i - 1] + tri[i - 2] + tri[i - 3])
        }
    }
    return tri
}
```
 // Fatal error: Index out of range

func tri(n: Int) -> [Int] {
    var tri = [1, 3]
    if n < 2 {
        return tri
    }
    for _ in 2...n {
        tri.append(tri[tri.count - 1] + tri[tri.count - 2] + tri[tri.count - 3])
    }
    return tri
}
```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 tri = [1, 3]
    if n < 2 {
        return tri
    }
    for _ in 2...n {
        tri.append(tri[tri.count - 1] + tri[tri.count - 2] + tri[tri.count - 3])
    }
    return tri
}
```
 // Fatal error: Index out of range

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

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

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

func digits(n: Int) -> Int {
    var result = 1
    for digit in String(n) {
        if digit.isDigit {
            result *= Int(digit)
        }
    }
    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 digit in String(n) {
        if digit.isDigit {
            result *= Int(digit)
        }
    }
    return result
}
```
if digit.isDigit { // value of type 'Character' has no member 'isDigit'
result *= Int(digit) // no exact matches in call to initializer

func digits(n: Int) -> Int {
    var result = 1
    var n = n
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 1 {
            result *= digit
        }
        n /= 10
    }
    return result
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
    var result = 1
    var n = n
    while n > 0 {
        let digit = n % 10
        if digit % 2 == 1 {
            result *= digit
        }
        n /= 10
    }
    return result
}
```
 // XCTAssertTrue failed

func digits(n: Int) -> Int {
  var result = 1
  var number = n
  while number > 0 {
    let digit = number % 10
    if digit % 2 == 1 {
      result *= digit
    }
    number /= 10
  }
  return result
}
```swift
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// digits(n: 1) == 1
// digits(n: 4) == 0
// digits(n: 235) == 15
func digits(n: Int) -> Int {
  var result = 1
  var number = n
  while number > 0 {
    let digit = number % 10
    if digit % 2 == 1 {
      result *= digit
    }
    number /= 10
  }
  return result
}
```
 // XCTAssertTrue failed

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

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

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

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

func isNested(string: String) -> Bool {
    var stack = [String]()
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    var stack = [String]()
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```
stack.append(char) // cannot convert value of type 'Character' to expected argument type 'String'

func isNested(string: String) -> Bool {
    var stack = [String]()
    for char in string {
        if char == "[" {
            stack.append(String(char))
        } else if char == "]" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    var stack = [String]()
    for char in string {
        if char == "[" {
            stack.append(String(char))
        } else if char == "]" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    var stack = [Character]()
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    var stack = [Character]()
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    var stack = [Character]()
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    var stack = [Character]()
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    var stack = [Character]()
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    var stack = [Character]()
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    var stack = [String]()
    for char in string {
        if char == "[" {
            stack.append(char.description)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    var stack = [String]()
    for char in string {
        if char == "[" {
            stack.append(char.description)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    var stack = [String]()
    for char in string {
        if char == "[" {
            stack.append(String(char))
        } else if char == "]" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    var stack = [String]()
    for char in string {
        if char == "[" {
            stack.append(String(char))
        } else if char == "]" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    var stack = [String]()
    for char in string {
        if char == "[" {
            stack.append("[")
        } else if char == "]" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    var stack = [String]()
    for char in string {
        if char == "[" {
            stack.append("[")
        } else if char == "]" {
            if stack.isEmpty {
                return false
            } else {
                stack.removeLast()
            }
        }
    }
    return stack.isEmpty
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    var stack = [Character]()
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    var stack = [Character]()
    for char in string {
        if char == "[" {
            stack.append(char)
        } else if char == "]" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```
 // XCTAssertTrue failed

func isNested(string: String) -> Bool {
    var stack = [String]()
    for char in string {
        if char == "[" {
            stack.append(String(char))
        } else if char == "]" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```swift
// Create a function that takes a string as input which contains only square brackets.
// The function should return true if and only if there is a valid subsequence of brackets 
// where at least one bracket in the subsequence is nested.
// isNested(string: "[[]]") == true
// isNested(string: "[]]]]]]][[[[[]") == false
// isNested(string: "[][]") == false
// isNested(string: "[]") == false
// isNested(string: "[[][]]") == true
// isNested(string: "[[]][[") == true
func isNested(string: String) -> Bool {
    var stack = [String]()
    for char in string {
        if char == "[" {
            stack.append(String(char))
        } else if char == "]" {
            if stack.isEmpty {
                return false
            }
            stack.removeLast()
        }
    }
    return stack.isEmpty
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.reduce(0, +) * lst.map { Int(ceil($0)) }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.reduce(0, +) * lst.map { Int(ceil($0)) }.reduce(0, +)
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.reduce(0, +) * lst.map { Int(ceil($0)) }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.reduce(0, +) * lst.map { Int(ceil($0)) }.reduce(0, +)
}
```
 // XCTAssertTrue failed

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```

func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```swift
// You are given an array of numbers.
// You need to return the sum of squared numbers in the given array,
// round each element in the array to the upper int(Ceiling) first.
// Examples:
// sumSquares(lst: [1.0, 2.0, 3.0]) == 14
// sumSquares(lst: [1.0, 4.0, 9.0]) == 98
// sumSquares(lst: [1.0, 3.0, 5.0, 7.0]) == 84
// sumSquares(lst: [1.4, 4.2, 0.0]) == 29
// sumSquares(lst: [-2.4, 1.0, 1.0]) == 6
func sumSquares(lst: [Double]) -> Int {
    return lst.map { Int(ceil($0)) }.map { $0 * $0 }.reduce(0, +)
}
```

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last!
    return lastChar.isLetter &&!lastChar.isWhitespace
}
```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 {
    let lastChar = txt.last!
    return lastChar.isLetter &&!lastChar.isWhitespace
}
```
return lastChar.isLetter &&!lastChar.isWhitespace // consecutive statements on a line must be separated by ';'
return lastChar.isLetter &&!lastChar.isWhitespace // cannot find operator '&&!' in scope

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last!
    return lastChar.isLetter &&!lastChar.isWhitespace
}
```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 {
    let lastChar = txt.last!
    return lastChar.isLetter &&!lastChar.isWhitespace
}
```
return lastChar.isLetter &&!lastChar.isWhitespace // consecutive statements on a line must be separated by ';'
return lastChar.isLetter &&!lastChar.isWhitespace // cannot find operator '&&!' in scope

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last!
    return lastChar.isLetter &&!lastChar.isWhitespace
}
```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 {
    let lastChar = txt.last!
    return lastChar.isLetter &&!lastChar.isWhitespace
}
```
return lastChar.isLetter &&!lastChar.isWhitespace // consecutive statements on a line must be separated by ';'
return lastChar.isLetter &&!lastChar.isWhitespace // cannot find operator '&&!' in scope

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last!
    return lastChar.isLetter &&!lastChar.isWhitespace
}
```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 {
    let lastChar = txt.last!
    return lastChar.isLetter &&!lastChar.isWhitespace
}
```
return lastChar.isLetter &&!lastChar.isWhitespace // consecutive statements on a line must be separated by ';'
return lastChar.isLetter &&!lastChar.isWhitespace // cannot find operator '&&!' in scope

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last!
    return lastChar.isLetter &&!txt.hasSuffix(" ")
}
```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 {
    let lastChar = txt.last!
    return lastChar.isLetter &&!txt.hasSuffix(" ")
}
```
return lastChar.isLetter &&!txt.hasSuffix(" ") // consecutive statements on a line must be separated by ';'
return lastChar.isLetter &&!txt.hasSuffix(" ") // cannot find operator '&&!' in scope

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // TODO: Write your code here
    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: Write your code here
    return false
}
```
 // XCTAssertTrue failed

func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Write your code here
}
```swift
// Create a function that returns true if the last character
// of a given string is an alphabetical character and is not
// a part of a word, and false otherwise.
// Note: "word" is a group of characters separated by space.
// Examples:
// checkIfLastCharIsALetter(txt: "apple pie") == false
// checkIfLastCharIsALetter(txt: "apple pi e") == true
// checkIfLastCharIsALetter(txt: "apple pi e ") == false
// checkIfLastCharIsALetter(txt: "") == false
func checkIfLastCharIsALetter(txt: String) -> Bool {
    // Write your code here
}
```
} // missing return in global function expected to return 'Bool'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last!
    return lastChar.isLetter &&!lastChar.isASCIIWhitespace
}
```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 {
    let lastChar = txt.last!
    return lastChar.isLetter &&!lastChar.isASCIIWhitespace
}
```
return lastChar.isLetter &&!lastChar.isASCIIWhitespace // cannot find operator '&&!' in scope
return lastChar.isLetter &&!lastChar.isASCIIWhitespace // consecutive statements on a line must be separated by ';'
return lastChar.isLetter &&!lastChar.isASCIIWhitespace // value of type 'String.Element' (aka 'Character') has no member 'isASCIIWhitespace'

func checkIfLastCharIsALetter(txt: String) -> Bool {
    let lastChar = txt.last!
    return lastChar.isLetter &&!lastChar.isWhitespace
}
```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 {
    let lastChar = txt.last!
    return lastChar.isLetter &&!lastChar.isWhitespace
}
```
return lastChar.isLetter &&!lastChar.isWhitespace // consecutive statements on a line must be separated by ';'
return lastChar.isLetter &&!lastChar.isWhitespace // cannot find operator '&&!' in scope

func checkIfLastCharIsALetter(txt: String) -> Bool {
    return txt.last == " " || txt.last == nil || txt.last!.isLetter
}
```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 {
    return txt.last == " " || txt.last == nil || txt.last!.isLetter
}
```
 // XCTAssertTrue failed

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

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

func canArrange(arr: [Int]) -> Int {
    var maxIndex = -1
    for i in 0..<arr.count {
        if i == 0 {
            continue
        }
        if arr[i] >= arr[i - 1] {
            maxIndex = i
        } else {
            break
        }
    }
    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
    for i in 0..<arr.count {
        if i == 0 {
            continue
        }
        if arr[i] >= arr[i - 1] {
            maxIndex = i
        } else {
            break
        }
    }
    return maxIndex
}
```
 // XCTAssertTrue failed

func canArrange(arr: [Int]) -> Int {
    // Write your code here
}
```swift
// Create a function which returns the largest index of an element which
// is not greater than or equal to the element immediately preceding it. If
// no such element exists then return -1. The given array will not contain
// duplicate values.
// Examples:
// canArrange(arr: [1, 2, 4, 3, 5]) == 3
// canArrange(arr: [1, 2, 3]) == -1
func canArrange(arr: [Int]) -> Int {
    // Write your code here
}
```
} // missing return in global function expected to return 'Int'

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

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

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

func canArrange(arr: [Int]) -> Int {
    var largestIndex = -1
    var largestValue = 0
    for (index, value) in arr.enumerated() {
        if value > largestValue {
            largestIndex = index
            largestValue = value
        }
    }
    return largestIndex
}
```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 largestIndex = -1
    var largestValue = 0
    for (index, value) in arr.enumerated() {
        if value > largestValue {
            largestIndex = index
            largestValue = value
        }
    }
    return largestIndex
}
```
 // XCTAssertTrue failed

func canArrange(arr: [Int]) -> Int {
    var largestIndex = -1
    for (index, value) in arr.enumerated() {
        if index == 0 {
            continue
        }
        if value >= arr[index - 1] {
            largestIndex = index
        } else {
            break
        }
    }
    return largestIndex
}
```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 largestIndex = -1
    for (index, value) in arr.enumerated() {
        if index == 0 {
            continue
        }
        if value >= arr[index - 1] {
            largestIndex = index
        } else {
            break
        }
    }
    return largestIndex
}
```
 // XCTAssertTrue failed

func canArrange(arr: [Int]) -> Int {
    var largestIndex = -1
    var largestValue = 0
    for (index, value) in arr.enumerated() {
        if value > largestValue {
            largestIndex = index
            largestValue = value
        }
    }
    return largestIndex
}
```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 largestIndex = -1
    var largestValue = 0
    for (index, value) in arr.enumerated() {
        if value > largestValue {
            largestIndex = index
            largestValue = value
        }
    }
    return largestIndex
}
```
 // XCTAssertTrue failed

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    // Your code here
}
```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?) {
    // Your code here
}
```
} // missing return in global function expected to return '(Int?, Int?)'

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

func largestSmallestIntegers(lst: [Int]) -> (Int?, Int?) {
    // Write your code here
}
```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?) {
    // Write your code here
}
```
} // missing return in global function expected to return '(Int?, Int?)'

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

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

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

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

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

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

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

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : 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),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareTwo(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareTwo(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareTwo(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareTwo(a:.stringValue("1"), b:.intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareThree(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareThree(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareThree(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareThree(a:.stringValue("1"), b:.intValue(1)) == nil
func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareFour(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareFour(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareFour(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareFour(a:.stringValue("1"), b:.intValue(1)) == nil
func compareFour(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),
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 // expected expression
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 // value of type 'Int' has no member 'intValue'
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?.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 // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
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?.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 // value of type 'String' has no member 'stringValue'
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 // consecutive statements on a line must be separated by ';'
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?.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 type 'Int' has no member 'intValue'
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 // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
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?.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 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?.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 // cannot use optional chaining on non-optional 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?.stringValue(b) : nil // value of optional type 'String?' must be unwrapped to a value of type 'String'
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 // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
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 type 'Int' has no member 'intValue'
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 use optional chaining on non-optional value of type 'Double'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
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 // 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 convert return expression of type 'Bool' to return type 'Value?'
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?.stringValue(b) : nil // expected expression
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 optional type 'String?' must be unwrapped to a value of type 'String'
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 // cannot use optional chaining on non-optional value of type 'String'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : 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),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareTwo(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareTwo(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareTwo(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareTwo(a:.stringValue("1"), b:.intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareThree(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareThree(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareThree(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareThree(a:.stringValue("1"), b:.intValue(1)) == nil
func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareFour(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareFour(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareFour(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareFour(a:.stringValue("1"), b:.intValue(1)) == nil
func compareFour(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),
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 // expected expression
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 // value of type 'Int' has no member 'intValue'
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?.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 // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
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?.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 // value of type 'String' has no member 'stringValue'
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 // consecutive statements on a line must be separated by ';'
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?.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 type 'Int' has no member 'intValue'
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 // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
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?.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 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?.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 // cannot use optional chaining on non-optional 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?.stringValue(b) : nil // value of optional type 'String?' must be unwrapped to a value of type 'String'
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 // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
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 type 'Int' has no member 'intValue'
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 use optional chaining on non-optional value of type 'Double'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
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 // 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 convert return expression of type 'Bool' to return type 'Value?'
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?.stringValue(b) : nil // expected expression
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 optional type 'String?' must be unwrapped to a value of type 'String'
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 // cannot use optional chaining on non-optional value of type 'String'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    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) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : 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 (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareTwo(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareTwo(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareTwo(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareTwo(a:.stringValue("1"), b:.intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}
```
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 // expected expression
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 // 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 // value of type 'Int' has no member 'intValue'
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 // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
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?.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 // value of type 'String' has no member 'stringValue'
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 // consecutive statements on a line must be separated by ';'
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?.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 // 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 // value of optional type 'Int?' must be unwrapped to a 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?.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?.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 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?.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 // cannot use optional chaining on non-optional 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?.stringValue(b) : nil // value of optional type 'String?' must be unwrapped to a value of type 'String'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : 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),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareTwo(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareTwo(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareTwo(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareTwo(a:.stringValue("1"), b:.intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareThree(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareThree(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareThree(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareThree(a:.stringValue("1"), b:.intValue(1)) == nil
func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareFour(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareFour(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareFour(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareFour(a:.stringValue("1"), b:.intValue(1)) == nil
func compareFour(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),
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 // expected expression
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 // value of type 'Int' has no member 'intValue'
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?.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 // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
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?.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 // value of type 'String' has no member 'stringValue'
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 // consecutive statements on a line must be separated by ';'
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?.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 type 'Int' has no member 'intValue'
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 // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
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?.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 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?.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 // cannot use optional chaining on non-optional 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?.stringValue(b) : nil // value of optional type 'String?' must be unwrapped to a value of type 'String'
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 // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
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 type 'Int' has no member 'intValue'
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 use optional chaining on non-optional value of type 'Double'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
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 // 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 convert return expression of type 'Bool' to return type 'Value?'
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?.stringValue(b) : nil // expected expression
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 optional type 'String?' must be unwrapped to a value of type 'String'
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 // cannot use optional chaining on non-optional value of type 'String'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : 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),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareTwo(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareTwo(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareTwo(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareTwo(a:.stringValue("1"), b:.intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareThree(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareThree(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareThree(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareThree(a:.stringValue("1"), b:.intValue(1)) == nil
func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareFour(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareFour(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareFour(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareFour(a:.stringValue("1"), b:.intValue(1)) == nil
func compareFour(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),
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 // expected expression
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 // value of type 'Int' has no member 'intValue'
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?.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 // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
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?.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 // value of type 'String' has no member 'stringValue'
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 // consecutive statements on a line must be separated by ';'
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?.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 type 'Int' has no member 'intValue'
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 // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
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?.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 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?.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 // cannot use optional chaining on non-optional 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?.stringValue(b) : nil // value of optional type 'String?' must be unwrapped to a value of type 'String'
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 // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
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 type 'Int' has no member 'intValue'
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 use optional chaining on non-optional value of type 'Double'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
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 // 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 convert return expression of type 'Bool' to return type 'Value?'
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?.stringValue(b) : nil // expected expression
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 optional type 'String?' must be unwrapped to a value of type 'String'
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 // cannot use optional chaining on non-optional value of type 'String'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.doubleValue(b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case let (.doubleValue(a),.intValue(b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.doubleValue(b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case let (.doubleValue(a),.intValue(b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : 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),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareTwo(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareTwo(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareTwo(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareTwo(a:.stringValue("1"), b:.intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.doubleValue(b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case let (.doubleValue(a),.intValue(b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareThree(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareThree(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareThree(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareThree(a:.stringValue("1"), b:.intValue(1)) == nil
func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.doubleValue(b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case let (.doubleValue(a),.intValue(b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareFour(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareFour(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareFour(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareFour(a:.stringValue("1"), b:.intValue(1)) == nil
func compareFour(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.doubleValue(b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case let (.doubleValue(a),.intValue(b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case let (.stringValue(a),
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 // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
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 // consecutive statements on a line must be separated by ';'
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 // cannot convert return expression of type 'Bool' to return type 'Value?'
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 // expected expression
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?.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 // value of type 'String' has no member 'stringValue'
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 // consecutive statements on a line must be separated by ';'
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?.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 // 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 // value of type 'Double' has no member 'intValue'
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?.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 // cannot use optional chaining on non-optional value of type 'Int'
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 // value of type 'Int' has no member 'doubleValue'
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 // expected expression
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 // cannot use optional chaining on non-optional 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?.stringValue(b) : nil // value of optional type 'String?' must be unwrapped to a value of type 'String'
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 // value of type 'Double' has no member 'intValue'
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 // consecutive statements on a line must be separated by ';'
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 // expected expression
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?.intValue(b) : nil // consecutive statements on a line must be separated by ';'
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 // cannot convert return expression of type 'Bool' to return type 'Value?'
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?.stringValue(b) : nil // expected expression
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 optional type 'String?' must be unwrapped to a value of type 'String'
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 // cannot use optional chaining on non-optional value of type 'String'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    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) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : 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 (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareTwo(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareTwo(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareTwo(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareTwo(a:.stringValue("1"), b:.intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}
```
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 // expected expression
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 // 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 // value of type 'Int' has no member 'intValue'
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 // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
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?.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 // value of type 'String' has no member 'stringValue'
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 // consecutive statements on a line must be separated by ';'
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?.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 // 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 // value of optional type 'Int?' must be unwrapped to a 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?.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?.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 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?.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 // cannot use optional chaining on non-optional 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?.stringValue(b) : nil // value of optional type 'String?' must be unwrapped to a value of type 'String'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    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) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    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) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : 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 (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareTwo(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareTwo(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareTwo(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareTwo(a:.stringValue("1"), b:.intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareThree(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareThree(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareThree(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareThree(a:.stringValue("1"), b:.intValue(1)) == nil
func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareFour(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareFour(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareFour(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareFour(a:.stringValue("1"), b:.intValue(1)) == nil
func compareFour(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b
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 // expected expression
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 // value of type 'Int' has no member 'intValue'
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?.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 // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
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?.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 // value of type 'String' has no member 'stringValue'
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 // consecutive statements on a line must be separated by ';'
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?.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 type 'Int' has no member 'intValue'
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 // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
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?.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 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?.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 // cannot use optional chaining on non-optional 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?.stringValue(b) : nil // value of optional type 'String?' must be unwrapped to a value of type 'String'
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 // consecutive statements on a line must be separated by ';'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
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 type 'Int' has no member 'intValue'
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 use optional chaining on non-optional value of type 'Double'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
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 // 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 convert return expression of type 'Bool' to return type 'Value?'
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?.stringValue(b) : nil // expected expression
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 optional type 'String?' must be unwrapped to a value of type 'String'
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 // cannot use optional chaining on non-optional value of type 'String'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.doubleValue(let b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case (.doubleValue(let a),.intValue(let b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : 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 (.intValue(let a),.intValue(let b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case (.doubleValue(let a),.doubleValue(let b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareTwo(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareTwo(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareTwo(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareTwo(a:.stringValue("1"), b:.intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case (.intValue(let a),.doubleValue(let b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case (.doubleValue(let a),.intValue(let b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case (.stringValue(let a),.stringValue(let b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}
```
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 // expected expression
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 // 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 // value of type 'Int' has no member 'intValue'
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 // consecutive statements on a line must be separated by ';'
return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil // expected expression
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?.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 // value of type 'String' has no member 'stringValue'
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 // consecutive statements on a line must be separated by ';'
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?.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 // 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 // value of type 'Double' has no member 'intValue'
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?.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 // value of optional type 'Double?' must be unwrapped to a value of type 'Double'
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?.intValue(b) : nil // consecutive statements on a line must be separated by ';'
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 // cannot use optional chaining on non-optional 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?.stringValue(b) : nil // value of optional type 'String?' must be unwrapped to a value of type 'String'

enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

func compareOne(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.doubleValue(b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case let (.doubleValue(a),.intValue(b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.doubleValue(b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case let (.doubleValue(a),.intValue(b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : 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),.intValue(b)):
        return a > b?.intValue(a) : b > a?.intValue(b) : nil
    case let (.doubleValue(a),.doubleValue(b)):
        return a > b?.doubleValue(a) : b > a?.doubleValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareTwo(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareTwo(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareTwo(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareTwo(a:.stringValue("1"), b:.intValue(1)) == nil
func compareTwo(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.doubleValue(b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case let (.doubleValue(a),.intValue(b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareThree(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareThree(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareThree(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareThree(a:.stringValue("1"), b:.intValue(1)) == nil
func compareThree(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.doubleValue(b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case let (.doubleValue(a),.intValue(b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case let (.stringValue(a),.stringValue(b)):
        return a > b?.stringValue(a) : b > a?.stringValue(b) : nil
    default:
        return nil
    }
}

// Create a function that takes integers, floats, or strings representing
// real numbers, and returns the larger variable in its given variable type.
// Return nil if the values are equal.
// Note: If a real number is represented as a string, the floating point might be. or,
// compareFour(a:.intValue(1), b:.doubleValue(2.5)) ==.doubleValue(2.5)
// compareFour(a:.intValue(1), b:.stringValue("2,3")) ==.stringValue("2,3")
// compareFour(a:.stringValue("5,1"), b:.stringValue("6")) ==.stringValue("6")
// compareFour(a:.stringValue("1"), b:.intValue(1)) == nil
func compareFour(a: Value, b: Value) -> Value? {
    switch (a, b) {
    case let (.intValue(a),.doubleValue(b)):
        return a > b?.intValue(a) : b > a?.doubleValue(b) : nil
    case let (.doubleValue(a),.intValue(b)):
        return a > b?.doubleValue(a) : b > a?.intValue(b) : nil
    case let (.stringValue(a),
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 // cannot convert return expression of type 'Bool' to return type 'Value?'
return a > b?.intValue(a) : b > a?.intValue(b) : nil // expected expression
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 // consecutive statements on a line must be separated by ';'
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 // cannot convert return expression of type 'Bool' to return type 'Value?'
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 // expected expression
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?.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 // value of type 'String' has no member 'stringValue'
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 // consecutive statements on a line must be separated by ';'
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?.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 // 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 // value of type 'Double' has no member 'intValue'
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?.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 // cannot use optional chaining on non-optional value of type 'Int'
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 // value of type 'Int' has no member 'doubleValue'
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 // expected expression
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 // cannot use optional chaining on non-optional 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?.stringValue(b) : nil // value of optional type 'String?' must be unwrapped to a value of type 'String'
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 // value of type 'Double' has no member 'intValue'
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 // consecutive statements on a line must be separated by ';'
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 // expected expression
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?.intValue(b) : nil // consecutive statements on a line must be separated by ';'
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 // cannot convert return expression of type 'Bool' to return type 'Value?'
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?.stringValue(b) : nil // expected expression
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 optional type 'String?' must be unwrapped to a value of type 'String'
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 // cannot use optional chaining on non-optional value of type 'String'

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

func isEqualToSumEven(n: Int) -> Bool {
    return n % 2 == 0 && n % 4 == 0
}
```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 {
    return n % 2 == 0 && n % 4 == 0
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    for i in 0...n {
        for j in 0...n {
            for k in 0...n {
                for l in 0...n {
                    if i + j + k + l == n && i % 2 == 0 && j % 2 == 0 && k % 2 == 0 && l % 2 == 0 {
                        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 {
    for i in 0...n {
        for j in 0...n {
            for k in 0...n {
                for l in 0...n {
                    if i + j + k + l == n && i % 2 == 0 && j % 2 == 0 && k % 2 == 0 && l % 2 == 0 {
                        return true
                    }
                }
            }
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    for i in 0...n {
        for j in 0...n {
            for k in 0...n {
                for l in 0...n {
                    if i + j + k + l == n && i % 2 == 0 && j % 2 == 0 && k % 2 == 0 && l % 2 == 0 {
                        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 {
    for i in 0...n {
        for j in 0...n {
            for k in 0...n {
                for l in 0...n {
                    if i + j + k + l == n && i % 2 == 0 && j % 2 == 0 && k % 2 == 0 && l % 2 == 0 {
                        return true
                    }
                }
            }
        }
    }
    return false
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    for i in 0...n {
        for j in 0...n {
            for k in 0...n {
                for l in 0...n {
                    if i + j + k + l == n && i % 2 == 0 && j % 2 == 0 && k % 2 == 0 && l % 2 == 0 {
                        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 {
    for i in 0...n {
        for j in 0...n {
            for k in 0...n {
                for l in 0...n {
                    if i + j + k + l == n && i % 2 == 0 && j % 2 == 0 && k % 2 == 0 && l % 2 == 0 {
                        return true
                    }
                }
            }
        }
    }
    return false
}
```
 // XCTAssertTrue failed

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

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

func isEqualToSumEven(n: Int) -> Bool {
    var sum = 0
    for i in 2...n {
        if i % 2 == 0 {
            sum += i
        }
    }
    return sum == n
}
```swift
// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
// Example
// isEqualToSumEven(n: 4) == false
// isEqualToSumEven(n: 6) == false
// isEqualToSumEven(n: 8) == true
func isEqualToSumEven(n: Int) -> Bool {
    var sum = 0
    for i in 2...n {
        if i % 2 == 0 {
            sum += i
        }
    }
    return sum == n
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    // TODO: Write your code here
    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: Write your code here
    return false
}
```
 // XCTAssertTrue failed

func isEqualToSumEven(n: Int) -> Bool {
    // TODO: Write your code here
    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: Write your code here
    return false
}
```
 // XCTAssertTrue failed

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

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

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

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

func specialFactorial(n: Int) -> Int {
    // Write your code here
    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 {
    // Write your code here
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    // Write your code here
    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 {
    // Write your code here
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    // Write your code here
    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 {
    // Write your code here
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```swift
// The Brazilian factorial is defined as:
// brazilian_factorial(n) = n! * (n-1)! * (n-2)! *... * 1!
// where n > 0
// For example:
// The function will receive an integer as input and should return the special
// factorial of this integer.
// specialFactorial(n: 4) == 288
func specialFactorial(n: Int) -> Int {
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

func specialFactorial(n: Int) -> Int {
    // Write your code here
    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 {
    // Write your code here
    var result = 1
    for i in 1...n {
        result *= i
    }
    return result
}
```
 // XCTAssertTrue failed

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

func fixSpaces(text: String) -> String {
    return text.replacingOccurrences(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.replacingOccurrences(of: " ", with: "_").replacingOccurrences(of: "  ", with: "-")
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var count = 0
    for char in text {
        if char == " " {
            count += 1
        } else {
            count = 0
        }
        if count > 2 {
            result += "_"
        } else {
            result += String(char)
        }
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var count = 0
    for char in text {
        if char == " " {
            count += 1
        } else {
            count = 0
        }
        if count > 2 {
            result += "_"
        } else {
            result += String(char)
        }
    }
    return result
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    return text.replacingOccurrences(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.replacingOccurrences(of: " ", with: "_").replacingOccurrences(of: "  ", with: "-")
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    return text.replacingOccurrences(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.replacingOccurrences(of: " ", with: "_").replacingOccurrences(of: "  ", with: "-")
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    return text.replacingOccurrences(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.replacingOccurrences(of: "  ", with: "-")
       .replacingOccurrences(of: " ", with: "_")
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    return text.replacingOccurrences(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.replacingOccurrences(of: " ", with: "_").replacingOccurrences(of: "  ", with: "-")
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    var result = ""
    var lastChar = ""
    for char in text {
        if char == " " {
            if lastChar == " " {
                result += "-"
            } else {
                result += "_"
            }
        } else {
            result += String(char)
        }
        lastChar = String(char)
    }
    return result
}
```swift
// Given a string text, replace all spaces in it with underscores, 
// and if a string has more than 2 consecutive spaces, 
// then replace all consecutive spaces with - 
// fixSpaces(text: " Example") == "Example"
// fixSpaces(text: " Example 1") == "Example_1"
// fixSpaces(text: " Example 2") == "_Example_2"
// fixSpaces(text: " Example 3") == "_Example-3"
func fixSpaces(text: String) -> String {
    var result = ""
    var lastChar = ""
    for char in text {
        if char == " " {
            if lastChar == " " {
                result += "-"
            } else {
                result += "_"
            }
        } else {
            result += String(char)
        }
        lastChar = String(char)
    }
    return result
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    return text.replacingOccurrences(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.replacingOccurrences(of: " ", with: "_").replacingOccurrences(of: "  ", with: "-")
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    return text.replacingOccurrences(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.replacingOccurrences(of: " ", with: "_").replacingOccurrences(of: "  ", with: "-")
}
```
 // XCTAssertTrue failed

func fixSpaces(text: String) -> String {
    return text.replacingOccurrences(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.replacingOccurrences(of: " ", with: "_").replacingOccurrences(of: "  ", with: "-")
}
```
 // XCTAssertTrue failed

func fileNameCheck(fileName: String) -> String {
    let regex = try! NSRegularExpression(pattern: "^[a-zA-Z].*[.](txt|exe|dll)$", options: [])
    let range = NSRange(location: 0, length: fileName.utf16.count)
    return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let regex = try! NSRegularExpression(pattern: "^[a-zA-Z].*[.](txt|exe|dll)$", options: [])
    let range = NSRange(location: 0, length: fileName.utf16.count)
    return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No"
}
```
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // cannot convert return expression of type '()' to return type 'String'
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // string literal is unused
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // expected expression
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // 'nil' requires a contextual type
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // cannot assign value of type 'Optional<_>' to type 'NSTextCheckingResult'
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // '=' must have consistent whitespace on both sides
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // cannot assign through '!': function call returns immutable value

func fileNameCheck(fileName: String) -> String {
    let fileNameArray = fileName.components(separatedBy: ".")
    if fileNameArray.count!= 2 {
        return "No"
    }
    let firstPart = fileNameArray[0]
    let secondPart = fileNameArray[1]
    if firstPart.count > 3 {
        return "No"
    }
    if!firstPart.isEmpty &&!firstPart.first!.isLetter {
        return "No"
    }
    if!secondPart.elementsEqual(["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 {
    let fileNameArray = fileName.components(separatedBy: ".")
    if fileNameArray.count!= 2 {
        return "No"
    }
    let firstPart = fileNameArray[0]
    let secondPart = fileNameArray[1]
    if firstPart.count > 3 {
        return "No"
    }
    if!firstPart.isEmpty &&!firstPart.first!.isLetter {
        return "No"
    }
    if!secondPart.elementsEqual(["txt", "exe", "dll"]) {
        return "No"
    }
    return "Yes"
}
```
if fileNameArray.count!= 2 { // '=' must have consistent whitespace on both sides
if fileNameArray.count!= 2 { // cannot force unwrap value of non-optional type 'Int'
if fileNameArray.count!= 2 { // use of '=' in a boolean context, did you mean '=='?
if!firstPart.isEmpty &&!firstPart.first!.isLetter { // expected expression, var, or let in 'if' condition
if!secondPart.elementsEqual(["txt", "exe", "dll"]) { // expected expression, var, or let in 'if' condition

func fileNameCheck(fileName: String) -> String {
    return fileName.contains(".")? "Yes" : "No"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    return fileName.contains(".")? "Yes" : "No"
}
```
return fileName.contains(".")? "Yes" : "No" // string literal is unused
return fileName.contains(".")? "Yes" : "No" // expected expression
return fileName.contains(".")? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return fileName.contains(".")? "Yes" : "No" // cannot use optional chaining on non-optional value of type 'Bool'
return fileName.contains(".")? "Yes" : "No" // consecutive statements on a line must be separated by ';'

func fileNameCheck(fileName: String) -> String {
    let fileNameArr = fileName.components(separatedBy: ".")
    if fileNameArr.count!= 2 {
        return "No"
    }
    let firstPart = fileNameArr[0]
    let secondPart = fileNameArr[1]
    if firstPart.count > 3 {
        return "No"
    }
    if firstPart.count == 0 {
        return "No"
    }
    if firstPart.first == nil {
        return "No"
    }
    if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" {
        return "No"
    }
    return "Yes"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let fileNameArr = fileName.components(separatedBy: ".")
    if fileNameArr.count!= 2 {
        return "No"
    }
    let firstPart = fileNameArr[0]
    let secondPart = fileNameArr[1]
    if firstPart.count > 3 {
        return "No"
    }
    if firstPart.count == 0 {
        return "No"
    }
    if firstPart.first == nil {
        return "No"
    }
    if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" {
        return "No"
    }
    return "Yes"
}
```
if fileNameArr.count!= 2 { // cannot force unwrap value of non-optional type 'Int'
if fileNameArr.count!= 2 { // '=' must have consistent whitespace on both sides
if fileNameArr.count!= 2 { // use of '=' in a boolean context, did you mean '=='?
if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" { // cannot force unwrap value of non-optional type 'String'
if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" { // cannot force unwrap value of non-optional type 'String'
if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" { // '=' must have consistent whitespace on both sides
if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" { // cannot force unwrap value of non-optional type 'String'
if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" { // '=' must have consistent whitespace on both sides
if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" { // '=' must have consistent whitespace on both sides
if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" { // use of '=' in a boolean context, did you mean '=='?
if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if secondPart!= "txt" && secondPart!= "exe" && secondPart!= "dll" { // cannot assign value of type '()' to type 'String'

func fileNameCheck(fileName: String) -> String {
    let fileNameArr = fileName.components(separatedBy: ".")
    if fileNameArr.count!= 2 {
        return "No"
    }
    if fileNameArr[0].count > 3 {
        return "No"
    }
    if fileNameArr[0].count == 0 {
        return "No"
    }
    if fileNameArr[0].first == nil {
        return "No"
    }
    if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" {
        return "No"
    }
    return "Yes"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let fileNameArr = fileName.components(separatedBy: ".")
    if fileNameArr.count!= 2 {
        return "No"
    }
    if fileNameArr[0].count > 3 {
        return "No"
    }
    if fileNameArr[0].count == 0 {
        return "No"
    }
    if fileNameArr[0].first == nil {
        return "No"
    }
    if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" {
        return "No"
    }
    return "Yes"
}
```
if fileNameArr.count!= 2 { // cannot force unwrap value of non-optional type 'Int'
if fileNameArr.count!= 2 { // '=' must have consistent whitespace on both sides
if fileNameArr.count!= 2 { // use of '=' in a boolean context, did you mean '=='?
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot assign value of type '()' to type 'String'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot force unwrap value of non-optional type 'String'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot force unwrap value of non-optional type 'String'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // use of '=' in a boolean context, did you mean '=='?
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot force unwrap value of non-optional type 'String'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'

func fileNameCheck(fileName: String) -> String {
    let valid = fileName.split(separator: ".").count == 2
    let first = fileName.split(separator: ".")[0].first
    let second = fileName.split(separator: ".")[1]
    let third = fileName.split(separator: ".")[2]
    let fourth = fileName.split(separator: ".")[3]
    let firstValid = first!= nil && (first! >= "a" && first! <= "z" || first! >= "A" && first! <= "Z")
    let secondValid = second == "txt" || second == "exe" || second == "dll"
    let thirdValid = third == nil
    let fourthValid = fourth == nil
    return valid && firstValid && secondValid && thirdValid && fourthValid? "Yes" : "No"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let valid = fileName.split(separator: ".").count == 2
    let first = fileName.split(separator: ".")[0].first
    let second = fileName.split(separator: ".")[1]
    let third = fileName.split(separator: ".")[2]
    let fourth = fileName.split(separator: ".")[3]
    let firstValid = first!= nil && (first! >= "a" && first! <= "z" || first! >= "A" && first! <= "Z")
    let secondValid = second == "txt" || second == "exe" || second == "dll"
    let thirdValid = third == nil
    let fourthValid = fourth == nil
    return valid && firstValid && secondValid && thirdValid && fourthValid? "Yes" : "No"
}
```
let firstValid = first!= nil && (first! >= "a" && first! <= "z" || first! >= "A" && first! <= "Z") // cannot assign value of type 'Bool' to type 'Substring.Element' (aka 'Character')
let firstValid = first!= nil && (first! >= "a" && first! <= "z" || first! >= "A" && first! <= "Z") // cannot assign through '!': 'first' is a 'let' constant
let firstValid = first!= nil && (first! >= "a" && first! <= "z" || first! >= "A" && first! <= "Z") // '=' must have consistent whitespace on both sides
let firstValid = first!= nil && (first! >= "a" && first! <= "z" || first! >= "A" && first! <= "Z") // 'nil' is not compatible with expected argument type 'Bool'
let thirdValid = third == nil // comparing non-optional value of type 'String.SubSequence' (aka 'Substring') to 'nil' always returns false
let fourthValid = fourth == nil // comparing non-optional value of type 'String.SubSequence' (aka 'Substring') to 'nil' always returns false
return valid && firstValid && secondValid && thirdValid && fourthValid? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return valid && firstValid && secondValid && thirdValid && fourthValid? "Yes" : "No" // cannot use optional chaining on non-optional value of type 'Bool'
return valid && firstValid && secondValid && thirdValid && fourthValid? "Yes" : "No" // cannot convert return expression of type 'Bool' to return type 'String'
return valid && firstValid && secondValid && thirdValid && fourthValid? "Yes" : "No" // optional type 'Bool?' cannot be used as a boolean; test for '!= nil' instead
return valid && firstValid && secondValid && thirdValid && fourthValid? "Yes" : "No" // string literal is unused
return valid && firstValid && secondValid && thirdValid && fourthValid? "Yes" : "No" // expected expression
return valid && firstValid && secondValid && thirdValid && fourthValid? "Yes" : "No" // consecutive statements on a line must be separated by ';'

func fileNameCheck(fileName: String) -> String {
    let fileNameArray = fileName.components(separatedBy: ".")
    if fileNameArray.count!= 2 {
        return "No"
    }
    if fileNameArray[0].count > 3 {
        return "No"
    }
    if fileNameArray[0].rangeOfCharacter(from: CharacterSet.decimalDigits)!= nil {
        return "No"
    }
    if fileNameArray[0].rangeOfCharacter(from: CharacterSet.letters) == nil {
        return "No"
    }
    if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" {
        return "No"
    }
    return "Yes"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let fileNameArray = fileName.components(separatedBy: ".")
    if fileNameArray.count!= 2 {
        return "No"
    }
    if fileNameArray[0].count > 3 {
        return "No"
    }
    if fileNameArray[0].rangeOfCharacter(from: CharacterSet.decimalDigits)!= nil {
        return "No"
    }
    if fileNameArray[0].rangeOfCharacter(from: CharacterSet.letters) == nil {
        return "No"
    }
    if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" {
        return "No"
    }
    return "Yes"
}
```
if fileNameArray.count!= 2 { // use of '=' in a boolean context, did you mean '=='?
if fileNameArray.count!= 2 { // '=' must have consistent whitespace on both sides
if fileNameArray.count!= 2 { // cannot force unwrap value of non-optional type 'Int'
if fileNameArray[0].rangeOfCharacter(from: CharacterSet.decimalDigits)!= nil { // use of '=' in a boolean context, did you mean '=='?
if fileNameArray[0].rangeOfCharacter(from: CharacterSet.decimalDigits)!= nil { // cannot assign through '!': function call returns immutable value
if fileNameArray[0].rangeOfCharacter(from: CharacterSet.decimalDigits)!= nil { // '=' must have consistent whitespace on both sides
if fileNameArray[0].rangeOfCharacter(from: CharacterSet.decimalDigits)!= nil { // 'nil' cannot be assigned to type 'Range<String.Index>'
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // use of '=' in a boolean context, did you mean '=='?
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot assign value of type '()' to type 'String'
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot force unwrap value of non-optional type 'String'
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot force unwrap value of non-optional type 'String'
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot force unwrap value of non-optional type 'String'
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameArray[1]!= "txt" && fileNameArray[1]!= "exe" && fileNameArray[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'

func fileNameCheck(fileName: String) -> String {
    let regex = try! NSRegularExpression(pattern: "^[a-zA-Z].*\\.[txt|exe|dll]$", options: [])
    let range = NSRange(location: 0, length: fileName.count)
    return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let regex = try! NSRegularExpression(pattern: "^[a-zA-Z].*\\.[txt|exe|dll]$", options: [])
    let range = NSRange(location: 0, length: fileName.count)
    return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No"
}
```
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // cannot convert return expression of type '()' to return type 'String'
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // string literal is unused
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // expected expression
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // 'nil' requires a contextual type
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // cannot assign value of type 'Optional<_>' to type 'NSTextCheckingResult'
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // '=' must have consistent whitespace on both sides
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // cannot assign through '!': function call returns immutable value

func fileNameCheck(fileName: String) -> String {
    let regex = try! NSRegularExpression(pattern: "^[a-zA-Z].*\\.[txt|exe|dll]$", options: [])
    let range = NSRange(location: 0, length: fileName.count)
    return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let regex = try! NSRegularExpression(pattern: "^[a-zA-Z].*\\.[txt|exe|dll]$", options: [])
    let range = NSRange(location: 0, length: fileName.count)
    return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No"
}
```
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // cannot convert return expression of type '()' to return type 'String'
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // string literal is unused
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // consecutive statements on a line must be separated by ';'
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // expected expression
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // 'nil' requires a contextual type
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // cannot assign value of type 'Optional<_>' to type 'NSTextCheckingResult'
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // '=' must have consistent whitespace on both sides
return regex.firstMatch(in: fileName, options: [], range: range)!= nil? "Yes" : "No" // cannot assign through '!': function call returns immutable value

func fileNameCheck(fileName: String) -> String {
    let fileNameArr = fileName.components(separatedBy: ".")
    if fileNameArr.count!= 2 {
        return "No"
    }
    if fileNameArr[0].count > 3 {
        return "No"
    }
    if fileNameArr[0].count == 0 {
        return "No"
    }
    if fileNameArr[0].first!= nil && (fileNameArr[0].first! >= "a" && fileNameArr[0].first! <= "z" || fileNameArr[0].first! >= "A" && fileNameArr[0].first! <= "Z") {
        return "No"
    }
    if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" {
        return "No"
    }
    return "Yes"
}
```swift
// Create a function which takes a string representing a file's name, and returns
// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
// A file's name is considered to be valid if and only if all the following conditions 
// are met:
// - There should not be more than three digits ('0'-'9') in the file's name.
// - The file's name contains exactly one dot '.'
// - The substring before the dot should not be empty, and it starts with a letter from 
// the latin alphapet ('a'-'z' and 'A'-'Z').
// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
// Examples:
// fileNameCheck(fileName: "example.txt") == "Yes"
// fileNameCheck(fileName: "1example.dll") == "No"
func fileNameCheck(fileName: String) -> String {
    let fileNameArr = fileName.components(separatedBy: ".")
    if fileNameArr.count!= 2 {
        return "No"
    }
    if fileNameArr[0].count > 3 {
        return "No"
    }
    if fileNameArr[0].count == 0 {
        return "No"
    }
    if fileNameArr[0].first!= nil && (fileNameArr[0].first! >= "a" && fileNameArr[0].first! <= "z" || fileNameArr[0].first! >= "A" && fileNameArr[0].first! <= "Z") {
        return "No"
    }
    if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" {
        return "No"
    }
    return "Yes"
}
```
if fileNameArr.count!= 2 { // cannot force unwrap value of non-optional type 'Int'
if fileNameArr.count!= 2 { // '=' must have consistent whitespace on both sides
if fileNameArr.count!= 2 { // use of '=' in a boolean context, did you mean '=='?
if fileNameArr[0].first!= nil && (fileNameArr[0].first! >= "a" && fileNameArr[0].first! <= "z" || fileNameArr[0].first! >= "A" && fileNameArr[0].first! <= "Z") { // '=' must have consistent whitespace on both sides
if fileNameArr[0].first!= nil && (fileNameArr[0].first! >= "a" && fileNameArr[0].first! <= "z" || fileNameArr[0].first! >= "A" && fileNameArr[0].first! <= "Z") { // cannot assign through '!': 'first' is a get-only property
if fileNameArr[0].first!= nil && (fileNameArr[0].first! >= "a" && fileNameArr[0].first! <= "z" || fileNameArr[0].first! >= "A" && fileNameArr[0].first! <= "Z") { // 'nil' is not compatible with expected argument type 'Bool'
if fileNameArr[0].first!= nil && (fileNameArr[0].first! >= "a" && fileNameArr[0].first! <= "z" || fileNameArr[0].first! >= "A" && fileNameArr[0].first! <= "Z") { // use of '=' in a boolean context, did you mean '=='?
if fileNameArr[0].first!= nil && (fileNameArr[0].first! >= "a" && fileNameArr[0].first! <= "z" || fileNameArr[0].first! >= "A" && fileNameArr[0].first! <= "Z") { // cannot assign value of type 'Bool' to type 'String.Element' (aka 'Character')
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // use of '=' in a boolean context, did you mean '=='?
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot force unwrap value of non-optional type 'String'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot force unwrap value of non-optional type 'String'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot assign value of type '()' to type 'String'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot convert value of type 'String' to expected argument type 'Bool'
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // '=' must have consistent whitespace on both sides
if fileNameArr[1]!= "txt" && fileNameArr[1]!= "exe" && fileNameArr[1]!= "dll" { // cannot force unwrap value of non-optional type 'String'

func wordsInSentence(sentence: String) -> String {
    return sentence.components(separatedBy: " ").filter { $0.count.isPrime }.joined(separator: " ")
}

extension Int {
    var isPrime: Bool {
        guard self > 1 else { return false }
        guard self!= 2 else { return true }
        guard self % 2!= 0 else { return false }
        guard self % 3!= 0 else { return false }
        return (4..<self).filter { self % $0 == 0 }.isEmpty
    }
}
```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 {
    return sentence.components(separatedBy: " ").filter { $0.count.isPrime }.joined(separator: " ")
}

extension Int {
    var isPrime: Bool {
        guard self > 1 else { return false }
        guard self!= 2 else { return true }
        guard self % 2!= 0 else { return false }
        guard self % 3!= 0 else { return false }
        return (4..<self).filter { self % $0 == 0 }.isEmpty
    }
}
```
guard self!= 2 else { return true } // use of '=' in a boolean context, did you mean '=='?
guard self!= 2 else { return true } // '=' must have consistent whitespace on both sides
guard self!= 2 else { return true } // cannot force unwrap value of non-optional type 'Int'
guard self % 2!= 0 else { return false } // use of '=' in a boolean context, did you mean '=='?
guard self % 2!= 0 else { return false } // '=' must have consistent whitespace on both sides
guard self % 2!= 0 else { return false } // cannot force unwrap value of non-optional type 'Int'
guard self % 2!= 0 else { return false } // expression is not assignable: binary operator returns immutable value
guard self % 3!= 0 else { return false } // cannot force unwrap value of non-optional type 'Int'
guard self % 3!= 0 else { return false } // use of '=' in a boolean context, did you mean '=='?
guard self % 3!= 0 else { return false } // '=' must have consistent whitespace on both sides
guard self % 3!= 0 else { return false } // expression is not assignable: binary operator returns immutable value

func wordsInSentence(sentence: String) -> String {
    var result = ""
    let words = sentence.components(separatedBy: " ")
    for word in words {
        if isPrime(word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespaces)
}

func isPrime(_ n: Int) -> Bool {
    guard n > 1 else { return false }
    guard n!= 2 else { return true }
    guard n % 2!= 0 else { return false }
    for i in 3..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    var result = ""
    let words = sentence.components(separatedBy: " ")
    for word in words {
        if isPrime(word.count) {
            result += word + " "
        }
    }
    return result.trimmingCharacters(in:.whitespaces)
}

func isPrime(_ n: Int) -> Bool {
    guard n > 1 else { return false }
    guard n!= 2 else { return true }
    guard n % 2!= 0 else { return false }
    for i in 3..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```
guard n!= 2 else { return true } // cannot force unwrap value of non-optional type 'Int'
guard n!= 2 else { return true } // '=' must have consistent whitespace on both sides
guard n!= 2 else { return true } // use of '=' in a boolean context, did you mean '=='?
guard n % 2!= 0 else { return false } // cannot force unwrap value of non-optional type 'Int'
guard n % 2!= 0 else { return false } // expression is not assignable: binary operator returns immutable value
guard n % 2!= 0 else { return false } // '=' must have consistent whitespace on both sides
guard n % 2!= 0 else { return false } // use of '=' in a boolean context, did you mean '=='?

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primeWords = words.filter { $0.count.isPrime }
    return primeWords.joined(separator: " ")
}

extension Int {
    var isPrime: Bool {
        guard self > 1 else { return false }
        guard self!= 2 else { return true }
        guard self % 2!= 0 else { return false }
        for i in stride(from: 3, to: Int(sqrt(Double(self))), by: 2) {
            if self % i == 0 {
                return false
            }
        }
        return true
    }
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    let primeWords = words.filter { $0.count.isPrime }
    return primeWords.joined(separator: " ")
}

extension Int {
    var isPrime: Bool {
        guard self > 1 else { return false }
        guard self!= 2 else { return true }
        guard self % 2!= 0 else { return false }
        for i in stride(from: 3, to: Int(sqrt(Double(self))), by: 2) {
            if self % i == 0 {
                return false
            }
        }
        return true
    }
}
```
guard self!= 2 else { return true } // cannot force unwrap value of non-optional type 'Int'
guard self!= 2 else { return true } // '=' must have consistent whitespace on both sides
guard self!= 2 else { return true } // use of '=' in a boolean context, did you mean '=='?
guard self % 2!= 0 else { return false } // '=' must have consistent whitespace on both sides
guard self % 2!= 0 else { return false } // cannot force unwrap value of non-optional type 'Int'
guard self % 2!= 0 else { return false } // expression is not assignable: binary operator returns immutable value
guard self % 2!= 0 else { return false } // use of '=' in a boolean context, did you mean '=='?

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    var primeWords = [String]()
    for word in words {
        if isPrime(word.count) {
            primeWords.append(word)
        }
    }
    return primeWords.joined(separator: " ")
}

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..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    var primeWords = [String]()
    for word in words {
        if isPrime(word.count) {
            primeWords.append(word)
        }
    }
    return primeWords.joined(separator: " ")
}

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..<n {
        if n % i == 0 {
            return false
        }
    }
    return true
}
```

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        if isPrime(word.count) {
            result.append(word)
        }
    }
    return result.joined(separator: " ")
}

func isPrime(_ num: Int) -> Bool {
    if num < 2 {
        return false
    }
    if num == 2 {
        return true
    }
    if num % 2 == 0 {
        return false
    }
    for i in 3...Int(sqrt(Double(num))) {
        if num % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        if isPrime(word.count) {
            result.append(word)
        }
    }
    return result.joined(separator: " ")
}

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

func wordsInSentence(sentence: String) -> String {
    var words = sentence.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        if isPrime(word.count) {
            result.append(word)
        }
    }
    return result.joined(separator: " ")
}

func isPrime(_ num: Int) -> Bool {
    if num <= 1 {
        return false
    }
    for i in 2..<num {
        if num % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    var words = sentence.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        if isPrime(word.count) {
            result.append(word)
        }
    }
    return result.joined(separator: " ")
}

func isPrime(_ num: Int) -> Bool {
    if num <= 1 {
        return false
    }
    for i in 2..<num {
        if num % i == 0 {
            return false
        }
    }
    return true
}
```
var words = sentence.components(separatedBy: " ") // variable 'words' was never mutated; consider changing to 'let' constant

func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        if isPrime(word.count) {
            result.append(word)
        }
    }
    return result.joined(separator: " ")
}

func isPrime(_ num: Int) -> Bool {
    if num <= 1 {
        return false
    }
    for i in 2..<num {
        if num % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    let words = sentence.components(separatedBy: " ")
    var result = [String]()
    for word in words {
        if isPrime(word.count) {
            result.append(word)
        }
    }
    return result.joined(separator: " ")
}

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

func wordsInSentence(sentence: String) -> String {
    // Write your code here
    var result = ""
    var words = sentence.components(separatedBy: " ")
    var primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]
    for i in 0..<words.count {
        if primes.contains(words[i].count) {
            result += words[i] + " "
        }
    }
    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 code here
    var result = ""
    var words = sentence.components(separatedBy: " ")
    var primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]
    for i in 0..<words.count {
        if primes.contains(words[i].count) {
            result += words[i] + " "
        }
    }
    return result
}
```
var words = sentence.components(separatedBy: " ") // variable 'words' was never mutated; consider changing to 'let' constant
var primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101] // variable 'primes' was never mutated; consider changing to 'let' constant
 // 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:.whitespaces)
}

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
// 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:.whitespaces)
}

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 wordsInSentence(sentence: String) -> String {
    var words = sentence.components(separatedBy: " ")
    var primes = [Int]()
    for i in 2...100 {
        if isPrime(i) {
            primes.append(i)
        }
    }
    var newWords = [String]()
    for word in words {
        if primes.contains(word.count) {
            newWords.append(word)
        }
    }
    return newWords.joined(separator: " ")
}

func isPrime(_ num: Int) -> Bool {
    if num == 1 {
        return false
    }
    for i in 2..<num {
        if num % i == 0 {
            return false
        }
    }
    return true
}
```swift
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
// the order of the words in the new string should be the same as the original one.
// Example 1:
// Example 2:
// Constraints:
// * 1 <= len(sentence) <= 100
// * sentence contains only letters
// wordsInSentence(sentence: "This is a test") == "is"
// wordsInSentence(sentence: "lets go for swimming") == "go for"
func wordsInSentence(sentence: String) -> String {
    var words = sentence.components(separatedBy: " ")
    var primes = [Int]()
    for i in 2...100 {
        if isPrime(i) {
            primes.append(i)
        }
    }
    var newWords = [String]()
    for word in words {
        if primes.contains(word.count) {
            newWords.append(word)
        }
    }
    return newWords.joined(separator: " ")
}

func isPrime(_ num: Int) -> Bool {
    if num == 1 {
        return false
    }
    for i in 2..<num {
        if num % i == 0 {
            return false
        }
    }
    return true
}
```
var words = sentence.components(separatedBy: " ") // variable 'words' was never mutated; consider changing to 'let' constant

func simplify(x: String, n: String) -> Bool {
    let xComponents = x.components(separatedBy: "/")
    let nComponents = n.components(separatedBy: "/")
    let xNumerator = Int(xComponents[0])!
    let xDenominator = Int(xComponents[1])!
    let nNumerator = Int(nComponents[0])!
    let nDenominator = Int(nComponents[1])!
    return xNumerator * nDenominator == xDenominator * nNumerator
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xComponents = x.components(separatedBy: "/")
    let nComponents = n.components(separatedBy: "/")
    let xNumerator = Int(xComponents[0])!
    let xDenominator = Int(xComponents[1])!
    let nNumerator = Int(nComponents[0])!
    let nDenominator = Int(nComponents[1])!
    return xNumerator * nDenominator == xDenominator * nNumerator
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xComponents = x.components(separatedBy: "/")
    let nComponents = n.components(separatedBy: "/")
    let xNumerator = Int(xComponents[0])!
    let xDenominator = Int(xComponents[1])!
    let nNumerator = Int(nComponents[0])!
    let nDenominator = Int(nComponents[1])!
    
    let xNumeratorTimesNDenominator = xNumerator * nDenominator
    let nNumeratorTimesXDenominator = nNumerator * xDenominator
    
    return xNumeratorTimesNDenominator == nNumeratorTimesXDenominator
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xComponents = x.components(separatedBy: "/")
    let nComponents = n.components(separatedBy: "/")
    let xNumerator = Int(xComponents[0])!
    let xDenominator = Int(xComponents[1])!
    let nNumerator = Int(nComponents[0])!
    let nDenominator = Int(nComponents[1])!
    
    let xNumeratorTimesNDenominator = xNumerator * nDenominator
    let nNumeratorTimesXDenominator = nNumerator * xDenominator
    
    return xNumeratorTimesNDenominator == nNumeratorTimesXDenominator
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xComponents = x.components(separatedBy: "/")
    let nComponents = n.components(separatedBy: "/")
    let xNumerator = Int(xComponents[0])!
    let xDenominator = Int(xComponents[1])!
    let nNumerator = Int(nComponents[0])!
    let nDenominator = Int(nComponents[1])!
    
    let xSimplified = xNumerator * nDenominator
    let nSimplified = nNumerator * xDenominator
    
    return xSimplified % nSimplified == 0
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xComponents = x.components(separatedBy: "/")
    let nComponents = n.components(separatedBy: "/")
    let xNumerator = Int(xComponents[0])!
    let xDenominator = Int(xComponents[1])!
    let nNumerator = Int(nComponents[0])!
    let nDenominator = Int(nComponents[1])!
    
    let xSimplified = xNumerator * nDenominator
    let nSimplified = nNumerator * xDenominator
    
    return xSimplified % nSimplified == 0
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xComponents = x.components(separatedBy: "/")
    let nComponents = n.components(separatedBy: "/")
    let xNumerator = Int(xComponents[0])!
    let xDenominator = Int(xComponents[1])!
    let nNumerator = Int(nComponents[0])!
    let nDenominator = Int(nComponents[1])!
    return xNumerator * nDenominator == xDenominator * nNumerator
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xComponents = x.components(separatedBy: "/")
    let nComponents = n.components(separatedBy: "/")
    let xNumerator = Int(xComponents[0])!
    let xDenominator = Int(xComponents[1])!
    let nNumerator = Int(nComponents[0])!
    let nDenominator = Int(nComponents[1])!
    return xNumerator * nDenominator == xDenominator * nNumerator
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    // TODO: Implement this function
    return false
}
```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 this function
    return false
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xComponents = x.components(separatedBy: "/")
    let nComponents = n.components(separatedBy: "/")
    let xNumerator = Int(xComponents[0])!
    let xDenominator = Int(xComponents[1])!
    let nNumerator = Int(nComponents[0])!
    let nDenominator = Int(nComponents[1])!
    return xNumerator * nDenominator == xDenominator * nNumerator
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xComponents = x.components(separatedBy: "/")
    let nComponents = n.components(separatedBy: "/")
    let xNumerator = Int(xComponents[0])!
    let xDenominator = Int(xComponents[1])!
    let nNumerator = Int(nComponents[0])!
    let nDenominator = Int(nComponents[1])!
    return xNumerator * nDenominator == xDenominator * nNumerator
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let x = x.components(separatedBy: "/")
    let n = n.components(separatedBy: "/")
    let xNum = Int(x[0])!
    let xDen = Int(x[1])!
    let nNum = Int(n[0])!
    let nDen = Int(n[1])!
    return xNum * nDen == nNum * xDen
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let x = x.components(separatedBy: "/")
    let n = n.components(separatedBy: "/")
    let xNum = Int(x[0])!
    let xDen = Int(x[1])!
    let nNum = Int(n[0])!
    let nDen = Int(n[1])!
    return xNum * nDen == nNum * xDen
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let xComponents = x.components(separatedBy: "/")
    let nComponents = n.components(separatedBy: "/")
    
    let xNumerator = Int(xComponents[0])!
    let xDenominator = Int(xComponents[1])!
    
    let nNumerator = Int(nComponents[0])!
    let nDenominator = Int(nComponents[1])!
    
    let xSimplified = xNumerator / xDenominator
    let nSimplified = nNumerator / nDenominator
    
    return xSimplified == nSimplified
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let xComponents = x.components(separatedBy: "/")
    let nComponents = n.components(separatedBy: "/")
    
    let xNumerator = Int(xComponents[0])!
    let xDenominator = Int(xComponents[1])!
    
    let nNumerator = Int(nComponents[0])!
    let nDenominator = Int(nComponents[1])!
    
    let xSimplified = xNumerator / xDenominator
    let nSimplified = nNumerator / nDenominator
    
    return xSimplified == nSimplified
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let x = x.components(separatedBy: "/")
    let n = n.components(separatedBy: "/")
    let xNumerator = Int(x[0])!
    let xDenominator = Int(x[1])!
    let nNumerator = Int(n[0])!
    let nDenominator = Int(n[1])!
    let result = xNumerator * nDenominator
    let result2 = nNumerator * xDenominator
    return result == result2
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let x = x.components(separatedBy: "/")
    let n = n.components(separatedBy: "/")
    let xNumerator = Int(x[0])!
    let xDenominator = Int(x[1])!
    let nNumerator = Int(n[0])!
    let nDenominator = Int(n[1])!
    let result = xNumerator * nDenominator
    let result2 = nNumerator * xDenominator
    return result == result2
}
```
 // XCTAssertTrue failed

func simplify(x: String, n: String) -> Bool {
    let x = x.components(separatedBy: "/")
    let n = n.components(separatedBy: "/")
    let xNumerator = Int(x[0])!
    let xDenominator = Int(x[1])!
    let nNumerator = Int(n[0])!
    let nDenominator = Int(n[1])!
    let xWholeNumber = xNumerator / xDenominator
    let nWholeNumber = nNumerator / nDenominator
    let xRemainder = xNumerator % xDenominator
    let nRemainder = nNumerator % nDenominator
    if xWholeNumber * nDenominator == nWholeNumber * xDenominator && xRemainder * nDenominator == nRemainder * xDenominator {
        return true
    } else {
        return false
    }
}
```swift
// Your task is to implement a function that will simplify the expression
// x * n. The function returns true if x * n evaluates to a whole number and false
// otherwise. Both x and n, are string representation of a fraction, and have the following format,
// <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
// You can assume that x, and n are valid fractions, and do not have zero as denominator.
// simplify(x: "1/5", n: "5/1") == true
// simplify(x: "1/6", n: "2/1") == false
// simplify(x: "7/10", n: "10/2") == false
func simplify(x: String, n: String) -> Bool {
    let x = x.components(separatedBy: "/")
    let n = n.components(separatedBy: "/")
    let xNumerator = Int(x[0])!
    let xDenominator = Int(x[1])!
    let nNumerator = Int(n[0])!
    let nDenominator = Int(n[1])!
    let xWholeNumber = xNumerator / xDenominator
    let nWholeNumber = nNumerator / nDenominator
    let xRemainder = xNumerator % xDenominator
    let nRemainder = nNumerator % nDenominator
    if xWholeNumber * nDenominator == nWholeNumber * xDenominator && xRemainder * nDenominator == nRemainder * xDenominator {
        return true
    } else {
        return false
    }
}
```
 // XCTAssertTrue failed

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0, +)
        let sum2 = $1.reduce(0, +)
        return sum1 < sum2 || (sum1 == sum2 && $0 < $1)
    }
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0, +)
        let sum2 = $1.reduce(0, +)
        return sum1 < sum2 || (sum1 == sum2 && $0 < $1)
    }
}
```
let sum1 = $0.reduce(0, +) // value of type 'Int' has no member 'reduce'

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0, +)
        let sum2 = $1.reduce(0, +)
        if sum1 == sum2 {
            return $0 < $1
        } else {
            return sum1 < sum2
        }
    }
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0, +)
        let sum2 = $1.reduce(0, +)
        if sum1 == sum2 {
            return $0 < $1
        } else {
            return sum1 < sum2
        }
    }
}
```
let sum1 = $0.reduce(0, +) // value of type 'Int' has no member 'reduce'

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0, +)
        let sum2 = $1.reduce(0, +)
        return sum1 == sum2? $0 < $1 : sum1 < sum2
    }
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0, +)
        let sum2 = $1.reduce(0, +)
        return sum1 == sum2? $0 < $1 : sum1 < sum2
    }
}
```
let sum1 = $0.reduce(0, +) // value of type 'Int' has no member 'reduce'
return sum1 == sum2? $0 < $1 : sum1 < sum2 // expected expression
return sum1 == sum2? $0 < $1 : sum1 < sum2 // consecutive statements on a line must be separated by ';'
return sum1 == sum2? $0 < $1 : sum1 < sum2 // consecutive statements on a line must be separated by ';'

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0) { $0 + $1.digitSum }
        let sum2 = $1.reduce(0) { $0 + $1.digitSum }
        if sum1 == sum2 {
            return $0 < $1
        } else {
            return sum1 < sum2
        }
    }
}

extension Int {
    var digitSum: Int {
        return String(self).reduce(0) { $0 + Int(String($1))! }
    }
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0) { $0 + $1.digitSum }
        let sum2 = $1.reduce(0) { $0 + $1.digitSum }
        if sum1 == sum2 {
            return $0 < $1
        } else {
            return sum1 < sum2
        }
    }
}

extension Int {
    var digitSum: Int {
        return String(self).reduce(0) { $0 + Int(String($1))! }
    }
}
```
let sum1 = $0.reduce(0) { $0 + $1.digitSum } // value of type 'Int' has no member 'reduce'

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0) { $0 + $1 }
        let sum2 = $1.reduce(0) { $0 + $1 }
        if sum1 == sum2 {
            return $0 < $1
        } else {
            return sum1 < sum2
        }
    }
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0) { $0 + $1 }
        let sum2 = $1.reduce(0) { $0 + $1 }
        if sum1 == sum2 {
            return $0 < $1
        } else {
            return sum1 < sum2
        }
    }
}
```
let sum1 = $0.reduce(0) { $0 + $1 } // value of type 'Int' has no member 'reduce'

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0, +)
        let sum2 = $1.reduce(0, +)
        return sum1 < sum2 || (sum1 == sum2 && $0 < $1)
    }
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0, +)
        let sum2 = $1.reduce(0, +)
        return sum1 < sum2 || (sum1 == sum2 && $0 < $1)
    }
}
```
let sum1 = $0.reduce(0, +) // value of type 'Int' has no member 'reduce'

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0) { $0 + $1.digitSum }
        let sum2 = $1.reduce(0) { $0 + $1.digitSum }
        if sum1 == sum2 {
            return $0 < $1
        } else {
            return sum1 < sum2
        }
    }
}

extension Int {
    var digitSum: Int {
        return String(self).reduce(0) { $0 + Int(String($1))! }
    }
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let sum1 = $0.reduce(0) { $0 + $1.digitSum }
        let sum2 = $1.reduce(0) { $0 + $1.digitSum }
        if sum1 == sum2 {
            return $0 < $1
        } else {
            return sum1 < sum2
        }
    }
}

extension Int {
    var digitSum: Int {
        return String(self).reduce(0) { $0 + Int(String($1))! }
    }
}
```
let sum1 = $0.reduce(0) { $0 + $1.digitSum } // value of type 'Int' has no member 'reduce'

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted { (a, b) -> Bool in
        let aSum = a.digits.reduce(0, +)
        let bSum = b.digits.reduce(0, +)
        if aSum == bSum {
            return a < b
        } else {
            return aSum < bSum
        }
    }
}

extension Int {
    var digits: [Int] {
        return String(self).compactMap { Int(String($0)) }
    }
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted { (a, b) -> Bool in
        let aSum = a.digits.reduce(0, +)
        let bSum = b.digits.reduce(0, +)
        if aSum == bSum {
            return a < b
        } else {
            return aSum < bSum
        }
    }
}

extension Int {
    var digits: [Int] {
        return String(self).compactMap { Int(String($0)) }
    }
}
```
 // XCTAssertTrue failed

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let a = $0.digits.reduce(0, +)
        let b = $1.digits.reduce(0, +)
        if a == b {
            return $0 < $1
        }
        return a < b
    }
}

extension Int {
    var digits: [Int] {
        return String(self).compactMap { Int(String($0)) }
    }
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let a = $0.digits.reduce(0, +)
        let b = $1.digits.reduce(0, +)
        if a == b {
            return $0 < $1
        }
        return a < b
    }
}

extension Int {
    var digits: [Int] {
        return String(self).compactMap { Int(String($0)) }
    }
}
```
 // XCTAssertTrue failed

func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let a = String($0)
        let b = String($1)
        let aSum = a.reduce(0) { $0 + Int(String($1))! }
        let bSum = b.reduce(0) { $0 + Int(String($1))! }
        if aSum == bSum {
            return $0 < $1
        } else {
            return aSum < bSum
        }
    }
}
```swift
// Write a function which sorts the given array of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in original array.
// For example:
// orderByPoints(nums: [1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
// orderByPoints(nums: [] as [Int]) == [] as [Int]
func orderByPoints(nums: [Int]) -> [Int] {
    return nums.sorted {
        let a = String($0)
        let b = String($1)
        let aSum = a.reduce(0) { $0 + Int(String($1))! }
        let bSum = b.reduce(0) { $0 + Int(String($1))! }
        if aSum == bSum {
            return $0 < $1
        } else {
            return aSum < bSum
        }
    }
}
```
 // Fatal error: Unexpectedly found nil while unwrapping an Optional value

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 {
            count += 1
        }
    }
    return count
}
```
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // '=' must have consistent whitespace on both sides
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // expression is not assignable: '&&' returns immutable value
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // expression is not assignable: '&&' returns immutable value
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // expression is not assignable: '&&' returns immutable value
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // integer literal value '0' cannot be used as a boolean; did you mean 'false'?
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // '=' must have consistent whitespace on both sides
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // '=' must have consistent whitespace on both sides
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // integer literal value '0' cannot be used as a boolean; did you mean 'false'?
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // integer literal value '0' cannot be used as a boolean; did you mean 'false'?
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // '=' must have consistent whitespace on both sides
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if num > 10 && num % 10!= 0 && num / 10!= 0 && num % 10 % 2!= 0 && num / 10 % 2!= 0 { // expression is not assignable: '&&' returns immutable value

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && (num % 10) % 2!= 0 && (num / 10) % 2!= 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && (num % 10) % 2!= 0 && (num / 10) % 2!= 0 {
            count += 1
        }
    }
    return count
}
```
if num > 10 && (num % 10) % 2!= 0 && (num / 10) % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if num > 10 && (num % 10) % 2!= 0 && (num / 10) % 2!= 0 { // expression is not assignable: '&&' returns immutable value
if num > 10 && (num % 10) % 2!= 0 && (num / 10) % 2!= 0 { // '=' must have consistent whitespace on both sides
if num > 10 && (num % 10) % 2!= 0 && (num / 10) % 2!= 0 { // '=' must have consistent whitespace on both sides
if num > 10 && (num % 10) % 2!= 0 && (num / 10) % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if num > 10 && (num % 10) % 2!= 0 && (num / 10) % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if num > 10 && (num % 10) % 2!= 0 && (num / 10) % 2!= 0 { // integer literal value '0' cannot be used as a boolean; did you mean 'false'?
if num > 10 && (num % 10) % 2!= 0 && (num / 10) % 2!= 0 { // expression is not assignable: '&&' returns immutable value
if num > 10 && (num % 10) % 2!= 0 && (num / 10) % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if num > 10 && (num % 10) % 2!= 0 && (num / 10) % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10!= 0 && num / 10!= 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 10!= 0 && num / 10!= 0 {
            count += 1
        }
    }
    return count
}
```
if num > 10 && num % 10!= 0 && num / 10!= 0 { // expression is not assignable: '&&' returns immutable value
if num > 10 && num % 10!= 0 && num / 10!= 0 { // expression is not assignable: '&&' returns immutable value
if num > 10 && num % 10!= 0 && num / 10!= 0 { // integer literal value '0' cannot be used as a boolean; did you mean 'false'?
if num > 10 && num % 10!= 0 && num / 10!= 0 { // cannot force unwrap value of non-optional type 'Int'
if num > 10 && num % 10!= 0 && num / 10!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if num > 10 && num % 10!= 0 && num / 10!= 0 { // cannot force unwrap value of non-optional type 'Int'
if num > 10 && num % 10!= 0 && num / 10!= 0 { // use of '=' in a boolean context, did you mean '=='?
if num > 10 && num % 10!= 0 && num / 10!= 0 { // '=' must have consistent whitespace on both sides
if num > 10 && num % 10!= 0 && num / 10!= 0 { // '=' must have consistent whitespace on both sides
if num > 10 && num % 10!= 0 && num / 10!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 2!= 0 && num / 10 % 2!= 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && num % 2!= 0 && num / 10 % 2!= 0 {
            count += 1
        }
    }
    return count
}
```
if num > 10 && num % 2!= 0 && num / 10 % 2!= 0 { // expression is not assignable: '&&' returns immutable value
if num > 10 && num % 2!= 0 && num / 10 % 2!= 0 { // expression is not assignable: '&&' returns immutable value
if num > 10 && num % 2!= 0 && num / 10 % 2!= 0 { // '=' must have consistent whitespace on both sides
if num > 10 && num % 2!= 0 && num / 10 % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if num > 10 && num % 2!= 0 && num / 10 % 2!= 0 { // '=' must have consistent whitespace on both sides
if num > 10 && num % 2!= 0 && num / 10 % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'
if num > 10 && num % 2!= 0 && num / 10 % 2!= 0 { // use of '=' in a boolean context, did you mean '=='?
if num > 10 && num % 2!= 0 && num / 10 % 2!= 0 { // type 'Int' cannot be used as a boolean; test for '!= 0' instead
if num > 10 && num % 2!= 0 && num / 10 % 2!= 0 { // integer literal value '0' cannot be used as a boolean; did you mean 'false'?
if num > 10 && num % 2!= 0 && num / 10 % 2!= 0 { // cannot force unwrap value of non-optional type 'Int'

func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        if num > 10 && (num % 10) % 2!= 0 && (num / 10) % 2!= 0 {
            count += 1
        }
    }
    return count
}
```swift
// Write a function that takes an array of numbers as input and returns 
// the number of elements in the array that are greater than 10 and both 
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
// specialFilter(nums: [15, -73, 14, -15]) == 1
// specialFilter(nums: [33, -2, -3, 45, 21, 109]) == 2
func specialFilter(nums: [Int]) -> Int {
    var count = 0
    for num in nums {
        i